DescriptionAdd BlimpClientContext and factory with real and dummy implementation
The BlimpClientContext is the core class which wires up all of the blimp
functionality. When it's created, it will get all its dependencies from
the embedder. It is currently in charge of creating BlimpContents, but
will also own things like the BlimpClientSession. It is part of the
public //blimp/client/public API. It is a KeyedService and is typically
tied to a Profile.
The BlimpClientContextFactory lives in //chrome to be able to access
Profile during construction, since //blimp/client currently does not
depend on //content where BrowserContext lives, and there are upcoming
dependencies that will be implemented by classes in //chrome.
The BlimpClientContext has two implementations in
//blimp/client/core, an actual one and a dummy implementation. The
dummy implementation is to be used when we do not want the blimp
code to be used, and the core implementation is the real blimp
implementation. Which one of these are in use is controlled by the
GN argument enable_blimp which defaults to false.
The BlimpClientContext has a public static create-method that is not
implemented in //blimp/client/public, but instead it is implemented by
//blimp/client/core by both the actual and the dummy implementation,
so the right method will be chosen at link-time. This means that a
target can only link with either the actual or dummy implementation.
Everything in //blimp/client/core is only visible to //blimp/client/*
and embedders should only ever depend on //blimp/client/public, which
will bring in the correct implementation. This works the same for both
C++ and Java, so when using the BlimpClientContextFactory (either in
Java or C++), the right implementation (actual or dummy) will always
be chosen correctly based on the link-time selection of the
Create-method.
The BlimpClientContext has a delegate that it can call out to whenever
it needs specific functionality from the embedder. As an example, this
CL adds a helper for attaching a Profile to every created
BlimpContents to make have similar functionality as what is built into
WebContents so one can get a Profile and thereby services by only
having access to a BlimpContents.
BUG=611094
TBR=erg@chromium.org
Committed: https://crrev.com/9aa0cdee23229ca95a3bea79abcc584a395d016e
Cr-Commit-Position: refs/heads/master@{#405860}
Patch Set 1 #Patch Set 2 : Move factory to chrome and add dummy #Patch Set 3 : add blimp include to chrome GN file #Patch Set 4 : Add simple unittest for factory and fix build for !enable_blimp #Patch Set 5 : Fix naming of create vs get #Patch Set 6 : Cleaned up the patch #Patch Set 7 : Track master #Patch Set 8 : Fix includes, DEPS and deps #Patch Set 9 : remove unused private field #Patch Set 10 : Added delegate-support to BlimpClientContext #
Total comments: 6
Patch Set 11 : Address comments. #Patch Set 12 : merge origin/master for good measure #
Total comments: 6
Patch Set 13 : Move //blimp/client/dummy to //blimp/client/core and make //chrome depend only on //blimp/client/pu… #
Total comments: 9
Patch Set 14 : Address last comments from dpranke #Patch Set 15 : git merge origin/master before CQ for good measure #Messages
Total messages: 43 (25 generated)
|