summaryrefslogtreecommitdiffstats
path: root/mash/example
diff options
context:
space:
mode:
authorben <ben@chromium.org>2016-02-06 20:35:30 -0800
committerCommit bot <commit-bot@chromium.org>2016-02-07 04:36:48 +0000
commit3a7cbe0bed9f9b81ab1da4ed0e4dba764345977e (patch)
treede412bbb84e68778685e868f2b62d873ffa2937d /mash/example
parentd345759c314c478c2b35f5ae6e6fd0698e532d2a (diff)
downloadchromium_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 'mash/example')
-rw-r--r--mash/example/views_examples/views_examples_application_delegate.cc12
-rw-r--r--mash/example/views_examples/views_examples_application_delegate.h3
-rw-r--r--mash/example/window_type_launcher/window_type_launcher.cc19
-rw-r--r--mash/example/window_type_launcher/window_type_launcher.h3
4 files changed, 21 insertions, 16 deletions
diff --git a/mash/example/views_examples/views_examples_application_delegate.cc b/mash/example/views_examples/views_examples_application_delegate.cc
index 4132e40..dc675ab 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/application_connection.h"
-#include "mojo/shell/public/cpp/application_impl.h"
+#include "mojo/shell/public/cpp/shell.h"
#include "ui/views/examples/example_base.h"
#include "ui/views/examples/examples_window.h"
#include "ui/views/mus/aura_init.h"
@@ -16,11 +16,13 @@ ViewsExamplesApplicationDelegate::ViewsExamplesApplicationDelegate() {}
ViewsExamplesApplicationDelegate::~ViewsExamplesApplicationDelegate() {
}
-void ViewsExamplesApplicationDelegate::Initialize(mojo::ApplicationImpl* app) {
- tracing_.Initialize(app);
- aura_init_.reset(new views::AuraInit(app, "views_mus_resources.pak"));
+void ViewsExamplesApplicationDelegate::Initialize(mojo::Shell* shell,
+ const std::string& url,
+ uint32_t id) {
+ tracing_.Initialize(shell, url);
+ aura_init_.reset(new views::AuraInit(shell, "views_mus_resources.pak"));
- views::WindowManagerConnection::Create(app);
+ views::WindowManagerConnection::Create(shell);
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 a464828..2909126 100644
--- a/mash/example/views_examples/views_examples_application_delegate.h
+++ b/mash/example/views_examples/views_examples_application_delegate.h
@@ -21,7 +21,8 @@ class ViewsExamplesApplicationDelegate : 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/mash/example/window_type_launcher/window_type_launcher.cc b/mash/example/window_type_launcher/window_type_launcher.cc
index dc88bd4..6f4d5b1 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/application_connection.h"
-#include "mojo/shell/public/cpp/application_impl.h"
+#include "mojo/shell/public/cpp/shell.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::ApplicationImpl* app)
- : app_(app),
+ explicit WindowTypeLauncherView(mojo::Shell* shell)
+ : shell_(shell),
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;
- app_->ConnectToService("mojo:mash_shell", &shell);
+ shell_->ConnectToService("mojo:mash_shell", &shell);
shell->LockScreen();
}
else if (sender == widgets_button_) {
@@ -331,7 +331,7 @@ class WindowTypeLauncherView : public views::WidgetDelegateView,
}
}
- mojo::ApplicationImpl* app_;
+ mojo::Shell* shell_;
views::LabelButton* create_button_;
views::LabelButton* panel_button_;
views::LabelButton* create_nonresizable_button_;
@@ -360,14 +360,15 @@ bool WindowTypeLauncher::AcceptConnection(
return false;
}
-void WindowTypeLauncher::Initialize(mojo::ApplicationImpl* app) {
- aura_init_.reset(new views::AuraInit(app, "views_mus_resources.pak"));
+void WindowTypeLauncher::Initialize(mojo::Shell* shell, const std::string& url,
+ uint32_t id) {
+ aura_init_.reset(new views::AuraInit(shell, "views_mus_resources.pak"));
- views::WindowManagerConnection::Create(app);
+ views::WindowManagerConnection::Create(shell);
views::Widget* widget = new views::Widget;
views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW);
- params.delegate = new WindowTypeLauncherView(app);
+ params.delegate = new WindowTypeLauncherView(shell);
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 d663262..34e283c 100644
--- a/mash/example/window_type_launcher/window_type_launcher.h
+++ b/mash/example/window_type_launcher/window_type_launcher.h
@@ -20,7 +20,8 @@ class WindowTypeLauncher : 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;