diff options
author | ben <ben@chromium.org> | 2016-02-06 20:35:30 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-02-07 04:36:48 +0000 |
commit | 3a7cbe0bed9f9b81ab1da4ed0e4dba764345977e (patch) | |
tree | de412bbb84e68778685e868f2b62d873ffa2937d /components/resource_provider | |
parent | d345759c314c478c2b35f5ae6e6fd0698e532d2a (diff) | |
download | chromium_src-3a7cbe0bed9f9b81ab1da4ed0e4dba764345977e.zip chromium_src-3a7cbe0bed9f9b81ab1da4ed0e4dba764345977e.tar.gz chromium_src-3a7cbe0bed9f9b81ab1da4ed0e4dba764345977e.tar.bz2 |
Extract shell methods from ApplicationImpl into a base class, and pass this to Initialize() instead.
Also eliminates use of mojo::shell::mojom::Shell in favor of this base interface.
This means most code doesn't have to use ApplicationImpl - only the places that instantiate them.
TBR=rockot@chromium.org
BUG=
Review URL: https://codereview.chromium.org/1674903003
Cr-Commit-Position: refs/heads/master@{#374049}
Diffstat (limited to 'components/resource_provider')
5 files changed, 12 insertions, 13 deletions
diff --git a/components/resource_provider/public/cpp/resource_loader.cc b/components/resource_provider/public/cpp/resource_loader.cc index 21ce94d..a03d5a8 100644 --- a/components/resource_provider/public/cpp/resource_loader.cc +++ b/components/resource_provider/public/cpp/resource_loader.cc @@ -11,8 +11,7 @@ #include "base/files/file.h" #include "mojo/common/common_type_converters.h" #include "mojo/platform_handle/platform_handle_functions.h" -#include "mojo/shell/public/cpp/application_impl.h" -#include "mojo/shell/public/cpp/connect.h" +#include "mojo/shell/public/cpp/shell.h" #include "mojo/shell/public/interfaces/service_provider.mojom.h" #include "mojo/shell/public/interfaces/shell.mojom.h" @@ -27,10 +26,10 @@ base::File GetFileFromHandle(mojo::ScopedHandle handle) { } } -ResourceLoader::ResourceLoader(mojo::ApplicationImpl* app, +ResourceLoader::ResourceLoader(mojo::Shell* shell, const std::set<std::string>& paths) : loaded_(false), did_block_(false) { - app->ConnectToService("mojo:resource_provider", &resource_provider_); + shell->ConnectToService("mojo:resource_provider", &resource_provider_); std::vector<std::string> paths_vector(paths.begin(), paths.end()); resource_provider_->GetResources( mojo::Array<mojo::String>::From(paths_vector), diff --git a/components/resource_provider/public/cpp/resource_loader.h b/components/resource_provider/public/cpp/resource_loader.h index 5f17652..e355d6e 100644 --- a/components/resource_provider/public/cpp/resource_loader.h +++ b/components/resource_provider/public/cpp/resource_loader.h @@ -22,7 +22,7 @@ class File; } namespace mojo { -class ApplicationImpl; +class Shell; } namespace resource_provider { @@ -33,8 +33,7 @@ namespace resource_provider { // have been obtained. class ResourceLoader { public: - ResourceLoader(mojo::ApplicationImpl* app, - const std::set<std::string>& paths); + ResourceLoader(mojo::Shell* shell, const std::set<std::string>& paths); ~ResourceLoader(); // Uses WaitForIncomingMessage() to block until the results are available, or diff --git a/components/resource_provider/resource_provider_app.cc b/components/resource_provider/resource_provider_app.cc index f3e0ba5..79e034d 100644 --- a/components/resource_provider/resource_provider_app.cc +++ b/components/resource_provider/resource_provider_app.cc @@ -21,8 +21,9 @@ ResourceProviderApp::ResourceProviderApp( ResourceProviderApp::~ResourceProviderApp() { } -void ResourceProviderApp::Initialize(mojo::ApplicationImpl* app) { - tracing_.Initialize(app); +void ResourceProviderApp::Initialize(mojo::Shell* shell, const std::string& url, + uint32_t id) { + tracing_.Initialize(shell, url); } bool ResourceProviderApp::AcceptConnection( diff --git a/components/resource_provider/resource_provider_app.h b/components/resource_provider/resource_provider_app.h index 81b2750..8831e6c 100644 --- a/components/resource_provider/resource_provider_app.h +++ b/components/resource_provider/resource_provider_app.h @@ -16,7 +16,7 @@ #include "mojo/shell/public/cpp/interface_factory.h" namespace mojo { -class ApplicationImpl; +class Shell; } namespace resource_provider { @@ -29,7 +29,8 @@ class ResourceProviderApp : public mojo::ApplicationDelegate, private: // ApplicationDelegate: - void Initialize(mojo::ApplicationImpl* app) override; + void Initialize(mojo::Shell* shell, const std::string& url, + uint32_t id) override; bool AcceptConnection( mojo::ApplicationConnection* connection) override; diff --git a/components/resource_provider/resource_provider_apptest.cc b/components/resource_provider/resource_provider_apptest.cc index 86b7577..83e77e3 100644 --- a/components/resource_provider/resource_provider_apptest.cc +++ b/components/resource_provider/resource_provider_apptest.cc @@ -16,7 +16,6 @@ #include "mojo/public/cpp/bindings/array.h" #include "mojo/public/cpp/system/macros.h" #include "mojo/shell/public/cpp/application_delegate.h" -#include "mojo/shell/public/cpp/application_impl.h" #include "mojo/shell/public/cpp/application_test_base.h" #include "mojo/shell/public/cpp/service_provider_impl.h" @@ -58,7 +57,7 @@ class ResourceProviderApplicationTest : public mojo::test::ApplicationTestBase { // resources are returned. The return map maps from the path to the contents // of the file at the specified path. ResourceContentsMap GetResources(const std::set<std::string>& paths) { - ResourceLoader loader(application_impl(), paths); + ResourceLoader loader(shell(), paths); loader.BlockUntilLoaded(); // Load the contents of each of the handles. |