| 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 "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "mojo/shell/public/cpp/connection.h" | 9 #include "mojo/shell/public/cpp/connection.h" |
| 10 #include "mojo/shell/public/cpp/shell.h" | 10 #include "mojo/shell/public/cpp/connector.h" |
| 11 | 11 |
| 12 namespace mash { | 12 namespace mash { |
| 13 namespace shell { | 13 namespace shell { |
| 14 | 14 |
| 15 ShellApplicationDelegate::ShellApplicationDelegate() | 15 ShellApplicationDelegate::ShellApplicationDelegate() |
| 16 : shell_(nullptr), screen_locked_(false) {} | 16 : connector_(nullptr), screen_locked_(false) {} |
| 17 | 17 |
| 18 ShellApplicationDelegate::~ShellApplicationDelegate() {} | 18 ShellApplicationDelegate::~ShellApplicationDelegate() {} |
| 19 | 19 |
| 20 void ShellApplicationDelegate::Initialize(mojo::Shell* shell, | 20 void ShellApplicationDelegate::Initialize(mojo::Connector* connector, |
| 21 const std::string& url, | 21 const std::string& url, |
| 22 uint32_t id, | 22 uint32_t id, |
| 23 uint32_t user_id) { | 23 uint32_t user_id) { |
| 24 shell_ = shell; | 24 connector_ = connector; |
| 25 StartBrowserDriver(); | 25 StartBrowserDriver(); |
| 26 StartWindowManager(); | 26 StartWindowManager(); |
| 27 StartSystemUI(); | 27 StartSystemUI(); |
| 28 StartQuickLaunch(); | 28 StartQuickLaunch(); |
| 29 } | 29 } |
| 30 | 30 |
| 31 bool ShellApplicationDelegate::AcceptConnection(mojo::Connection* connection) { | 31 bool ShellApplicationDelegate::AcceptConnection(mojo::Connection* connection) { |
| 32 connection->AddInterface<mash::shell::mojom::Shell>(this); | 32 connection->AddInterface<mash::shell::mojom::Shell>(this); |
| 33 return true; | 33 return true; |
| 34 } | 34 } |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 auto connection = connections_.find("mojo:screenlock"); | 104 auto connection = connections_.find("mojo:screenlock"); |
| 105 DCHECK(connections_.end() != connection); | 105 DCHECK(connections_.end() != connection); |
| 106 connections_.erase(connection); | 106 connections_.erase(connection); |
| 107 } | 107 } |
| 108 | 108 |
| 109 void ShellApplicationDelegate::StartRestartableService( | 109 void ShellApplicationDelegate::StartRestartableService( |
| 110 const std::string& url, | 110 const std::string& url, |
| 111 const base::Closure& restart_callback) { | 111 const base::Closure& restart_callback) { |
| 112 // TODO(beng): This would be the place to insert logic that counted restarts | 112 // TODO(beng): This would be the place to insert logic that counted restarts |
| 113 // to avoid infinite crash-restart loops. | 113 // to avoid infinite crash-restart loops. |
| 114 scoped_ptr<mojo::Connection> connection = shell_->Connect(url); | 114 scoped_ptr<mojo::Connection> connection = connector_->Connect(url); |
| 115 // Note: |connection| may be null if we've lost our connection to the shell. | 115 // Note: |connection| may be null if we've lost our connection to the shell. |
| 116 if (connection) { | 116 if (connection) { |
| 117 connection->SetRemoteInterfaceProviderConnectionErrorHandler( | 117 connection->SetRemoteInterfaceProviderConnectionErrorHandler( |
| 118 restart_callback); | 118 restart_callback); |
| 119 connections_[url] = std::move(connection); | 119 connections_[url] = std::move(connection); |
| 120 } | 120 } |
| 121 } | 121 } |
| 122 | 122 |
| 123 } // namespace shell | 123 } // namespace shell |
| 124 } // namespace main | 124 } // namespace main |
| OLD | NEW |