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

Side by Side 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, 1 month 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "ash/common/new_window_client_proxy.h"
6
7 #include "base/logging.h"
8 #include "services/service_manager/public/cpp/connector.h"
9
10 namespace ash {
11
12 NewWindowClientProxy::NewWindowClientProxy(
13 service_manager::Connector* connector)
14 : connector_(connector) {}
15
16 NewWindowClientProxy::~NewWindowClientProxy() {}
17
18 void NewWindowClientProxy::NewTab() {
19 EnsureInterface();
20 client_->NewTab();
21 }
22
23 void NewWindowClientProxy::NewWindow(bool incognito) {
24 EnsureInterface();
25 client_->NewWindow(incognito);
26 }
27
28 void NewWindowClientProxy::OpenFileManager() {
29 EnsureInterface();
30 client_->OpenFileManager();
31 }
32
33 void NewWindowClientProxy::OpenCrosh() {
34 EnsureInterface();
35 client_->OpenCrosh();
36 }
37
38 void NewWindowClientProxy::OpenGetHelp() {
39 EnsureInterface();
40 client_->OpenGetHelp();
41 }
42
43 void NewWindowClientProxy::RestoreTab() {
44 EnsureInterface();
45 client_->RestoreTab();
46 }
47
48 void NewWindowClientProxy::ShowKeyboardOverlay() {
49 EnsureInterface();
50 client_->ShowKeyboardOverlay();
51 }
52
53 void NewWindowClientProxy::ShowTaskManager() {
54 EnsureInterface();
55 client_->ShowTaskManager();
56 }
57
58 void NewWindowClientProxy::OpenFeedbackPage() {
59 EnsureInterface();
60 client_->OpenFeedbackPage();
61 }
62
63 void NewWindowClientProxy::EnsureInterface() {
64 // |connector_| can be null in unit tests. We check this at first usage
65 // instead of during construction because a NewWindowClientProxy is always
66 // created and is then replaced with a mock in the unit tests.
67 DCHECK(connector_);
68
69 if (client_)
70 return;
71 connector_->ConnectToInterface("service:content_browser", &client_);
72 client_.set_connection_error_handler(base::Bind(
73 &NewWindowClientProxy::OnClientConnectionError, base::Unretained(this)));
74 }
75
76 void NewWindowClientProxy::OnClientConnectionError() {
77 client_.reset();
78 }
79
80 } // namespace ash
OLDNEW
« 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