Chromium Code Reviews| Index: ash/common/new_window_client_remote.cc |
| diff --git a/ash/common/new_window_client_remote.cc b/ash/common/new_window_client_remote.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..cd1606cb09772b8bc7a37a8ae53793c2c7099087 |
| --- /dev/null |
| +++ b/ash/common/new_window_client_remote.cc |
| @@ -0,0 +1,75 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "ash/common/new_window_client_remote.h" |
| + |
| +#include "base/logging.h" |
| +#include "services/service_manager/public/cpp/connector.h" |
| + |
| +namespace ash { |
| + |
| +NewWindowClientRemote::NewWindowClientRemote( |
| + service_manager::Connector* connector) |
| + : connector_(connector) {} |
|
James Cook
2016/10/21 22:22:30
DCHECK connector_ ?
Elliot Glaysher
2016/10/21 22:45:56
Done.
|
| + |
| +NewWindowClientRemote::~NewWindowClientRemote() {} |
| + |
| +void NewWindowClientRemote::NewTab() { |
| + EnsureInterface(); |
| + client_->NewTab(); |
| +} |
| + |
| +void NewWindowClientRemote::NewWindow(bool incognito) { |
| + EnsureInterface(); |
| + client_->NewWindow(incognito); |
| +} |
| + |
| +void NewWindowClientRemote::OpenFileManager() { |
| + EnsureInterface(); |
| + client_->OpenFileManager(); |
| +} |
| + |
| +void NewWindowClientRemote::OpenCrosh() { |
| + EnsureInterface(); |
| + client_->OpenCrosh(); |
| +} |
| + |
| +void NewWindowClientRemote::OpenGetHelp() { |
| + EnsureInterface(); |
| + client_->OpenGetHelp(); |
| +} |
| + |
| +void NewWindowClientRemote::RestoreTab() { |
| + EnsureInterface(); |
| + client_->RestoreTab(); |
| +} |
| + |
| +void NewWindowClientRemote::ShowKeyboardOverlay() { |
| + EnsureInterface(); |
| + client_->ShowKeyboardOverlay(); |
| +} |
| + |
| +void NewWindowClientRemote::ShowTaskManager() { |
| + EnsureInterface(); |
| + client_->ShowTaskManager(); |
| +} |
| + |
| +void NewWindowClientRemote::OpenFeedbackPage() { |
| + EnsureInterface(); |
| + client_->OpenFeedbackPage(); |
| +} |
| + |
| +void NewWindowClientRemote::EnsureInterface() { |
| + if (client_) |
| + return; |
| + connector_->ConnectToInterface("service:content_browser", &client_); |
| + client_.set_connection_error_handler(base::Bind( |
| + &NewWindowClientRemote::OnClientConnectionError, base::Unretained(this))); |
| +} |
| + |
| +void NewWindowClientRemote::OnClientConnectionError() { |
| + client_.reset(); |
| +} |
| + |
| +} // namespace ash |