| OLD | NEW |
| 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 "mash/screenlock/public/interfaces/screenlock.mojom.h" | 8 #include "mash/screenlock/public/interfaces/screenlock.mojom.h" |
| 9 #include "mojo/shell/public/cpp/application_connection.h" | 9 #include "mojo/shell/public/cpp/application_connection.h" |
| 10 #include "mojo/shell/public/cpp/application_impl.h" | 10 #include "mojo/shell/public/cpp/application_impl.h" |
| 11 | 11 |
| 12 namespace mash { | 12 namespace mash { |
| 13 namespace shell { | 13 namespace shell { |
| 14 | 14 |
| 15 ShellApplicationDelegate::ShellApplicationDelegate() : app_(nullptr) {} | 15 ShellApplicationDelegate::ShellApplicationDelegate() : app_(nullptr) {} |
| 16 | 16 |
| 17 ShellApplicationDelegate::~ShellApplicationDelegate() {} | 17 ShellApplicationDelegate::~ShellApplicationDelegate() {} |
| 18 | 18 |
| 19 void ShellApplicationDelegate::Initialize(mojo::ApplicationImpl* app) { | 19 void ShellApplicationDelegate::Initialize(mojo::ApplicationImpl* app) { |
| 20 app_ = app; | 20 app_ = app; |
| 21 #if 0 |
| 21 StartBrowserDriver(); | 22 StartBrowserDriver(); |
| 22 StartWindowManager(); | 23 StartWindowManager(); |
| 23 StartWallpaper(); | 24 StartWallpaper(); |
| 24 StartShelf(); | 25 StartShelf(); |
| 25 StartQuickLaunch(); | 26 StartQuickLaunch(); |
| 27 #else |
| 28 StartBrowserDriver(); |
| 29 StartWindowManager(); |
| 30 #endif |
| 26 } | 31 } |
| 27 | 32 |
| 28 bool ShellApplicationDelegate::ConfigureIncomingConnection( | 33 bool ShellApplicationDelegate::ConfigureIncomingConnection( |
| 29 mojo::ApplicationConnection* connection) { | 34 mojo::ApplicationConnection* connection) { |
| 30 connection->AddService<mash::shell::mojom::Shell>(this); | 35 connection->AddService<mash::shell::mojom::Shell>(this); |
| 31 return true; | 36 return true; |
| 32 } | 37 } |
| 33 | 38 |
| 34 void ShellApplicationDelegate::LockScreen() { | 39 void ShellApplicationDelegate::LockScreen() { |
| 35 StartScreenlock(); | 40 StartScreenlock(); |
| 36 } | 41 } |
| 37 void ShellApplicationDelegate::UnlockScreen() { | 42 void ShellApplicationDelegate::UnlockScreen() { |
| 38 StopScreenlock(); | 43 StopScreenlock(); |
| 39 } | 44 } |
| 40 | 45 |
| 41 void ShellApplicationDelegate::Create( | 46 void ShellApplicationDelegate::Create( |
| 42 mojo::ApplicationConnection* connection, | 47 mojo::ApplicationConnection* connection, |
| 43 mojo::InterfaceRequest<mash::shell::mojom::Shell> r) { | 48 mojo::InterfaceRequest<mash::shell::mojom::Shell> r) { |
| 44 bindings_.AddBinding(this, std::move(r)); | 49 bindings_.AddBinding(this, std::move(r)); |
| 45 } | 50 } |
| 46 | 51 |
| 47 void ShellApplicationDelegate::StartWindowManager() { | 52 void ShellApplicationDelegate::StartWindowManager() { |
| 48 StartRestartableService( | 53 StartRestartableService( |
| 49 "mojo:desktop_wm", | 54 "mojo:ash_wm", base::Bind(&ShellApplicationDelegate::StartWindowManager, |
| 50 base::Bind(&ShellApplicationDelegate::StartWindowManager, | 55 base::Unretained(this))); |
| 51 base::Unretained(this))); | |
| 52 } | 56 } |
| 53 | 57 |
| 54 void ShellApplicationDelegate::StartWallpaper() { | 58 void ShellApplicationDelegate::StartWallpaper() { |
| 55 StartRestartableService("mojo:wallpaper", | 59 StartRestartableService("mojo:wallpaper", |
| 56 base::Bind(&ShellApplicationDelegate::StartWallpaper, | 60 base::Bind(&ShellApplicationDelegate::StartWallpaper, |
| 57 base::Unretained(this))); | 61 base::Unretained(this))); |
| 58 } | 62 } |
| 59 | 63 |
| 60 void ShellApplicationDelegate::StartShelf() { | 64 void ShellApplicationDelegate::StartShelf() { |
| 61 StartRestartableService("mojo:shelf", | 65 StartRestartableService("mojo:shelf", |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 // TODO(beng): This would be the place to insert logic that counted restarts | 103 // TODO(beng): This would be the place to insert logic that counted restarts |
| 100 // to avoid infinite crash-restart loops. | 104 // to avoid infinite crash-restart loops. |
| 101 scoped_ptr<mojo::ApplicationConnection> connection = | 105 scoped_ptr<mojo::ApplicationConnection> connection = |
| 102 app_->ConnectToApplication(url); | 106 app_->ConnectToApplication(url); |
| 103 connection->SetRemoteServiceProviderConnectionErrorHandler(restart_callback); | 107 connection->SetRemoteServiceProviderConnectionErrorHandler(restart_callback); |
| 104 connections_[url] = std::move(connection); | 108 connections_[url] = std::move(connection); |
| 105 } | 109 } |
| 106 | 110 |
| 107 } // namespace shell | 111 } // namespace shell |
| 108 } // namespace main | 112 } // namespace main |
| OLD | NEW |