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

Unified Diff: ash/common/new_window_client_proxy.cc

Issue 2434463004: mash: Move directly linked NewWindowDelegate to mojom::NewWindowClient. (Closed)
Patch Set: Rebase to ToT Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/common/new_window_client_proxy.h ('k') | ash/common/new_window_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/common/new_window_client_proxy.cc
diff --git a/ash/common/new_window_client_proxy.cc b/ash/common/new_window_client_proxy.cc
new file mode 100644
index 0000000000000000000000000000000000000000..d25456efc3ba563287c233bb0b80635a4d641685
--- /dev/null
+++ b/ash/common/new_window_client_proxy.cc
@@ -0,0 +1,80 @@
+// 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_proxy.h"
+
+#include "base/logging.h"
+#include "services/service_manager/public/cpp/connector.h"
+
+namespace ash {
+
+NewWindowClientProxy::NewWindowClientProxy(
+ service_manager::Connector* connector)
+ : connector_(connector) {}
+
+NewWindowClientProxy::~NewWindowClientProxy() {}
+
+void NewWindowClientProxy::NewTab() {
+ EnsureInterface();
+ client_->NewTab();
+}
+
+void NewWindowClientProxy::NewWindow(bool incognito) {
+ EnsureInterface();
+ client_->NewWindow(incognito);
+}
+
+void NewWindowClientProxy::OpenFileManager() {
+ EnsureInterface();
+ client_->OpenFileManager();
+}
+
+void NewWindowClientProxy::OpenCrosh() {
+ EnsureInterface();
+ client_->OpenCrosh();
+}
+
+void NewWindowClientProxy::OpenGetHelp() {
+ EnsureInterface();
+ client_->OpenGetHelp();
+}
+
+void NewWindowClientProxy::RestoreTab() {
+ EnsureInterface();
+ client_->RestoreTab();
+}
+
+void NewWindowClientProxy::ShowKeyboardOverlay() {
+ EnsureInterface();
+ client_->ShowKeyboardOverlay();
+}
+
+void NewWindowClientProxy::ShowTaskManager() {
+ EnsureInterface();
+ client_->ShowTaskManager();
+}
+
+void NewWindowClientProxy::OpenFeedbackPage() {
+ EnsureInterface();
+ client_->OpenFeedbackPage();
+}
+
+void NewWindowClientProxy::EnsureInterface() {
+ // |connector_| can be null in unit tests. We check this at first usage
+ // instead of during construction because a NewWindowClientProxy is always
+ // created and is then replaced with a mock in the unit tests.
+ DCHECK(connector_);
+
+ if (client_)
+ return;
+ connector_->ConnectToInterface("service:content_browser", &client_);
+ client_.set_connection_error_handler(base::Bind(
+ &NewWindowClientProxy::OnClientConnectionError, base::Unretained(this)));
+}
+
+void NewWindowClientProxy::OnClientConnectionError() {
+ client_.reset();
+}
+
+} // namespace ash
« no previous file with comments | « ash/common/new_window_client_proxy.h ('k') | ash/common/new_window_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698