| OLD | NEW |
| (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 DCHECK(connector); |
| 16 } |
| 17 |
| 18 NewWindowClientProxy::~NewWindowClientProxy() {} |
| 19 |
| 20 void NewWindowClientProxy::NewTab() { |
| 21 EnsureInterface(); |
| 22 client_->NewTab(); |
| 23 } |
| 24 |
| 25 void NewWindowClientProxy::NewWindow(bool incognito) { |
| 26 EnsureInterface(); |
| 27 client_->NewWindow(incognito); |
| 28 } |
| 29 |
| 30 void NewWindowClientProxy::OpenFileManager() { |
| 31 EnsureInterface(); |
| 32 client_->OpenFileManager(); |
| 33 } |
| 34 |
| 35 void NewWindowClientProxy::OpenCrosh() { |
| 36 EnsureInterface(); |
| 37 client_->OpenCrosh(); |
| 38 } |
| 39 |
| 40 void NewWindowClientProxy::OpenGetHelp() { |
| 41 EnsureInterface(); |
| 42 client_->OpenGetHelp(); |
| 43 } |
| 44 |
| 45 void NewWindowClientProxy::RestoreTab() { |
| 46 EnsureInterface(); |
| 47 client_->RestoreTab(); |
| 48 } |
| 49 |
| 50 void NewWindowClientProxy::ShowKeyboardOverlay() { |
| 51 EnsureInterface(); |
| 52 client_->ShowKeyboardOverlay(); |
| 53 } |
| 54 |
| 55 void NewWindowClientProxy::ShowTaskManager() { |
| 56 EnsureInterface(); |
| 57 client_->ShowTaskManager(); |
| 58 } |
| 59 |
| 60 void NewWindowClientProxy::OpenFeedbackPage() { |
| 61 EnsureInterface(); |
| 62 client_->OpenFeedbackPage(); |
| 63 } |
| 64 |
| 65 void NewWindowClientProxy::EnsureInterface() { |
| 66 if (client_) |
| 67 return; |
| 68 connector_->ConnectToInterface("service:content_browser", &client_); |
| 69 client_.set_connection_error_handler(base::Bind( |
| 70 &NewWindowClientProxy::OnClientConnectionError, base::Unretained(this))); |
| 71 } |
| 72 |
| 73 void NewWindowClientProxy::OnClientConnectionError() { |
| 74 client_.reset(); |
| 75 } |
| 76 |
| 77 } // namespace ash |
| OLD | NEW |