Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(270)

Side by Side Diff: mash/shell/shell_application_delegate.cc

Issue 1674903003: Extract shell methods from ApplicationImpl into a base class, and pass this to Initialize() instead. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mojom
Patch Set: . Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "mash/shell/shell_application_delegate.h" 5 #include "mash/shell/shell_application_delegate.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "mojo/shell/public/cpp/application_connection.h" 8 #include "mojo/shell/public/cpp/application_connection.h"
9 #include "mojo/shell/public/cpp/application_impl.h" 9 #include "mojo/shell/public/cpp/shell.h"
10 10
11 namespace mash { 11 namespace mash {
12 namespace shell { 12 namespace shell {
13 13
14 ShellApplicationDelegate::ShellApplicationDelegate() 14 ShellApplicationDelegate::ShellApplicationDelegate()
15 : app_(nullptr), screen_locked_(false) {} 15 : shell_(nullptr), screen_locked_(false) {}
16 16
17 ShellApplicationDelegate::~ShellApplicationDelegate() {} 17 ShellApplicationDelegate::~ShellApplicationDelegate() {}
18 18
19 void ShellApplicationDelegate::Initialize(mojo::ApplicationImpl* app) { 19 void ShellApplicationDelegate::Initialize(mojo::Shell* shell,
20 app_ = app; 20 const std::string& url,
21 uint32_t id) {
22 shell_ = shell;
21 StartBrowserDriver(); 23 StartBrowserDriver();
22 StartWindowManager(); 24 StartWindowManager();
23 StartWallpaper(); 25 StartWallpaper();
24 StartShelf(); 26 StartShelf();
25 StartQuickLaunch(); 27 StartQuickLaunch();
26 } 28 }
27 29
28 bool ShellApplicationDelegate::AcceptConnection( 30 bool ShellApplicationDelegate::AcceptConnection(
29 mojo::ApplicationConnection* connection) { 31 mojo::ApplicationConnection* connection) {
30 connection->AddService<mash::shell::mojom::Shell>(this); 32 connection->AddService<mash::shell::mojom::Shell>(this);
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 DCHECK(connections_.end() != connection); 111 DCHECK(connections_.end() != connection);
110 connections_.erase(connection); 112 connections_.erase(connection);
111 } 113 }
112 114
113 void ShellApplicationDelegate::StartRestartableService( 115 void ShellApplicationDelegate::StartRestartableService(
114 const std::string& url, 116 const std::string& url,
115 const base::Closure& restart_callback) { 117 const base::Closure& restart_callback) {
116 // TODO(beng): This would be the place to insert logic that counted restarts 118 // TODO(beng): This would be the place to insert logic that counted restarts
117 // to avoid infinite crash-restart loops. 119 // to avoid infinite crash-restart loops.
118 scoped_ptr<mojo::ApplicationConnection> connection = 120 scoped_ptr<mojo::ApplicationConnection> connection =
119 app_->ConnectToApplication(url); 121 shell_->ConnectToApplication(url);
120 connection->SetRemoteServiceProviderConnectionErrorHandler(restart_callback); 122 connection->SetRemoteServiceProviderConnectionErrorHandler(restart_callback);
121 connections_[url] = std::move(connection); 123 connections_[url] = std::move(connection);
122 } 124 }
123 125
124 } // namespace shell 126 } // namespace shell
125 } // namespace main 127 } // namespace main
OLDNEW
« no previous file with comments | « mash/shell/shell_application_delegate.h ('k') | mash/task_viewer/task_viewer_application_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698