| 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_delegate_chromeos.h" | 5 #include "chrome/browser/ui/ash/vpn_delegate_chromeos.h" |
| 6 | 6 |
| 7 #include "ash/common/system/tray/system_tray_delegate.h" | 7 #include "ash/common/system/tray/system_tray_delegate.h" |
| 8 #include "ash/common/wm_shell.h" | 8 #include "ash/common/wm_shell.h" |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/threading/thread_task_runner_handle.h" | 12 #include "base/threading/thread_task_runner_handle.h" |
| 13 #include "chrome/browser/chrome_notification_types.h" | 13 #include "chrome/browser/chrome_notification_types.h" |
| 14 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 14 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 15 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
| 16 #include "chrome/grit/generated_resources.h" |
| 16 #include "components/user_manager/user.h" | 17 #include "components/user_manager/user.h" |
| 17 #include "components/user_manager/user_manager.h" | 18 #include "components/user_manager/user_manager.h" |
| 18 #include "content/public/browser/notification_service.h" | 19 #include "content/public/browser/notification_service.h" |
| 19 #include "content/public/browser/notification_source.h" | 20 #include "content/public/browser/notification_source.h" |
| 20 #include "extensions/browser/api/vpn_provider/vpn_service.h" | 21 #include "extensions/browser/api/vpn_provider/vpn_service.h" |
| 21 #include "extensions/browser/api/vpn_provider/vpn_service_factory.h" | 22 #include "extensions/browser/api/vpn_provider/vpn_service_factory.h" |
| 22 #include "extensions/browser/extension_registry.h" | 23 #include "extensions/browser/extension_registry.h" |
| 23 #include "extensions/common/extension.h" | 24 #include "extensions/common/extension.h" |
| 24 #include "extensions/common/extension_set.h" | 25 #include "extensions/common/extension_set.h" |
| 25 #include "extensions/common/permissions/api_permission.h" | 26 #include "extensions/common/permissions/api_permission.h" |
| 26 #include "extensions/common/permissions/permissions_data.h" | 27 #include "extensions/common/permissions/permissions_data.h" |
| 27 #include "third_party/cros_system_api/dbus/service_constants.h" | 28 #include "third_party/cros_system_api/dbus/service_constants.h" |
| 28 #include "ui/base/l10n/l10n_util.h" | 29 #include "ui/base/l10n/l10n_util.h" |
| 29 #include "ui/chromeos/strings/grit/ui_chromeos_strings.h" | |
| 30 | 30 |
| 31 namespace { | 31 namespace { |
| 32 | 32 |
| 33 bool IsVPNProvider(const extensions::Extension* extension) { | 33 bool IsVPNProvider(const extensions::Extension* extension) { |
| 34 return extension->permissions_data()->HasAPIPermission( | 34 return extension->permissions_data()->HasAPIPermission( |
| 35 extensions::APIPermission::kVpnProvider); | 35 extensions::APIPermission::kVpnProvider); |
| 36 } | 36 } |
| 37 | 37 |
| 38 Profile* GetProfileForPrimaryUser() { | 38 Profile* GetProfileForPrimaryUser() { |
| 39 const user_manager::User* const primary_user = | 39 const user_manager::User* const primary_user = |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 } | 160 } |
| 161 | 161 |
| 162 void VPNDelegateChromeOS::AttachToPrimaryUserExtensionRegistry() { | 162 void VPNDelegateChromeOS::AttachToPrimaryUserExtensionRegistry() { |
| 163 DCHECK(!extension_registry_); | 163 DCHECK(!extension_registry_); |
| 164 extension_registry_ = | 164 extension_registry_ = |
| 165 extensions::ExtensionRegistry::Get(GetProfileForPrimaryUser()); | 165 extensions::ExtensionRegistry::Get(GetProfileForPrimaryUser()); |
| 166 extension_registry_->AddObserver(this); | 166 extension_registry_->AddObserver(this); |
| 167 | 167 |
| 168 UpdateVPNProviders(); | 168 UpdateVPNProviders(); |
| 169 } | 169 } |
| OLD | NEW |