diff options
Diffstat (limited to 'components')
35 files changed, 99 insertions, 102 deletions
diff --git a/components/bitmap_uploader/bitmap_uploader.cc b/components/bitmap_uploader/bitmap_uploader.cc index 8a3a80f..acca97b 100644 --- a/components/bitmap_uploader/bitmap_uploader.cc +++ b/components/bitmap_uploader/bitmap_uploader.cc @@ -16,7 +16,7 @@ #include "mojo/converters/surfaces/surfaces_utils.h" #include "mojo/public/c/gles2/chromium_extension.h" #include "mojo/public/c/gles2/gles2.h" -#include "mojo/shell/public/cpp/shell.h" +#include "mojo/shell/public/cpp/connector.h" namespace bitmap_uploader { namespace { @@ -46,11 +46,11 @@ BitmapUploader::~BitmapUploader() { MojoGLES2DestroyContext(gles2_context_); } -void BitmapUploader::Init(mojo::Shell* shell) { +void BitmapUploader::Init(mojo::Connector* connector) { surface_ = window_->RequestSurface(mus::mojom::SurfaceType::DEFAULT); surface_->BindToThread(); - shell->ConnectToInterface("mojo:mus", &gpu_service_); + connector->ConnectToInterface("mojo:mus", &gpu_service_); mus::mojom::CommandBufferPtr gles2_client; gpu_service_->CreateOffscreenGLES2Context(GetProxy(&gles2_client)); gles2_context_ = MojoGLES2CreateContext( diff --git a/components/bitmap_uploader/bitmap_uploader.h b/components/bitmap_uploader/bitmap_uploader.h index cee37d6..65162ac 100644 --- a/components/bitmap_uploader/bitmap_uploader.h +++ b/components/bitmap_uploader/bitmap_uploader.h @@ -19,7 +19,7 @@ #include "mojo/public/c/gles2/gles2.h" namespace mojo { -class Shell; +class Connector; } namespace bitmap_uploader { @@ -34,7 +34,7 @@ class BITMAP_UPLOADER_EXPORT BitmapUploader explicit BitmapUploader(mus::Window* window); ~BitmapUploader() override; - void Init(mojo::Shell* shell); + void Init(mojo::Connector* connector); // Sets the color which is RGBA. void SetColor(uint32_t color); diff --git a/components/filesystem/file_system_app.cc b/components/filesystem/file_system_app.cc index 0de2211..8bb5354 100644 --- a/components/filesystem/file_system_app.cc +++ b/components/filesystem/file_system_app.cc @@ -8,7 +8,7 @@ #include "base/files/file_path.h" #include "base/files/file_util.h" #include "mojo/shell/public/cpp/connection.h" -#include "mojo/shell/public/cpp/shell.h" +#include "mojo/shell/public/cpp/connector.h" #if defined(OS_WIN) #include "base/base_paths_win.h" @@ -33,15 +33,14 @@ const char kUserDataDir[] = "user-data-dir"; } // namespace filesystem -FileSystemApp::FileSystemApp() - : shell_(nullptr), lock_table_(new LockTable) {} +FileSystemApp::FileSystemApp() : lock_table_(new LockTable) {} FileSystemApp::~FileSystemApp() {} -void FileSystemApp::Initialize(mojo::Shell* shell, const std::string& url, +void FileSystemApp::Initialize(mojo::Connector* connector, + const std::string& url, uint32_t id, uint32_t user_id) { - shell_ = shell; - tracing_.Initialize(shell, url); + tracing_.Initialize(connector, url); } bool FileSystemApp::AcceptConnection(mojo::Connection* connection) { diff --git a/components/filesystem/file_system_app.h b/components/filesystem/file_system_app.h index 3279415..f71eae9 100644 --- a/components/filesystem/file_system_app.h +++ b/components/filesystem/file_system_app.h @@ -15,7 +15,7 @@ #include "mojo/shell/public/cpp/shell_client.h" namespace mojo { -class Shell; +class Connector; } namespace filesystem { @@ -31,7 +31,7 @@ class FileSystemApp : public mojo::ShellClient, static base::FilePath GetUserDataDir(); // |mojo::ShellClient| override: - void Initialize(mojo::Shell* shell, const std::string& url, + void Initialize(mojo::Connector* connector, const std::string& url, uint32_t id, uint32_t user_id) override; bool AcceptConnection(mojo::Connection* connection) override; @@ -39,7 +39,6 @@ class FileSystemApp : public mojo::ShellClient, void Create(mojo::Connection* connection, mojo::InterfaceRequest<FileSystem> request) override; - mojo::Shell* shell_; mojo::TracingImpl tracing_; scoped_ptr<LockTable> lock_table_; diff --git a/components/filesystem/files_test_base.cc b/components/filesystem/files_test_base.cc index d47be02..15399c3 100644 --- a/components/filesystem/files_test_base.cc +++ b/components/filesystem/files_test_base.cc @@ -8,7 +8,7 @@ #include "components/filesystem/public/interfaces/directory.mojom.h" #include "components/filesystem/public/interfaces/types.mojom.h" -#include "mojo/shell/public/cpp/shell.h" +#include "mojo/shell/public/cpp/connector.h" #include "mojo/util/capture_util.h" namespace filesystem { @@ -21,7 +21,7 @@ FilesTestBase::~FilesTestBase() { void FilesTestBase::SetUp() { ApplicationTestBase::SetUp(); - shell()->ConnectToInterface("mojo:filesystem", &files_); + connector()->ConnectToInterface("mojo:filesystem", &files_); } void FilesTestBase::GetTemporaryRoot(DirectoryPtr* directory) { diff --git a/components/filesystem/public/cpp/prefs/pref_service_factory.cc b/components/filesystem/public/cpp/prefs/pref_service_factory.cc index 5c75bb6..add4532 100644 --- a/components/filesystem/public/cpp/prefs/pref_service_factory.cc +++ b/components/filesystem/public/cpp/prefs/pref_service_factory.cc @@ -12,7 +12,7 @@ #include "components/prefs/pref_value_store.h" #include "components/prefs/value_map_pref_store.h" #include "components/prefs/writeable_pref_store.h" -#include "mojo/shell/public/cpp/shell.h" +#include "mojo/shell/public/cpp/connector.h" namespace filesystem { @@ -23,10 +23,10 @@ void DoNothingHandleReadError(PersistentPrefStore::PrefReadError error) {} } // namespace -scoped_ptr<PrefService> CreatePrefService(mojo::Shell* shell, +scoped_ptr<PrefService> CreatePrefService(mojo::Connector* connector, PrefRegistry* pref_registry) { filesystem::FileSystemPtr filesystem; - shell->ConnectToInterface("mojo:filesystem", &filesystem); + connector->ConnectToInterface("mojo:filesystem", &filesystem); scoped_refptr<FilesystemJsonPrefStore> user_prefs = new FilesystemJsonPrefStore("preferences.json", std::move(filesystem), diff --git a/components/filesystem/public/cpp/prefs/pref_service_factory.h b/components/filesystem/public/cpp/prefs/pref_service_factory.h index bff3908..23ee9ff 100644 --- a/components/filesystem/public/cpp/prefs/pref_service_factory.h +++ b/components/filesystem/public/cpp/prefs/pref_service_factory.h @@ -9,7 +9,7 @@ #include "components/prefs/pref_service.h" namespace mojo { -class Shell; +class Connector; } class PrefRegistry; @@ -19,7 +19,7 @@ namespace filesystem { // This factory method creates a PrefService for the local process based on the // preference registry passed in. This PrefService will synchronize with a JSON // file in the mojo:filesystem. -scoped_ptr<PrefService> CreatePrefService(mojo::Shell* shell, +scoped_ptr<PrefService> CreatePrefService(mojo::Connector* connector, PrefRegistry* registry); } // namespace filesystem diff --git a/components/font_service/font_service_app.cc b/components/font_service/font_service_app.cc index 83cbb37..d599b09 100644 --- a/components/font_service/font_service_app.cc +++ b/components/font_service/font_service_app.cc @@ -58,9 +58,10 @@ FontServiceApp::FontServiceApp() {} FontServiceApp::~FontServiceApp() {} -void FontServiceApp::Initialize(mojo::Shell* shell, const std::string& url, +void FontServiceApp::Initialize(mojo::Connector* connector, + const std::string& url, uint32_t id, uint32_t user_id) { - tracing_.Initialize(shell, url); + tracing_.Initialize(connector, url); } bool FontServiceApp::AcceptConnection(mojo::Connection* connection) { diff --git a/components/font_service/font_service_app.h b/components/font_service/font_service_app.h index 2963720..71d29cc 100644 --- a/components/font_service/font_service_app.h +++ b/components/font_service/font_service_app.h @@ -27,7 +27,7 @@ class FontServiceApp : public mojo::ShellClient, private: // mojo::ShellClient: - void Initialize(mojo::Shell* shell, const std::string& url, + void Initialize(mojo::Connector* connector, const std::string& url, uint32_t id, uint32_t user_id) override; bool AcceptConnection(mojo::Connection* connection) override; diff --git a/components/font_service/public/cpp/font_loader.cc b/components/font_service/public/cpp/font_loader.cc index 719d63d..03df30f 100644 --- a/components/font_service/public/cpp/font_loader.cc +++ b/components/font_service/public/cpp/font_loader.cc @@ -9,13 +9,13 @@ #include "base/bind.h" #include "base/trace_event/trace_event.h" #include "components/font_service/public/cpp/font_service_thread.h" -#include "mojo/shell/public/cpp/shell.h" +#include "mojo/shell/public/cpp/connector.h" namespace font_service { -FontLoader::FontLoader(mojo::Shell* shell) { +FontLoader::FontLoader(mojo::Connector* connector) { FontServicePtr font_service; - shell->ConnectToInterface("mojo:font_service", &font_service); + connector->ConnectToInterface("mojo:font_service", &font_service); thread_ = new internal::FontServiceThread(std::move(font_service)); } diff --git a/components/font_service/public/cpp/font_loader.h b/components/font_service/public/cpp/font_loader.h index 838b8ec..557241f 100644 --- a/components/font_service/public/cpp/font_loader.h +++ b/components/font_service/public/cpp/font_loader.h @@ -18,7 +18,7 @@ #include "third_party/skia/include/ports/SkFontConfigInterface.h" namespace mojo { -class Shell; +class Connector; } namespace font_service { @@ -35,7 +35,7 @@ class FontServiceThread; class FontLoader : public SkFontConfigInterface, public internal::MappedFontFile::Observer { public: - explicit FontLoader(mojo::Shell* shell); + explicit FontLoader(mojo::Connector* connector); ~FontLoader() override; // Shuts down the background thread. diff --git a/components/leveldb/leveldb_app.cc b/components/leveldb/leveldb_app.cc index 01fd2ff..952d4f3 100644 --- a/components/leveldb/leveldb_app.cc +++ b/components/leveldb/leveldb_app.cc @@ -13,11 +13,11 @@ LevelDBApp::LevelDBApp() {} LevelDBApp::~LevelDBApp() {} -void LevelDBApp::Initialize(mojo::Shell* shell, +void LevelDBApp::Initialize(mojo::Connector* connector, const std::string& url, uint32_t id, uint32_t user_id) { - tracing_.Initialize(shell, url); + tracing_.Initialize(connector, url); service_.reset(new LevelDBServiceImpl); } diff --git a/components/leveldb/leveldb_app.h b/components/leveldb/leveldb_app.h index d1cd684..d9877d9 100644 --- a/components/leveldb/leveldb_app.h +++ b/components/leveldb/leveldb_app.h @@ -21,7 +21,7 @@ class LevelDBApp : public mojo::ShellClient, private: // |ShellClient| override: - void Initialize(mojo::Shell* shell, + void Initialize(mojo::Connector* connector, const std::string& url, uint32_t id, uint32_t user_id) override; diff --git a/components/leveldb/leveldb_apptest.cc b/components/leveldb/leveldb_apptest.cc index 076e9f7..2a99adc 100644 --- a/components/leveldb/leveldb_apptest.cc +++ b/components/leveldb/leveldb_apptest.cc @@ -28,8 +28,8 @@ class LevelDBApptest : public mojo::test::ApplicationTestBase { // Overridden from mojo::test::ApplicationTestBase: void SetUp() override { ApplicationTestBase::SetUp(); - shell()->ConnectToInterface("mojo:filesystem", &files_); - shell()->ConnectToInterface("mojo:leveldb", &leveldb_); + connector()->ConnectToInterface("mojo:filesystem", &files_); + connector()->ConnectToInterface("mojo:leveldb", &leveldb_); } // Note: This has an out parameter rather than returning the |DirectoryPtr|, diff --git a/components/mus/mus_app.cc b/components/mus/mus_app.cc index ea2410b..3d98051 100644 --- a/components/mus/mus_app.cc +++ b/components/mus/mus_app.cc @@ -21,7 +21,7 @@ #include "mojo/public/c/system/main.h" #include "mojo/services/tracing/public/cpp/tracing_impl.h" #include "mojo/shell/public/cpp/connection.h" -#include "mojo/shell/public/cpp/shell.h" +#include "mojo/shell/public/cpp/connector.h" #include "ui/base/resource/resource_bundle.h" #include "ui/base/ui_base_paths.h" #include "ui/events/event_switches.h" @@ -58,7 +58,7 @@ struct MandolineUIServicesApp::PendingRequest { }; MandolineUIServicesApp::MandolineUIServicesApp() - : shell_(nullptr) {} + : connector_(nullptr) {} MandolineUIServicesApp::~MandolineUIServicesApp() { if (gpu_state_) @@ -67,7 +67,7 @@ MandolineUIServicesApp::~MandolineUIServicesApp() { connection_manager_.reset(); } -void MandolineUIServicesApp::InitializeResources(mojo::Shell* shell) { +void MandolineUIServicesApp::InitializeResources(mojo::Connector* connector) { if (ui::ResourceBundle::HasSharedInstance()) return; @@ -76,7 +76,7 @@ void MandolineUIServicesApp::InitializeResources(mojo::Shell* shell) { resource_paths.insert(kResourceFile100); resource_paths.insert(kResourceFile200); - resource_provider::ResourceLoader resource_loader(shell, resource_paths); + resource_provider::ResourceLoader resource_loader(connector, resource_paths); if (!resource_loader.BlockUntilLoaded()) return; CHECK(resource_loader.loaded()); @@ -92,11 +92,11 @@ void MandolineUIServicesApp::InitializeResources(mojo::Shell* shell) { resource_loader.ReleaseFile(kResourceFile200), ui::SCALE_FACTOR_200P); } -void MandolineUIServicesApp::Initialize(mojo::Shell* shell, +void MandolineUIServicesApp::Initialize(mojo::Connector* connector, const std::string& url, uint32_t id, uint32_t user_id) { - shell_ = shell; + connector_ = connector; surfaces_state_ = new SurfacesState; base::PlatformThread::SetName("mus"); @@ -109,7 +109,7 @@ void MandolineUIServicesApp::Initialize(mojo::Shell* shell, } #endif - InitializeResources(shell); + InitializeResources(connector); #if defined(USE_OZONE) // The ozone platform can provide its own event source. So initialize the @@ -132,7 +132,7 @@ void MandolineUIServicesApp::Initialize(mojo::Shell* shell, gpu_state_ = new GpuState(); connection_manager_.reset(new ws::ConnectionManager(this, surfaces_state_)); - tracing_.Initialize(shell, url); + tracing_.Initialize(connector, url); } bool MandolineUIServicesApp::AcceptConnection(Connection* connection) { @@ -156,7 +156,7 @@ void MandolineUIServicesApp::OnFirstRootConnectionCreated() { } void MandolineUIServicesApp::OnNoMoreRootConnections() { - shell_->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); } ws::ClientConnection* @@ -230,7 +230,7 @@ void MandolineUIServicesApp::CreateWindowTreeHost( // TODO(fsamuel): We need to make sure that only the window manager can create // new roots. ws::WindowTreeHostImpl* host_impl = new ws::WindowTreeHostImpl( - connection_manager_.get(), shell_, gpu_state_, surfaces_state_); + connection_manager_.get(), connector_, gpu_state_, surfaces_state_); // WindowTreeHostConnection manages its own lifetime. host_impl->Init(new ws::WindowTreeHostConnectionImpl( diff --git a/components/mus/mus_app.h b/components/mus/mus_app.h index 5a349c5..5c80f47 100644 --- a/components/mus/mus_app.h +++ b/components/mus/mus_app.h @@ -24,7 +24,7 @@ #include "mojo/shell/public/cpp/shell_client.h" namespace mojo { -class Shell; +class Connector; } namespace ui { @@ -60,10 +60,10 @@ class MandolineUIServicesApp // has been established. struct PendingRequest; - void InitializeResources(mojo::Shell* shell); + void InitializeResources(mojo::Connector* connector); // mojo::ShellClient: - void Initialize(mojo::Shell* shell, const std::string& url, + void Initialize(mojo::Connector* connector, const std::string& url, uint32_t id, uint32_t user_id) override; bool AcceptConnection(mojo::Connection* connection) override; @@ -105,7 +105,7 @@ class MandolineUIServicesApp mojom::WindowTreeClientPtr tree_client) override; mojo::BindingSet<mojom::WindowTreeHostFactory> factory_bindings_; - mojo::Shell* shell_; + mojo::Connector* connector_; scoped_ptr<ws::ConnectionManager> connection_manager_; scoped_refptr<GpuState> gpu_state_; scoped_ptr<ui::PlatformEventSource> event_source_; diff --git a/components/mus/public/cpp/lib/window_tree_client_impl.cc b/components/mus/public/cpp/lib/window_tree_client_impl.cc index b1107af..cdcd7b6 100644 --- a/components/mus/public/cpp/lib/window_tree_client_impl.cc +++ b/components/mus/public/cpp/lib/window_tree_client_impl.cc @@ -19,7 +19,7 @@ #include "components/mus/public/cpp/window_tree_connection_observer.h" #include "components/mus/public/cpp/window_tree_delegate.h" #include "mojo/converters/geometry/geometry_type_converters.h" -#include "mojo/shell/public/cpp/shell.h" +#include "mojo/shell/public/cpp/connector.h" #include "ui/gfx/geometry/insets.h" #include "ui/gfx/geometry/size.h" @@ -80,10 +80,10 @@ Window* BuildWindowTree(WindowTreeClientImpl* client, } WindowTreeConnection* WindowTreeConnection::Create(WindowTreeDelegate* delegate, - mojo::Shell* shell) { + mojo::Connector* connector) { WindowTreeClientImpl* client = new WindowTreeClientImpl(delegate, nullptr, nullptr); - client->ConnectViaWindowTreeFactory(shell); + client->ConnectViaWindowTreeFactory(connector); return client; } @@ -159,7 +159,7 @@ WindowTreeClientImpl::~WindowTreeClientImpl() { } void WindowTreeClientImpl::ConnectViaWindowTreeFactory( - mojo::Shell* shell) { + mojo::Connector* connector) { // Clients created with no root shouldn't delete automatically. delete_on_no_roots_ = false; @@ -167,7 +167,7 @@ void WindowTreeClientImpl::ConnectViaWindowTreeFactory( connection_id_ = 101; mojom::WindowTreeFactoryPtr factory; - shell->ConnectToInterface("mojo:mus", &factory); + connector->ConnectToInterface("mojo:mus", &factory); factory->CreateWindowTree(GetProxy(&tree_ptr_), binding_.CreateInterfacePtrAndBind()); tree_ = tree_ptr_.get(); diff --git a/components/mus/public/cpp/lib/window_tree_client_impl.h b/components/mus/public/cpp/lib/window_tree_client_impl.h index 991473b..9d75fa7 100644 --- a/components/mus/public/cpp/lib/window_tree_client_impl.h +++ b/components/mus/public/cpp/lib/window_tree_client_impl.h @@ -45,7 +45,7 @@ class WindowTreeClientImpl : public WindowTreeConnection, ~WindowTreeClientImpl() override; // Establishes the connection by way of the WindowTreeFactory. - void ConnectViaWindowTreeFactory(mojo::Shell* shell); + void ConnectViaWindowTreeFactory(mojo::Connector* connector); // Wait for OnEmbed(), returning when done. void WaitForEmbed(); diff --git a/components/mus/public/cpp/lib/window_tree_host_factory.cc b/components/mus/public/cpp/lib/window_tree_host_factory.cc index 88c45d7..54e4d3c 100644 --- a/components/mus/public/cpp/lib/window_tree_host_factory.cc +++ b/components/mus/public/cpp/lib/window_tree_host_factory.cc @@ -6,7 +6,7 @@ #include "components/mus/public/cpp/window_tree_connection.h" #include "components/mus/public/cpp/window_tree_delegate.h" -#include "mojo/shell/public/cpp/shell.h" +#include "mojo/shell/public/cpp/connector.h" namespace mus { @@ -22,12 +22,12 @@ void CreateWindowTreeHost(mojom::WindowTreeHostFactory* factory, factory->CreateWindowTreeHost(GetProxy(host), std::move(tree_client)); } -void CreateWindowTreeHost(mojo::Shell* shell, +void CreateWindowTreeHost(mojo::Connector* connector, WindowTreeDelegate* delegate, mojom::WindowTreeHostPtr* host, WindowManagerDelegate* window_manager_delegate) { mojom::WindowTreeHostFactoryPtr factory; - shell->ConnectToInterface("mojo:mus", &factory); + connector->ConnectToInterface("mojo:mus", &factory); CreateWindowTreeHost(factory.get(), delegate, host, window_manager_delegate); } diff --git a/components/mus/public/cpp/tests/window_server_test_base.cc b/components/mus/public/cpp/tests/window_server_test_base.cc index ab47629..affbf31 100644 --- a/components/mus/public/cpp/tests/window_server_test_base.cc +++ b/components/mus/public/cpp/tests/window_server_test_base.cc @@ -11,7 +11,7 @@ #include "components/mus/public/cpp/window.h" #include "components/mus/public/cpp/window_tree_connection.h" #include "components/mus/public/cpp/window_tree_host_factory.h" -#include "mojo/shell/public/cpp/shell.h" +#include "mojo/shell/public/cpp/connector.h" namespace mus { namespace { @@ -65,7 +65,7 @@ bool WindowServerTestBase::QuitRunLoop() { void WindowServerTestBase::SetUp() { ApplicationTestBase::SetUp(); - CreateWindowTreeHost(shell(), this, &host_, this); + CreateWindowTreeHost(connector(), this, &host_, this); ASSERT_TRUE(DoRunLoopWithTimeout()); // RunLoop should be quit by OnEmbed(). std::swap(window_manager_, most_recent_connection_); diff --git a/components/mus/public/cpp/window_tree_connection.h b/components/mus/public/cpp/window_tree_connection.h index 31528ac..d99eda2 100644 --- a/components/mus/public/cpp/window_tree_connection.h +++ b/components/mus/public/cpp/window_tree_connection.h @@ -16,7 +16,7 @@ #include "mojo/public/cpp/bindings/interface_request.h" namespace mojo { -class Shell; +class Connector; } namespace mus { @@ -43,7 +43,7 @@ class WindowTreeConnection { // Creates a WindowTreeConnection with no roots. Use this to establish a // connection directly to mus and create top level windows. static WindowTreeConnection* Create(WindowTreeDelegate* delegate, - mojo::Shell* shell); + mojo::Connector* connector); // Creates a WindowTreeConnection to service the specified request for // a WindowTreeClient. Use this to be embedded in another app. diff --git a/components/mus/public/cpp/window_tree_host_factory.h b/components/mus/public/cpp/window_tree_host_factory.h index 1c75de8..b3a5bab 100644 --- a/components/mus/public/cpp/window_tree_host_factory.h +++ b/components/mus/public/cpp/window_tree_host_factory.h @@ -11,7 +11,7 @@ #include "mojo/public/cpp/bindings/binding.h" namespace mojo { -class Shell; +class Connector; } namespace mus { @@ -26,7 +26,7 @@ void CreateWindowTreeHost(mojom::WindowTreeHostFactory* factory, WindowTreeDelegate* delegate, mojom::WindowTreeHostPtr* host, WindowManagerDelegate* window_manager_delegate); -void CreateWindowTreeHost(mojo::Shell* shell, +void CreateWindowTreeHost(mojo::Connector* connector, WindowTreeDelegate* delegate, mojom::WindowTreeHostPtr* host, WindowManagerDelegate* window_manager_delegate); diff --git a/components/mus/ws/display_manager.cc b/components/mus/ws/display_manager.cc index a35e08b..8b991f8 100644 --- a/components/mus/ws/display_manager.cc +++ b/components/mus/ws/display_manager.cc @@ -29,7 +29,7 @@ #include "mojo/converters/surfaces/surfaces_utils.h" #include "mojo/converters/transform/transform_type_converters.h" #include "mojo/shell/public/cpp/connection.h" -#include "mojo/shell/public/cpp/shell.h" +#include "mojo/shell/public/cpp/connector.h" #include "third_party/skia/include/core/SkXfermode.h" #include "ui/base/cursor/cursor_loader.h" #include "ui/events/event.h" @@ -155,19 +155,19 @@ DisplayManagerFactory* DisplayManager::factory_ = nullptr; // static DisplayManager* DisplayManager::Create( - mojo::Shell* shell, + mojo::Connector* connector, const scoped_refptr<GpuState>& gpu_state, const scoped_refptr<SurfacesState>& surfaces_state) { if (factory_) - return factory_->CreateDisplayManager(shell, gpu_state, surfaces_state); - return new DefaultDisplayManager(shell, gpu_state, surfaces_state); + return factory_->CreateDisplayManager(connector, gpu_state, surfaces_state); + return new DefaultDisplayManager(connector, gpu_state, surfaces_state); } DefaultDisplayManager::DefaultDisplayManager( - mojo::Shell* shell, + mojo::Connector* connector, const scoped_refptr<GpuState>& gpu_state, const scoped_refptr<SurfacesState>& surfaces_state) - : shell_(shell), + : connector_(connector), gpu_state_(gpu_state), surfaces_state_(surfaces_state), delegate_(nullptr), diff --git a/components/mus/ws/display_manager.h b/components/mus/ws/display_manager.h index 49a1f92..ce93485 100644 --- a/components/mus/ws/display_manager.h +++ b/components/mus/ws/display_manager.h @@ -35,7 +35,7 @@ class GpuState; } // namespace gles2 namespace mojo { -class Shell; +class Connector; } // namespace mojo namespace ui { @@ -63,7 +63,7 @@ class DisplayManager { virtual ~DisplayManager() {} static DisplayManager* Create( - mojo::Shell* shell, + mojo::Connector* connector, const scoped_refptr<GpuState>& gpu_state, const scoped_refptr<SurfacesState>& surfaces_state); @@ -112,7 +112,7 @@ class DisplayManager { class DefaultDisplayManager : public DisplayManager, public ui::PlatformWindowDelegate { public: - DefaultDisplayManager(mojo::Shell* shell, + DefaultDisplayManager(mojo::Connector* connector, const scoped_refptr<GpuState>& gpu_state, const scoped_refptr<SurfacesState>& surfaces_state); ~DefaultDisplayManager() override; @@ -162,7 +162,7 @@ class DefaultDisplayManager : public DisplayManager, void OnAcceleratedWidgetDestroyed() override; void OnActivationChanged(bool active) override; - mojo::Shell* shell_; + mojo::Connector* connector_; scoped_refptr<GpuState> gpu_state_; scoped_refptr<SurfacesState> surfaces_state_; DisplayManagerDelegate* delegate_; diff --git a/components/mus/ws/display_manager_factory.h b/components/mus/ws/display_manager_factory.h index 49bc734..f73ac80 100644 --- a/components/mus/ws/display_manager_factory.h +++ b/components/mus/ws/display_manager_factory.h @@ -9,7 +9,7 @@ #include "mojo/public/cpp/bindings/callback.h" namespace mojo { -class Shell; +class Connector; } namespace mus { @@ -23,7 +23,7 @@ class DisplayManager; class DisplayManagerFactory { public: virtual DisplayManager* CreateDisplayManager( - mojo::Shell* shell, + mojo::Connector* connector, const scoped_refptr<mus::GpuState>& gpu_state, const scoped_refptr<mus::SurfacesState>& surfaces_state) = 0; }; diff --git a/components/mus/ws/window_manager_client_apptest.cc b/components/mus/ws/window_manager_client_apptest.cc index 5d9f111..8bc7972 100644 --- a/components/mus/ws/window_manager_client_apptest.cc +++ b/components/mus/ws/window_manager_client_apptest.cc @@ -275,7 +275,7 @@ class WindowServerTest : public WindowServerTestBase { // WindowTreeClient. mus::mojom::WindowTreeClientPtr ConnectAndGetWindowServerClient() { mus::mojom::WindowTreeClientPtr client; - shell()->ConnectToInterface(shell_url(), &client); + connector()->ConnectToInterface(test_url(), &client); return client; } @@ -1159,7 +1159,7 @@ TEST_F(WindowServerTest, EstablishConnectionViaFactory) { EstablishConnectionViaFactoryDelegate delegate(window_manager()); set_window_manager_delegate(&delegate); scoped_ptr<WindowTreeConnection> second_connection( - WindowTreeConnection::Create(this, shell())); + WindowTreeConnection::Create(this, connector())); Window* window_in_second_connection = second_connection->NewTopLevelWindow(nullptr); ASSERT_TRUE(window_in_second_connection); diff --git a/components/mus/ws/window_tree_apptest.cc b/components/mus/ws/window_tree_apptest.cc index ee2a186..cc18e0d 100644 --- a/components/mus/ws/window_tree_apptest.cc +++ b/components/mus/ws/window_tree_apptest.cc @@ -63,7 +63,7 @@ void EmbedCallbackImpl(base::RunLoop* run_loop, // ----------------------------------------------------------------------------- -bool EmbedUrl(mojo::Shell* shell, +bool EmbedUrl(mojo::Connector* connector, WindowTree* ws, const String& url, Id root_id) { @@ -71,7 +71,7 @@ bool EmbedUrl(mojo::Shell* shell, base::RunLoop run_loop; { mojom::WindowTreeClientPtr client; - shell->ConnectToInterface(url.get(), &client); + connector->ConnectToInterface(url.get(), &client); ws->Embed(root_id, std::move(client), mojom::WindowTree::kAccessPolicyDefault, base::Bind(&EmbedCallbackImpl, &run_loop, &result)); @@ -547,7 +547,7 @@ class WindowTreeAppTest : public mojo::test::ApplicationTestBase, Id root_id, uint32_t policy_bitmask, int* connection_id) { - if (!EmbedUrl(shell(), owner, shell_url(), root_id)) { + if (!EmbedUrl(connector(), owner, test_url(), root_id)) { ADD_FAILURE() << "Embed() failed"; return nullptr; } @@ -573,7 +573,7 @@ class WindowTreeAppTest : public mojo::test::ApplicationTestBase, client_factory_.reset(new WindowTreeClientFactory()); mojom::WindowTreeHostFactoryPtr factory; - shell()->ConnectToInterface("mojo:mus", &factory); + connector()->ConnectToInterface("mojo:mus", &factory); mojom::WindowTreeClientPtr tree_client_ptr; ws_client1_.reset(new TestWindowTreeClientImpl()); @@ -1724,7 +1724,7 @@ TEST_F(WindowTreeAppTest, EmbedFailsFromOtherConnection) { // 2 should not be able to embed in window_3_3 as window_3_3 was not created // by // 2. - EXPECT_FALSE(EmbedUrl(shell(), ws2(), shell_url(), window_3_3)); + EXPECT_FALSE(EmbedUrl(connector(), ws2(), test_url(), window_3_3)); } // Verifies Embed() from window manager on another connections window works. @@ -1747,7 +1747,7 @@ TEST_F(WindowTreeAppTest, EmbedFromOtherConnection) { TEST_F(WindowTreeAppTest, CantEmbedFromConnectionRoot) { // Shouldn't be able to embed into the root. - ASSERT_FALSE(EmbedUrl(shell(), ws1(), shell_url(), root_window_id())); + ASSERT_FALSE(EmbedUrl(connector(), ws1(), test_url(), root_window_id())); // Even though the call above failed a WindowTreeClient was obtained. We need // to @@ -1756,7 +1756,7 @@ TEST_F(WindowTreeAppTest, CantEmbedFromConnectionRoot) { // Don't allow a connection to embed into its own root. ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); - EXPECT_FALSE(EmbedUrl(shell(), ws2(), shell_url(), + EXPECT_FALSE(EmbedUrl(connector(), ws2(), test_url(), BuildWindowId(connection_id_1(), 1))); // Need to wait for a WindowTreeClient for same reason as above. @@ -1773,7 +1773,7 @@ TEST_F(WindowTreeAppTest, CantEmbedFromConnectionRoot) { // window_1_2 is ws3's root, so even though v3 is an embed root it should not // be able to Embed into itself. - ASSERT_FALSE(EmbedUrl(shell(), ws3(), shell_url(), window_1_2)); + ASSERT_FALSE(EmbedUrl(connector(), ws3(), test_url(), window_1_2)); } // Verifies that a transient window tracks its parent's lifetime. diff --git a/components/mus/ws/window_tree_host_impl.cc b/components/mus/ws/window_tree_host_impl.cc index d80ef83..46f3e91 100644 --- a/components/mus/ws/window_tree_host_impl.cc +++ b/components/mus/ws/window_tree_host_impl.cc @@ -87,7 +87,7 @@ WindowTreeHostImpl::QueuedEvent::~QueuedEvent() {} WindowTreeHostImpl::WindowTreeHostImpl( ConnectionManager* connection_manager, - mojo::Shell* shell, + mojo::Connector* connector, const scoped_refptr<GpuState>& gpu_state, const scoped_refptr<SurfacesState>& surfaces_state) : id_(next_id++), @@ -95,7 +95,7 @@ WindowTreeHostImpl::WindowTreeHostImpl( connection_manager_(connection_manager), event_dispatcher_(this), display_manager_( - DisplayManager::Create(shell, gpu_state, surfaces_state)), + DisplayManager::Create(connector, gpu_state, surfaces_state)), tree_awaiting_input_ack_(nullptr), last_cursor_(0) { frame_decoration_values_ = mojom::FrameDecorationValues::New(); diff --git a/components/mus/ws/window_tree_host_impl.h b/components/mus/ws/window_tree_host_impl.h index cace4be..a1f93d1 100644 --- a/components/mus/ws/window_tree_host_impl.h +++ b/components/mus/ws/window_tree_host_impl.h @@ -48,7 +48,7 @@ class WindowTreeHostImpl : public DisplayManagerDelegate, // DisplayManagers. We should probably just store these common parameters // in the DisplayManagerFactory and pass them along on DisplayManager::Create. WindowTreeHostImpl(ConnectionManager* connection_manager, - mojo::Shell* shell, + mojo::Connector* connector, const scoped_refptr<GpuState>& gpu_state, const scoped_refptr<SurfacesState>& surfaces_state); ~WindowTreeHostImpl() override; diff --git a/components/mus/ws/window_tree_unittest.cc b/components/mus/ws/window_tree_unittest.cc index 99e53a5..bafcf2d 100644 --- a/components/mus/ws/window_tree_unittest.cc +++ b/components/mus/ws/window_tree_unittest.cc @@ -352,7 +352,7 @@ class TestDisplayManagerFactory : public DisplayManagerFactory { : cursor_id_storage_(cursor_id_storage) {} ~TestDisplayManagerFactory() {} DisplayManager* CreateDisplayManager( - mojo::Shell* shell, + mojo::Connector* connector, const scoped_refptr<GpuState>& gpu_state, const scoped_refptr<mus::SurfacesState>& surfaces_state) override { return new TestDisplayManager(cursor_id_storage_); diff --git a/components/resource_provider/public/cpp/resource_loader.cc b/components/resource_provider/public/cpp/resource_loader.cc index 1bd8b7c..fc33a36 100644 --- a/components/resource_provider/public/cpp/resource_loader.cc +++ b/components/resource_provider/public/cpp/resource_loader.cc @@ -11,7 +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/shell.h" +#include "mojo/shell/public/cpp/connector.h" #include "mojo/shell/public/interfaces/interface_provider.mojom.h" #include "mojo/shell/public/interfaces/shell.mojom.h" @@ -26,10 +26,10 @@ base::File GetFileFromHandle(mojo::ScopedHandle handle) { } } -ResourceLoader::ResourceLoader(mojo::Shell* shell, +ResourceLoader::ResourceLoader(mojo::Connector* connector, const std::set<std::string>& paths) : loaded_(false), did_block_(false) { - shell->ConnectToInterface("mojo:resource_provider", &resource_provider_); + connector->ConnectToInterface("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 e355d6e..033cfdd 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 Shell; +class Connector; } namespace resource_provider { @@ -33,7 +33,8 @@ namespace resource_provider { // have been obtained. class ResourceLoader { public: - ResourceLoader(mojo::Shell* shell, const std::set<std::string>& paths); + ResourceLoader(mojo::Connector* connector, + 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 b3723ab..85e6e28 100644 --- a/components/resource_provider/resource_provider_app.cc +++ b/components/resource_provider/resource_provider_app.cc @@ -21,9 +21,10 @@ ResourceProviderApp::ResourceProviderApp( ResourceProviderApp::~ResourceProviderApp() { } -void ResourceProviderApp::Initialize(mojo::Shell* shell, const std::string& url, +void ResourceProviderApp::Initialize(mojo::Connector* connector, + const std::string& url, uint32_t id, uint32_t user_id) { - tracing_.Initialize(shell, url); + tracing_.Initialize(connector, url); } bool ResourceProviderApp::AcceptConnection(mojo::Connection* connection) { diff --git a/components/resource_provider/resource_provider_app.h b/components/resource_provider/resource_provider_app.h index 056c97f..0f2d0f0 100644 --- a/components/resource_provider/resource_provider_app.h +++ b/components/resource_provider/resource_provider_app.h @@ -15,10 +15,6 @@ #include "mojo/shell/public/cpp/interface_factory.h" #include "mojo/shell/public/cpp/shell_client.h" -namespace mojo { -class Shell; -} - namespace resource_provider { class ResourceProviderApp : public mojo::ShellClient, @@ -29,7 +25,7 @@ class ResourceProviderApp : public mojo::ShellClient, private: // mojo::ShellClient: - void Initialize(mojo::Shell* shell, const std::string& url, + void Initialize(mojo::Connector* connector, const std::string& url, uint32_t id, uint32_t user_id) override; bool AcceptConnection(mojo::Connection* connection) override; diff --git a/components/resource_provider/resource_provider_apptest.cc b/components/resource_provider/resource_provider_apptest.cc index cc5bfe1..aecd282 100644 --- a/components/resource_provider/resource_provider_apptest.cc +++ b/components/resource_provider/resource_provider_apptest.cc @@ -55,7 +55,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(shell(), paths); + ResourceLoader loader(connector(), paths); loader.BlockUntilLoaded(); // Load the contents of each of the handles. |