You add a function definition to the WebKitClient interface, but then the
implementation of the interface is in the renderer code.  The renderer code
would then make the actual call to base.
When the renderer is initializing, it creates an instance of its
WebKitClient implementation
(src/chrome/renderer/renderer_webkitclient_impl.cc) and passes it into
WebKit (via the initialize function in src/webkit/api/public/WebKit.h if I
remember correctly..the .cpp file is in src/webkit/api/src/).

By either implementing your WebCore functions in src/webkit/api/src or using
ChromiumBridge, you can call the WebKitClient functions.

I'm pretty positive this is right.  Although not all of the code has landed
or had its final review yet, most of the code in the CL I listed earlier has
been reviewed by Darin.

J

On Sun, Jul 19, 2009 at 2:11 PM, Mike Belshe <mbel...@google.com> wrote:

> Thanks, Jeremy.  Are you sure this is right?  I don't think so.
> First, the README in WebKit/api says,
>
>> BASIC TYPES
>
>
>>   Use of STL is prohibited except in cases where it would be allowed in
>
>   WebCore.  This includes non-allocating uses: algorithms, numeric limits,
>> etc.
>
>   WTF container classes should be used in the implementation of this API.
>
>
>>   The API includes some usage of WebCore types when WEBKIT_IMPLEMENTATION
>> is
>
>   defined.  This is only done for the convenience to the implementation,
>> and
>
>   should not be considered part of the Chromium WebKit API.  Similarly, STL
>
>   types are assumed when WEBKIT_IMPLEMENTATION is not defined, which is
>> done
>
>   for the convenience of the consumer.
>
>
> That's a pretty clear condemnation of anything in base, right?
>
> Also, I'm not allowed to just do a #include of WebKitClient.h from WebKit
> code, right?  Or do I just do that under an ifdef?
>
> Mike
>
>
> On Sun, Jul 19, 2009 at 1:41 PM, Jeremy Orlow <jor...@chromium.org> wrote:
>
>> Take a look at src/webkit/api/public.  WebKitClient has all the hooks back
>> into Chromium.  src/chrome/renderer/renderer_webkitclient_impl.h implements
>> the WebKitClient interface.
>> I'm not exactly sure how you want to design the interface.  If it's just a
>> function or two and you don't need to maintain any state, then you can just
>> add functions directly to the WebKitClient.  If you need anything more
>> complicated, you should create a new interface in src/webkit/api/public and
>> add a function to WebKitClient that creates an instance of it.
>>
>> Patch set 8 here http://codereview.chromium.org/147248 might be a good
>> reference for how to use them.  (There's a lot there, but I think it should
>> be obvious which files you don't care about.)
>>
>> For calling to the WebKitClient functions, you have two options.  You can
>> either implement WebCore:: functions in src/webkit/api/src or you can make
>> your webcore/platform/chromium code call ChromiumBridge.  If you can do the
>> former cleanly, I think it's the preferred approach.  The above CL does it
>> the latter way in src/webkit/api/src/StorageNamespaceProxy.h.
>>
>> J
>>
>> On Sun, Jul 19, 2009 at 12:21 AM, Mike Belshe <mbel...@google.com> wrote:
>>
>>> I want to log something from within webkit and have it show up in
>>> Chrome's log.  This seemingly basic operation seems to be unsupported in
>>> chromium's version of webkit?
>>> First off, WebKit does have WTFLogging facilities (see logging.h and
>>> assertions.h) which are similar to our LOG(XXX) faciities.   There appears
>>> to be no way to turn these on within the chromium build, because we don't
>>> implement nor call the initialization routine
>>> (InitializeLoggingChannelsIfNecessary()).  OK - I can implement that......
>>>
>>> But next, I want the logging to actually go to chrome's log file.  The
>>> function to change is Assertions.cpp:vprintf_stderr_common().  I can add an
>>> if PLATFORM(CHROMIUM) here, and that would work, but how can I call code
>>> back in chromium's base?
>>>
>>> I don't think I can do this?  It seems I should add something to
>>> WebKit/WebCore/platform/chromium/.... but - any references to base won't
>>> work, right?  The README from webkit/api specifically says I can't use base
>>> code (std types) in the chromium bridge.
>>>
>>> What is the right way to do this?
>>>
>>> Mike
>>>
>>>
>>> >>>
>>>
>>
>

--~--~---------~--~----~------------~-------~--~----~
Chromium Developers mailing list: chromium-dev@googlegroups.com 
View archives, change email options, or unsubscribe: 
    http://groups.google.com/group/chromium-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to