OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 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 "content/public/browser/network_service_instance.h" |
| 6 |
| 7 #include "base/feature_list.h" |
| 8 #include "content/public/browser/browser_thread.h" |
| 9 #include "content/public/common/content_features.h" |
| 10 #include "content/public/common/network_service.mojom.h" |
| 11 #include "content/public/common/service_manager_connection.h" |
| 12 #include "content/public/common/service_names.mojom.h" |
| 13 #include "services/service_manager/public/cpp/connector.h" |
| 14 |
| 15 namespace content { |
| 16 |
| 17 mojom::NetworkService* GetNetworkService() { |
| 18 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 19 DCHECK(base::FeatureList::IsEnabled(features::kNetworkService)); |
| 20 |
| 21 static mojom::NetworkServicePtr* g_network_service = |
| 22 new mojom::NetworkServicePtr; |
| 23 if (!g_network_service->is_bound()) { |
| 24 ServiceManagerConnection::GetForProcess()->GetConnector()->BindInterface( |
| 25 mojom::kNetworkServiceName, g_network_service); |
| 26 } |
| 27 return g_network_service->get(); |
| 28 } |
| 29 |
| 30 } // namespace content |
OLD | NEW |