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

Unified Diff: ash/common/new_window_client_remote.cc

Issue 2434463004: mash: Move directly linked NewWindowDelegate to mojom::NewWindowClient. (Closed)
Patch Set: Actually rename the browser test. 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
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

Powered by Google App Engine
This is Rietveld 408576698