OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "chrome/browser/ui/ash/vpn_list_forwarder.h" | 5 #include "chrome/browser/ui/ash/vpn_list_forwarder.h" |
6 | 6 |
| 7 #include "ash/public/interfaces/constants.mojom.h" |
7 #include "ash/public/interfaces/vpn_list.mojom.h" | 8 #include "ash/public/interfaces/vpn_list.mojom.h" |
8 #include "base/bind.h" | 9 #include "base/bind.h" |
9 #include "base/location.h" | 10 #include "base/location.h" |
10 #include "base/logging.h" | 11 #include "base/logging.h" |
11 #include "base/threading/thread_task_runner_handle.h" | 12 #include "base/threading/thread_task_runner_handle.h" |
12 #include "chrome/browser/chrome_notification_types.h" | 13 #include "chrome/browser/chrome_notification_types.h" |
13 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 14 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
14 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
15 #include "chrome/browser/ui/ash/ash_util.h" | |
16 #include "components/user_manager/user.h" | 16 #include "components/user_manager/user.h" |
17 #include "components/user_manager/user_manager.h" | 17 #include "components/user_manager/user_manager.h" |
18 #include "content/public/browser/notification_service.h" | 18 #include "content/public/browser/notification_service.h" |
19 #include "content/public/browser/notification_source.h" | 19 #include "content/public/browser/notification_source.h" |
20 #include "content/public/common/service_manager_connection.h" | 20 #include "content/public/common/service_manager_connection.h" |
21 #include "extensions/browser/extension_registry.h" | 21 #include "extensions/browser/extension_registry.h" |
22 #include "extensions/common/extension.h" | 22 #include "extensions/common/extension.h" |
23 #include "extensions/common/extension_set.h" | 23 #include "extensions/common/extension_set.h" |
24 #include "extensions/common/permissions/api_permission.h" | 24 #include "extensions/common/permissions/api_permission.h" |
25 #include "extensions/common/permissions/permissions_data.h" | 25 #include "extensions/common/permissions/permissions_data.h" |
(...skipping 13 matching lines...) Expand all Loading... |
39 return nullptr; | 39 return nullptr; |
40 | 40 |
41 return chromeos::ProfileHelper::Get()->GetProfileByUser(primary_user); | 41 return chromeos::ProfileHelper::Get()->GetProfileByUser(primary_user); |
42 } | 42 } |
43 | 43 |
44 // Connects to the VpnList mojo interface in ash. | 44 // Connects to the VpnList mojo interface in ash. |
45 ash::mojom::VpnListPtr ConnectToVpnList() { | 45 ash::mojom::VpnListPtr ConnectToVpnList() { |
46 ash::mojom::VpnListPtr vpn_list; | 46 ash::mojom::VpnListPtr vpn_list; |
47 content::ServiceManagerConnection::GetForProcess() | 47 content::ServiceManagerConnection::GetForProcess() |
48 ->GetConnector() | 48 ->GetConnector() |
49 ->BindInterface(ash_util::GetAshServiceName(), &vpn_list); | 49 ->BindInterface(ash::mojom::kServiceName, &vpn_list); |
50 return vpn_list; | 50 return vpn_list; |
51 } | 51 } |
52 | 52 |
53 } // namespace | 53 } // namespace |
54 | 54 |
55 VpnListForwarder::VpnListForwarder() : weak_factory_(this) { | 55 VpnListForwarder::VpnListForwarder() : weak_factory_(this) { |
56 if (user_manager::UserManager::Get()->GetPrimaryUser()) { | 56 if (user_manager::UserManager::Get()->GetPrimaryUser()) { |
57 // If a user is logged in, start observing the primary user's extension | 57 // If a user is logged in, start observing the primary user's extension |
58 // registry immediately. | 58 // registry immediately. |
59 AttachToPrimaryUserExtensionRegistry(); | 59 AttachToPrimaryUserExtensionRegistry(); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 } | 144 } |
145 | 145 |
146 void VpnListForwarder::AttachToPrimaryUserExtensionRegistry() { | 146 void VpnListForwarder::AttachToPrimaryUserExtensionRegistry() { |
147 DCHECK(!extension_registry_); | 147 DCHECK(!extension_registry_); |
148 extension_registry_ = | 148 extension_registry_ = |
149 extensions::ExtensionRegistry::Get(GetProfileForPrimaryUser()); | 149 extensions::ExtensionRegistry::Get(GetProfileForPrimaryUser()); |
150 extension_registry_->AddObserver(this); | 150 extension_registry_->AddObserver(this); |
151 | 151 |
152 UpdateVPNProviders(); | 152 UpdateVPNProviders(); |
153 } | 153 } |
OLD | NEW |