Chromium Code Reviews| 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_remote.h" | |
| 6 | |
| 7 #include "base/logging.h" | |
| 8 #include "services/service_manager/public/cpp/connector.h" | |
| 9 | |
| 10 namespace ash { | |
| 11 | |
| 12 NewWindowClientRemote::NewWindowClientRemote( | |
| 13 service_manager::Connector* connector) | |
| 14 : connector_(connector) {} | |
|
James Cook
2016/10/21 22:22:30
DCHECK connector_ ?
Elliot Glaysher
2016/10/21 22:45:56
Done.
| |
| 15 | |
| 16 NewWindowClientRemote::~NewWindowClientRemote() {} | |
| 17 | |
| 18 void NewWindowClientRemote::NewTab() { | |
| 19 EnsureInterface(); | |
| 20 client_->NewTab(); | |
| 21 } | |
| 22 | |
| 23 void NewWindowClientRemote::NewWindow(bool incognito) { | |
| 24 EnsureInterface(); | |
| 25 client_->NewWindow(incognito); | |
| 26 } | |
| 27 | |
| 28 void NewWindowClientRemote::OpenFileManager() { | |
| 29 EnsureInterface(); | |
| 30 client_->OpenFileManager(); | |
| 31 } | |
| 32 | |
| 33 void NewWindowClientRemote::OpenCrosh() { | |
| 34 EnsureInterface(); | |
| 35 client_->OpenCrosh(); | |
| 36 } | |
| 37 | |
| 38 void NewWindowClientRemote::OpenGetHelp() { | |
| 39 EnsureInterface(); | |
| 40 client_->OpenGetHelp(); | |
| 41 } | |
| 42 | |
| 43 void NewWindowClientRemote::RestoreTab() { | |
| 44 EnsureInterface(); | |
| 45 client_->RestoreTab(); | |
| 46 } | |
| 47 | |
| 48 void NewWindowClientRemote::ShowKeyboardOverlay() { | |
| 49 EnsureInterface(); | |
| 50 client_->ShowKeyboardOverlay(); | |
| 51 } | |
| 52 | |
| 53 void NewWindowClientRemote::ShowTaskManager() { | |
| 54 EnsureInterface(); | |
| 55 client_->ShowTaskManager(); | |
| 56 } | |
| 57 | |
| 58 void NewWindowClientRemote::OpenFeedbackPage() { | |
| 59 EnsureInterface(); | |
| 60 client_->OpenFeedbackPage(); | |
| 61 } | |
| 62 | |
| 63 void NewWindowClientRemote::EnsureInterface() { | |
| 64 if (client_) | |
| 65 return; | |
| 66 connector_->ConnectToInterface("service:content_browser", &client_); | |
| 67 client_.set_connection_error_handler(base::Bind( | |
| 68 &NewWindowClientRemote::OnClientConnectionError, base::Unretained(this))); | |
| 69 } | |
| 70 | |
| 71 void NewWindowClientRemote::OnClientConnectionError() { | |
| 72 client_.reset(); | |
| 73 } | |
| 74 | |
| 75 } // namespace ash | |
| OLD | NEW |