| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ash/common/new_window_client_proxy.h" | 5 #include "ash/common/new_window_client_proxy.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "content/public/common/service_names.mojom.h" |
| 8 #include "services/service_manager/public/cpp/connector.h" | 9 #include "services/service_manager/public/cpp/connector.h" |
| 9 | 10 |
| 10 namespace ash { | 11 namespace ash { |
| 11 | 12 |
| 12 NewWindowClientProxy::NewWindowClientProxy( | 13 NewWindowClientProxy::NewWindowClientProxy( |
| 13 service_manager::Connector* connector) | 14 service_manager::Connector* connector) |
| 14 : connector_(connector) {} | 15 : connector_(connector) {} |
| 15 | 16 |
| 16 NewWindowClientProxy::~NewWindowClientProxy() {} | 17 NewWindowClientProxy::~NewWindowClientProxy() {} |
| 17 | 18 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 } | 62 } |
| 62 | 63 |
| 63 void NewWindowClientProxy::EnsureInterface() { | 64 void NewWindowClientProxy::EnsureInterface() { |
| 64 // |connector_| can be null in unit tests. We check this at first usage | 65 // |connector_| can be null in unit tests. We check this at first usage |
| 65 // instead of during construction because a NewWindowClientProxy is always | 66 // instead of during construction because a NewWindowClientProxy is always |
| 66 // created and is then replaced with a mock in the unit tests. | 67 // created and is then replaced with a mock in the unit tests. |
| 67 DCHECK(connector_); | 68 DCHECK(connector_); |
| 68 | 69 |
| 69 if (client_) | 70 if (client_) |
| 70 return; | 71 return; |
| 71 connector_->ConnectToInterface("content_browser", &client_); | 72 connector_->ConnectToInterface(content::mojom::kBrowserServiceName, &client_); |
| 72 client_.set_connection_error_handler(base::Bind( | 73 client_.set_connection_error_handler(base::Bind( |
| 73 &NewWindowClientProxy::OnClientConnectionError, base::Unretained(this))); | 74 &NewWindowClientProxy::OnClientConnectionError, base::Unretained(this))); |
| 74 } | 75 } |
| 75 | 76 |
| 76 void NewWindowClientProxy::OnClientConnectionError() { | 77 void NewWindowClientProxy::OnClientConnectionError() { |
| 77 client_.reset(); | 78 client_.reset(); |
| 78 } | 79 } |
| 79 | 80 |
| 80 } // namespace ash | 81 } // namespace ash |
| OLD | NEW |