diff options
author | ben <ben@chromium.org> | 2016-02-25 23:30:25 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-02-26 07:31:39 +0000 |
commit | e4a2bc4fb161d8d2ea673d5f55119d36be2cf06f (patch) | |
tree | a09be63e6724713539bd7065ecdcb38b0233a73e /mash | |
parent | 0d78506780d9bf1e5e80a0bfca6099a80fd355e0 (diff) | |
download | chromium_src-e4a2bc4fb161d8d2ea673d5f55119d36be2cf06f.zip chromium_src-e4a2bc4fb161d8d2ea673d5f55119d36be2cf06f.tar.gz chromium_src-e4a2bc4fb161d8d2ea673d5f55119d36be2cf06f.tar.bz2 |
Replace with mojo::Connector (already exists) now that Shell is gone.
Requires:
- Move AppRefCount to a different class, MessageLoopRef, which is optionally used by applications that wish to quit the current message loop started by application runner when the ref drops to zero.
- Changing the signature of Initialize() to take a Connector. This is what most of the change in this CL is.
BUG=
Review URL: https://codereview.chromium.org/1725353003
Cr-Commit-Position: refs/heads/master@{#377841}
Diffstat (limited to 'mash')
23 files changed, 97 insertions, 99 deletions
diff --git a/mash/browser_driver/browser_driver_application_delegate.cc b/mash/browser_driver/browser_driver_application_delegate.cc index 674be25..e5ea59a 100644 --- a/mash/browser_driver/browser_driver_application_delegate.cc +++ b/mash/browser_driver/browser_driver_application_delegate.cc @@ -9,7 +9,7 @@ #include "base/bind.h" #include "components/mus/public/cpp/event_matcher.h" #include "mojo/shell/public/cpp/connection.h" -#include "mojo/shell/public/cpp/shell.h" +#include "mojo/shell/public/cpp/connector.h" namespace mash { namespace browser_driver { @@ -45,16 +45,16 @@ void AssertTrue(bool success) { } // namespace BrowserDriverApplicationDelegate::BrowserDriverApplicationDelegate() - : shell_(nullptr), + : connector_(nullptr), binding_(this) {} BrowserDriverApplicationDelegate::~BrowserDriverApplicationDelegate() {} -void BrowserDriverApplicationDelegate::Initialize(mojo::Shell* shell, +void BrowserDriverApplicationDelegate::Initialize(mojo::Connector* connector, const std::string& url, uint32_t id, uint32_t user_id) { - shell_ = shell; + connector_ = connector; AddAccelerators(); } @@ -69,7 +69,7 @@ void BrowserDriverApplicationDelegate::OnAccelerator( case Accelerator::NewWindow: case Accelerator::NewTab: case Accelerator::NewIncognitoWindow: - shell_->Connect("exe:chrome"); + connector_->Connect("exe:chrome"); // TODO(beng): have Chrome export a service that allows it to be driven by // this driver, e.g. to open new tabs, incognito windows, etc. break; @@ -83,7 +83,7 @@ void BrowserDriverApplicationDelegate::AddAccelerators() { // TODO(beng): find some other way to get the window manager. I don't like // having to specify it by URL because it may differ per display. mus::mojom::AcceleratorRegistrarPtr registrar; - shell_->ConnectToInterface("mojo:desktop_wm", ®istrar); + connector_->ConnectToInterface("mojo:desktop_wm", ®istrar); if (binding_.is_bound()) binding_.Unbind(); diff --git a/mash/browser_driver/browser_driver_application_delegate.h b/mash/browser_driver/browser_driver_application_delegate.h index ff2aa9a..cbe63cf 100644 --- a/mash/browser_driver/browser_driver_application_delegate.h +++ b/mash/browser_driver/browser_driver_application_delegate.h @@ -27,7 +27,7 @@ class BrowserDriverApplicationDelegate : 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; @@ -36,7 +36,7 @@ class BrowserDriverApplicationDelegate : public mojo::ShellClient, void AddAccelerators(); - mojo::Shell* shell_; + mojo::Connector* connector_; mojo::Binding<mus::mojom::AcceleratorHandler> binding_; DISALLOW_COPY_AND_ASSIGN(BrowserDriverApplicationDelegate); diff --git a/mash/example/views_examples/views_examples_application_delegate.cc b/mash/example/views_examples/views_examples_application_delegate.cc index 9be2175..1c4c200 100644 --- a/mash/example/views_examples/views_examples_application_delegate.cc +++ b/mash/example/views_examples/views_examples_application_delegate.cc @@ -5,7 +5,7 @@ #include "mash/example/views_examples/views_examples_application_delegate.h" #include "mojo/shell/public/cpp/connection.h" -#include "mojo/shell/public/cpp/shell.h" +#include "mojo/shell/public/cpp/connector.h" #include "ui/views/examples/example_base.h" #include "ui/views/examples/examples_window.h" #include "ui/views/mus/aura_init.h" @@ -16,14 +16,14 @@ ViewsExamplesApplicationDelegate::ViewsExamplesApplicationDelegate() {} ViewsExamplesApplicationDelegate::~ViewsExamplesApplicationDelegate() { } -void ViewsExamplesApplicationDelegate::Initialize(mojo::Shell* shell, +void ViewsExamplesApplicationDelegate::Initialize(mojo::Connector* connector, const std::string& url, uint32_t id, uint32_t user_id) { - tracing_.Initialize(shell, url); - aura_init_.reset(new views::AuraInit(shell, "views_mus_resources.pak")); + tracing_.Initialize(connector, url); + aura_init_.reset(new views::AuraInit(connector, "views_mus_resources.pak")); - views::WindowManagerConnection::Create(shell); + views::WindowManagerConnection::Create(connector); views::examples::ShowExamplesWindow(views::examples::DO_NOTHING_ON_CLOSE, nullptr, nullptr); diff --git a/mash/example/views_examples/views_examples_application_delegate.h b/mash/example/views_examples/views_examples_application_delegate.h index 90f28ce..e7d9eec 100644 --- a/mash/example/views_examples/views_examples_application_delegate.h +++ b/mash/example/views_examples/views_examples_application_delegate.h @@ -21,7 +21,7 @@ class ViewsExamplesApplicationDelegate : 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/mash/example/window_type_launcher/window_type_launcher.cc b/mash/example/window_type_launcher/window_type_launcher.cc index a5dacd0..d4fdc69 100644 --- a/mash/example/window_type_launcher/window_type_launcher.cc +++ b/mash/example/window_type_launcher/window_type_launcher.cc @@ -9,7 +9,7 @@ #include "mash/shell/public/interfaces/shell.mojom.h" #include "mojo/converters/geometry/geometry_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 "ui/aura/window.h" #include "ui/aura/window_event_dispatcher.h" #include "ui/compositor/layer.h" @@ -164,8 +164,8 @@ class WindowTypeLauncherView : public views::WidgetDelegateView, public views::MenuDelegate, public views::ContextMenuController { public: - explicit WindowTypeLauncherView(mojo::Shell* shell) - : shell_(shell), + explicit WindowTypeLauncherView(mojo::Connector* connector) + : connector_(connector), create_button_(new views::LabelButton( this, base::ASCIIToUTF16("Create Window"))), panel_button_(new views::LabelButton( @@ -274,7 +274,7 @@ class WindowTypeLauncherView : public views::WidgetDelegateView, } else if (sender == lock_button_) { mash::shell::mojom::ShellPtr shell; - shell_->ConnectToInterface("mojo:mash_shell", &shell); + connector_->ConnectToInterface("mojo:mash_shell", &shell); shell->LockScreen(); } else if (sender == widgets_button_) { @@ -331,7 +331,7 @@ class WindowTypeLauncherView : public views::WidgetDelegateView, } } - mojo::Shell* shell_; + mojo::Connector* connector_; views::LabelButton* create_button_; views::LabelButton* panel_button_; views::LabelButton* create_nonresizable_button_; @@ -355,15 +355,16 @@ class WindowTypeLauncherView : public views::WidgetDelegateView, WindowTypeLauncher::WindowTypeLauncher() {} WindowTypeLauncher::~WindowTypeLauncher() {} -void WindowTypeLauncher::Initialize(mojo::Shell* shell, const std::string& url, +void WindowTypeLauncher::Initialize(mojo::Connector* connector, + const std::string& url, uint32_t id, uint32_t user_id) { - aura_init_.reset(new views::AuraInit(shell, "views_mus_resources.pak")); + aura_init_.reset(new views::AuraInit(connector, "views_mus_resources.pak")); - views::WindowManagerConnection::Create(shell); + views::WindowManagerConnection::Create(connector); views::Widget* widget = new views::Widget; views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW); - params.delegate = new WindowTypeLauncherView(shell); + params.delegate = new WindowTypeLauncherView(connector); widget->Init(params); widget->Show(); } diff --git a/mash/example/window_type_launcher/window_type_launcher.h b/mash/example/window_type_launcher/window_type_launcher.h index 610c528..b162db7 100644 --- a/mash/example/window_type_launcher/window_type_launcher.h +++ b/mash/example/window_type_launcher/window_type_launcher.h @@ -20,7 +20,7 @@ class WindowTypeLauncher : 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; scoped_ptr<views::AuraInit> aura_init_; diff --git a/mash/quick_launch/quick_launch_application.cc b/mash/quick_launch/quick_launch_application.cc index 8753f50..d378d9e 100644 --- a/mash/quick_launch/quick_launch_application.cc +++ b/mash/quick_launch/quick_launch_application.cc @@ -10,7 +10,7 @@ #include "mojo/public/c/system/main.h" #include "mojo/services/tracing/public/cpp/tracing_impl.h" #include "mojo/shell/public/cpp/application_runner.h" -#include "mojo/shell/public/cpp/shell.h" +#include "mojo/shell/public/cpp/connector.h" #include "mojo/shell/public/cpp/shell_client.h" #include "ui/views/background.h" #include "ui/views/controls/textfield/textfield.h" @@ -30,8 +30,8 @@ namespace quick_launch { class QuickLaunchUI : public views::WidgetDelegateView, public views::TextfieldController { public: - QuickLaunchUI(mojo::Shell* shell) - : shell_(shell), prompt_(new views::Textfield) { + QuickLaunchUI(mojo::Connector* connector) + : connector_(connector), prompt_(new views::Textfield) { set_background(views::Background::CreateStandardPanelBackground()); prompt_->set_controller(this); AddChildView(prompt_); @@ -63,7 +63,7 @@ class QuickLaunchUI : public views::WidgetDelegateView, const ui::KeyEvent& key_event) override { if (key_event.key_code() == ui::VKEY_RETURN) { std::string url = Canonicalize(prompt_->text()); - connections_.push_back(shell_->Connect(url)); + connections_.push_back(connector_->Connect(url)); prompt_->SetText(base::string16()); } return false; @@ -78,7 +78,7 @@ class QuickLaunchUI : public views::WidgetDelegateView, return base::UTF16ToUTF8(working); } - mojo::Shell* shell_; + mojo::Connector* connector_; views::Textfield* prompt_; std::vector<scoped_ptr<mojo::Connection>> connections_; @@ -88,17 +88,17 @@ class QuickLaunchUI : public views::WidgetDelegateView, QuickLaunchApplication::QuickLaunchApplication() {} QuickLaunchApplication::~QuickLaunchApplication() {} -void QuickLaunchApplication::Initialize(mojo::Shell* shell, +void QuickLaunchApplication::Initialize(mojo::Connector* connector, const std::string& url, uint32_t id, uint32_t user_id) { - tracing_.Initialize(shell, url); + tracing_.Initialize(connector, url); - aura_init_.reset(new views::AuraInit(shell, "views_mus_resources.pak")); - views::WindowManagerConnection::Create(shell); + aura_init_.reset(new views::AuraInit(connector, "views_mus_resources.pak")); + views::WindowManagerConnection::Create(connector); views::Widget* window = views::Widget::CreateWindowWithBounds( - new QuickLaunchUI(shell), gfx::Rect(10, 640, 0, 0)); + new QuickLaunchUI(connector), gfx::Rect(10, 640, 0, 0)); window->Show(); } diff --git a/mash/quick_launch/quick_launch_application.h b/mash/quick_launch/quick_launch_application.h index 07a6eba..c95f2a2 100644 --- a/mash/quick_launch/quick_launch_application.h +++ b/mash/quick_launch/quick_launch_application.h @@ -24,7 +24,7 @@ class QuickLaunchApplication : public mojo::ShellClient { private: // mojo::ShellClient: - 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/mash/screenlock/screenlock.cc b/mash/screenlock/screenlock.cc index e525664..e3bd229 100644 --- a/mash/screenlock/screenlock.cc +++ b/mash/screenlock/screenlock.cc @@ -10,7 +10,7 @@ #include "mash/shell/public/interfaces/shell.mojom.h" #include "mash/wm/public/interfaces/container.mojom.h" #include "mojo/public/cpp/bindings/binding.h" -#include "mojo/shell/public/cpp/shell.h" +#include "mojo/shell/public/cpp/connector.h" #include "ui/views/background.h" #include "ui/views/controls/button/label_button.h" #include "ui/views/mus/aura_init.h" @@ -25,8 +25,8 @@ namespace { class ScreenlockView : public views::WidgetDelegateView, public views::ButtonListener { public: - explicit ScreenlockView(mojo::Shell* shell) - : shell_(shell), + explicit ScreenlockView(mojo::Connector* connector) + : connector_(connector), unlock_button_( new views::LabelButton(this, base::ASCIIToUTF16("Unlock"))) { set_background(views::Background::CreateSolidBackground(SK_ColorYELLOW)); @@ -60,11 +60,11 @@ class ScreenlockView : public views::WidgetDelegateView, void ButtonPressed(views::Button* sender, const ui::Event& event) override { DCHECK_EQ(sender, unlock_button_); mash::shell::mojom::ShellPtr shell; - shell_->ConnectToInterface("mojo:mash_shell", &shell); + connector_->ConnectToInterface("mojo:mash_shell", &shell); shell->UnlockScreen(); } - mojo::Shell* shell_; + mojo::Connector* connector_; views::LabelButton* unlock_button_; DISALLOW_COPY_AND_ASSIGN(ScreenlockView); @@ -72,26 +72,25 @@ class ScreenlockView : public views::WidgetDelegateView, } // namespace -Screenlock::Screenlock() : shell_(nullptr) {} +Screenlock::Screenlock() {} Screenlock::~Screenlock() {} -void Screenlock::Initialize(mojo::Shell* shell, const std::string& url, +void Screenlock::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); mash::shell::mojom::ShellPtr mash_shell; - shell_->ConnectToInterface("mojo:mash_shell", &mash_shell); + connector->ConnectToInterface("mojo:mash_shell", &mash_shell); mash_shell->AddScreenlockStateListener( bindings_.CreateInterfacePtrAndBind(this)); - aura_init_.reset(new views::AuraInit(shell, "views_mus_resources.pak")); - views::WindowManagerConnection::Create(shell); + aura_init_.reset(new views::AuraInit(connector, "views_mus_resources.pak")); + views::WindowManagerConnection::Create(connector); views::Widget* widget = new views::Widget; views::Widget::InitParams params( views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); - params.delegate = new ScreenlockView(shell); + params.delegate = new ScreenlockView(connector); std::map<std::string, std::vector<uint8_t>> properties; properties[mash::wm::mojom::kWindowContainer_Property] = @@ -100,14 +99,14 @@ void Screenlock::Initialize(mojo::Shell* shell, const std::string& url, mus::Window* window = views::WindowManagerConnection::Get()->NewWindow(properties); params.native_widget = new views::NativeWidgetMus( - widget, shell, window, mus::mojom::SurfaceType::DEFAULT); + widget, connector, window, mus::mojom::SurfaceType::DEFAULT); widget->Init(params); widget->Show(); } void Screenlock::ScreenlockStateChanged(bool screen_locked) { if (!screen_locked) - shell_->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); } } // namespace screenlock diff --git a/mash/screenlock/screenlock.h b/mash/screenlock/screenlock.h index e05a46c..e87995f 100644 --- a/mash/screenlock/screenlock.h +++ b/mash/screenlock/screenlock.h @@ -29,13 +29,12 @@ class Screenlock : 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; // mash::shell::mojom::ScreenlockStateListener: void ScreenlockStateChanged(bool locked) override; - mojo::Shell* shell_; mojo::TracingImpl tracing_; scoped_ptr<views::AuraInit> aura_init_; mojo::BindingSet<mash::shell::mojom::ScreenlockStateListener> bindings_; diff --git a/mash/shell/shell_application_delegate.cc b/mash/shell/shell_application_delegate.cc index 9972514..c37dac9 100644 --- a/mash/shell/shell_application_delegate.cc +++ b/mash/shell/shell_application_delegate.cc @@ -7,21 +7,21 @@ #include "base/bind.h" #include "base/command_line.h" #include "mojo/shell/public/cpp/connection.h" -#include "mojo/shell/public/cpp/shell.h" +#include "mojo/shell/public/cpp/connector.h" namespace mash { namespace shell { ShellApplicationDelegate::ShellApplicationDelegate() - : shell_(nullptr), screen_locked_(false) {} + : connector_(nullptr), screen_locked_(false) {} ShellApplicationDelegate::~ShellApplicationDelegate() {} -void ShellApplicationDelegate::Initialize(mojo::Shell* shell, +void ShellApplicationDelegate::Initialize(mojo::Connector* connector, const std::string& url, uint32_t id, uint32_t user_id) { - shell_ = shell; + connector_ = connector; StartBrowserDriver(); StartWindowManager(); StartSystemUI(); @@ -111,7 +111,7 @@ void ShellApplicationDelegate::StartRestartableService( const base::Closure& restart_callback) { // TODO(beng): This would be the place to insert logic that counted restarts // to avoid infinite crash-restart loops. - scoped_ptr<mojo::Connection> connection = shell_->Connect(url); + scoped_ptr<mojo::Connection> connection = connector_->Connect(url); // Note: |connection| may be null if we've lost our connection to the shell. if (connection) { connection->SetRemoteInterfaceProviderConnectionErrorHandler( diff --git a/mash/shell/shell_application_delegate.h b/mash/shell/shell_application_delegate.h index 524a554..a429f34a 100644 --- a/mash/shell/shell_application_delegate.h +++ b/mash/shell/shell_application_delegate.h @@ -33,7 +33,7 @@ class ShellApplicationDelegate 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; @@ -60,7 +60,7 @@ class ShellApplicationDelegate void StartRestartableService(const std::string& url, const base::Closure& restart_callback); - mojo::Shell* shell_; + mojo::Connector* connector_; std::map<std::string, scoped_ptr<mojo::Connection>> connections_; bool screen_locked_; mojo::BindingSet<mash::shell::mojom::Shell> bindings_; diff --git a/mash/task_viewer/task_viewer.cc b/mash/task_viewer/task_viewer.cc index 552104f..1c2340e 100644 --- a/mash/task_viewer/task_viewer.cc +++ b/mash/task_viewer/task_viewer.cc @@ -16,7 +16,7 @@ #include "mojo/public/cpp/bindings/binding.h" #include "mojo/services/package_manager/public/interfaces/catalog.mojom.h" #include "mojo/shell/public/cpp/connection.h" -#include "mojo/shell/public/cpp/shell.h" +#include "mojo/shell/public/cpp/connector.h" #include "mojo/shell/public/interfaces/application_manager.mojom.h" #include "ui/base/models/table_model.h" #include "ui/views/background.h" @@ -42,11 +42,9 @@ class TaskViewerContents public mojo::shell::mojom::ApplicationManagerListener { public: TaskViewerContents(ListenerRequest request, - package_manager::mojom::CatalogPtr catalog, - scoped_ptr<mojo::AppRefCount> app) + package_manager::mojom::CatalogPtr catalog) : binding_(this, std::move(request)), catalog_(std::move(catalog)), - app_(std::move(app)), table_view_(nullptr), table_view_parent_(nullptr), kill_button_( @@ -69,6 +67,7 @@ class TaskViewerContents } ~TaskViewerContents() override { table_view_->SetModel(nullptr); + base::MessageLoop::current()->QuitWhenIdle(); } private: @@ -246,7 +245,6 @@ class TaskViewerContents mojo::Binding<mojo::shell::mojom::ApplicationManagerListener> binding_; package_manager::mojom::CatalogPtr catalog_; - scoped_ptr<mojo::AppRefCount> app_; views::TableView* table_view_; views::View* table_view_parent_; @@ -265,25 +263,26 @@ class TaskViewerContents TaskViewer::TaskViewer() {} TaskViewer::~TaskViewer() {} -void TaskViewer::Initialize(mojo::Shell* shell, const std::string& url, +void TaskViewer::Initialize(mojo::Connector* connector, + const std::string& url, uint32_t id, uint32_t user_id) { - tracing_.Initialize(shell, url); + tracing_.Initialize(connector, url); - aura_init_.reset(new views::AuraInit(shell, "views_mus_resources.pak")); - views::WindowManagerConnection::Create(shell); + aura_init_.reset(new views::AuraInit(connector, "views_mus_resources.pak")); + views::WindowManagerConnection::Create(connector); mojo::shell::mojom::ApplicationManagerPtr application_manager; - shell->ConnectToInterface("mojo:shell", &application_manager); + connector->ConnectToInterface("mojo:shell", &application_manager); mojo::shell::mojom::ApplicationManagerListenerPtr listener; ListenerRequest request = GetProxy(&listener); application_manager->AddListener(std::move(listener)); package_manager::mojom::CatalogPtr catalog; - shell->ConnectToInterface("mojo:package_manager", &catalog); + connector->ConnectToInterface("mojo:package_manager", &catalog); TaskViewerContents* task_viewer = new TaskViewerContents( - std::move(request), std::move(catalog), shell->CreateAppRefCount()); + std::move(request), std::move(catalog)); views::Widget* window = views::Widget::CreateWindowWithBounds( task_viewer, gfx::Rect(10, 10, 500, 500)); window->Show(); diff --git a/mash/task_viewer/task_viewer.h b/mash/task_viewer/task_viewer.h index 0af60ef..5de6028 100644 --- a/mash/task_viewer/task_viewer.h +++ b/mash/task_viewer/task_viewer.h @@ -27,7 +27,7 @@ class TaskViewer : 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; mojo::TracingImpl tracing_; diff --git a/mash/wm/accelerator_registrar_apptest.cc b/mash/wm/accelerator_registrar_apptest.cc index f7c31ae..a16d210 100644 --- a/mash/wm/accelerator_registrar_apptest.cc +++ b/mash/wm/accelerator_registrar_apptest.cc @@ -72,7 +72,7 @@ class AcceleratorRegistrarTest : public mojo::test::ApplicationTestBase { protected: void ConnectToRegistrar(AcceleratorRegistrarPtr* registrar) { - shell()->ConnectToInterface("mojo:desktop_wm", registrar); + connector()->ConnectToInterface("mojo:desktop_wm", registrar); } private: diff --git a/mash/wm/non_client_frame_controller.cc b/mash/wm/non_client_frame_controller.cc index b35741f..ed6ad3a 100644 --- a/mash/wm/non_client_frame_controller.cc +++ b/mash/wm/non_client_frame_controller.cc @@ -90,9 +90,9 @@ class ContentWindowLayoutManager : public aura::LayoutManager { class WmNativeWidgetMus : public views::NativeWidgetMus { public: WmNativeWidgetMus(views::internal::NativeWidgetDelegate* delegate, - mojo::Shell* shell, + mojo::Connector* connector, mus::Window* window) - : NativeWidgetMus(delegate, shell, window, + : NativeWidgetMus(delegate, connector, window, mus::mojom::SurfaceType::UNDERLAY) {} ~WmNativeWidgetMus() override { } @@ -166,7 +166,7 @@ class ClientViewMus : public views::ClientView { } // namespace NonClientFrameController::NonClientFrameController( - mojo::Shell* shell, + mojo::Connector* connector, mus::Window* window, mus::WindowManagerClient* window_manager_client) : widget_(new views::Widget), window_(window) { @@ -176,7 +176,7 @@ NonClientFrameController::NonClientFrameController( // We initiate focus at the mus level, not at the views level. params.activatable = views::Widget::InitParams::ACTIVATABLE_NO; params.delegate = this; - params.native_widget = new WmNativeWidgetMus(widget_, shell, window); + params.native_widget = new WmNativeWidgetMus(widget_, connector, window); widget_->Init(params); widget_->ShowInactive(); diff --git a/mash/wm/non_client_frame_controller.h b/mash/wm/non_client_frame_controller.h index b5346f2..c43cf73 100644 --- a/mash/wm/non_client_frame_controller.h +++ b/mash/wm/non_client_frame_controller.h @@ -17,7 +17,7 @@ class Insets; } namespace mojo { -class Shell; +class Connector; } namespace mus { @@ -33,7 +33,7 @@ class NonClientFrameController : public views::WidgetDelegateView, public mus::WindowObserver { public: // NonClientFrameController deletes itself when |window| is destroyed. - NonClientFrameController(mojo::Shell* shell, + NonClientFrameController(mojo::Connector* connector, mus::Window* window, mus::WindowManagerClient* window_manager_client); diff --git a/mash/wm/root_window_controller.cc b/mash/wm/root_window_controller.cc index d46cd78..03de79e 100644 --- a/mash/wm/root_window_controller.cc +++ b/mash/wm/root_window_controller.cc @@ -21,7 +21,7 @@ #include "mash/wm/window_layout.h" #include "mash/wm/window_manager.h" #include "mash/wm/window_manager_application.h" -#include "mojo/shell/public/cpp/shell.h" +#include "mojo/shell/public/cpp/connector.h" namespace mash { namespace wm { @@ -39,7 +39,7 @@ void AssertTrue(bool success) { RootWindowController* RootWindowController::CreateUsingWindowTreeHost( WindowManagerApplication* app) { RootWindowController* controller = new RootWindowController(app); - mus::CreateWindowTreeHost(app->shell(), controller, + mus::CreateWindowTreeHost(app->connector(), controller, &controller->window_tree_host_, controller->window_manager_.get()); return controller; @@ -69,8 +69,8 @@ void RootWindowController::Destroy() { } } -mojo::Shell* RootWindowController::GetShell() { - return app_->shell(); +mojo::Connector* RootWindowController::GetConnector() { + return app_->connector(); } mus::Window* RootWindowController::GetWindowForContainer( @@ -145,7 +145,7 @@ void RootWindowController::OnEmbed(mus::Window* root) { AddAccelerators(); mash::shell::mojom::ShellPtr shell; - app_->shell()->ConnectToInterface("mojo:mash_shell", &shell); + app_->connector()->ConnectToInterface("mojo:mash_shell", &shell); window_manager_->Initialize(this, std::move(shell)); shadow_controller_.reset(new ShadowController(root->connection())); diff --git a/mash/wm/root_window_controller.h b/mash/wm/root_window_controller.h index 623b2e1..d254da5 100644 --- a/mash/wm/root_window_controller.h +++ b/mash/wm/root_window_controller.h @@ -13,7 +13,7 @@ #include "mojo/public/cpp/bindings/binding.h" namespace mojo { -class Shell; +class Connector; } namespace mus { @@ -45,7 +45,7 @@ class RootWindowController : public mus::WindowObserver, // Deletes this. void Destroy(); - mojo::Shell* GetShell(); + mojo::Connector* GetConnector(); mus::Window* root() { return root_; } diff --git a/mash/wm/window_manager.cc b/mash/wm/window_manager.cc index d5b28a8..f57af0a 100644 --- a/mash/wm/window_manager.cc +++ b/mash/wm/window_manager.cc @@ -113,7 +113,7 @@ mus::Window* WindowManager::NewTopLevelWindow( if (provide_non_client_frame) { // NonClientFrameController deletes itself when |window| is destroyed. - new NonClientFrameController(root_controller_->GetShell(), window, + new NonClientFrameController(root_controller_->GetConnector(), window, root_controller_->window_manager_client()); } diff --git a/mash/wm/window_manager_application.cc b/mash/wm/window_manager_application.cc index f02f613..5f5089a 100644 --- a/mash/wm/window_manager_application.cc +++ b/mash/wm/window_manager_application.cc @@ -16,7 +16,7 @@ #include "mash/wm/user_window_controller_impl.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/mojo/init/ui_init.h" #include "ui/views/mus/aura_init.h" #include "ui/views/mus/display_converter.h" @@ -25,7 +25,7 @@ namespace mash { namespace wm { WindowManagerApplication::WindowManagerApplication() - : shell_(nullptr), window_manager_factory_binding_(this) {} + : connector_(nullptr), window_manager_factory_binding_(this) {} WindowManagerApplication::~WindowManagerApplication() { // AcceleratorRegistrarImpl removes an observer in its destructor. Destroy @@ -56,7 +56,7 @@ void WindowManagerApplication::OnRootWindowControllerGotRoot( ui_init_.reset(new ui::mojo::UIInit( views::GetDisplaysFromWindow(root_controller->root()))); - aura_init_.reset(new views::AuraInit(shell_, "mash_wm_resources.pak")); + aura_init_.reset(new views::AuraInit(connector_, "mash_wm_resources.pak")); } void WindowManagerApplication::OnRootWindowControllerDoneInit( @@ -103,15 +103,15 @@ void WindowManagerApplication::OnAcceleratorRegistrarDestroyed( accelerator_registrars_.erase(registrar); } -void WindowManagerApplication::Initialize(mojo::Shell* shell, +void WindowManagerApplication::Initialize(mojo::Connector* connector, const std::string& url, uint32_t id, uint32_t user_id) { - shell_ = shell; - tracing_.Initialize(shell, url); + connector_ = connector; + tracing_.Initialize(connector, url); mus::mojom::WindowManagerFactoryServicePtr wm_factory_service; - shell_->ConnectToInterface("mojo:mus", &wm_factory_service); + connector_->ConnectToInterface("mojo:mus", &wm_factory_service); wm_factory_service->SetWindowManagerFactory( window_manager_factory_binding_.CreateInterfacePtrAndBind()); diff --git a/mash/wm/window_manager_application.h b/mash/wm/window_manager_application.h index 7f2806f..a716990 100644 --- a/mash/wm/window_manager_application.h +++ b/mash/wm/window_manager_application.h @@ -50,7 +50,7 @@ class WindowManagerApplication WindowManagerApplication(); ~WindowManagerApplication() override; - mojo::Shell* shell() { return shell_; } + mojo::Connector* connector() { return connector_; } // Returns the RootWindowControllers that have valid roots. // @@ -78,7 +78,7 @@ class WindowManagerApplication void OnAcceleratorRegistrarDestroyed(AcceleratorRegistrarImpl* registrar); // 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; @@ -97,7 +97,7 @@ class WindowManagerApplication mojo::InterfaceRequest<mus::mojom::WindowTreeClient> client_request) override; - mojo::Shell* shell_; + mojo::Connector* connector_; mojo::TracingImpl tracing_; diff --git a/mash/wm/window_manager_apptest.cc b/mash/wm/window_manager_apptest.cc index 6e6e9fb..7ea0a25 100644 --- a/mash/wm/window_manager_apptest.cc +++ b/mash/wm/window_manager_apptest.cc @@ -39,12 +39,12 @@ TEST_F(WindowManagerAppTest, OpenWindow) { WindowTreeDelegateImpl window_tree_delegate; // Bring up the the desktop_wm. - shell()->Connect("mojo:desktop_wm"); + connector()->Connect("mojo:desktop_wm"); // Connect to mus and create a new top level window. The request goes to // the |desktop_wm|, but is async. scoped_ptr<mus::WindowTreeConnection> connection( - mus::WindowTreeConnection::Create(&window_tree_delegate, shell())); + mus::WindowTreeConnection::Create(&window_tree_delegate, connector())); mus::Window* top_level_window = connection->NewTopLevelWindow(nullptr); ASSERT_TRUE(top_level_window); mus::Window* child_window = connection->NewWindow(); |