OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_UI_ASH_VPN_DELEGATE_CHROMEOS_H_ |
| 6 #define CHROME_BROWSER_UI_ASH_VPN_DELEGATE_CHROMEOS_H_ |
| 7 |
| 8 #include "ash/system/chromeos/network/vpn_delegate.h" |
| 9 #include "base/macros.h" |
| 10 #include "content/public/browser/notification_observer.h" |
| 11 #include "content/public/browser/notification_registrar.h" |
| 12 #include "extensions/browser/extension_registry_observer.h" |
| 13 |
| 14 namespace extensions { |
| 15 class ExtensionRegistry; |
| 16 } |
| 17 |
| 18 // Chrome OS implementation of a delegate that provides UI code in ash with |
| 19 // access to the third-party VPN providers enabled in the primary user's |
| 20 // profile. |
| 21 class VPNDelegateChromeOS : public ash::VPNDelegate, |
| 22 public extensions::ExtensionRegistryObserver, |
| 23 public content::NotificationObserver { |
| 24 public: |
| 25 VPNDelegateChromeOS(); |
| 26 ~VPNDelegateChromeOS() override; |
| 27 |
| 28 // ash::VPNDelegate: |
| 29 bool HaveThirdPartyVPNProviders() const override; |
| 30 std::vector<ash::VPNProvider> GetThirdPartyVPNProviders() const override; |
| 31 void ShowAddPage(const std::string& id) override; |
| 32 |
| 33 // extensions::ExtensionRegistryObserver: |
| 34 void OnExtensionLoaded(content::BrowserContext* browser_context, |
| 35 const extensions::Extension* extension) override; |
| 36 void OnExtensionUnloaded( |
| 37 content::BrowserContext* browser_context, |
| 38 const extensions::Extension* extension, |
| 39 extensions::UnloadedExtensionInfo::Reason reason) override; |
| 40 void OnShutdown(extensions::ExtensionRegistry* registry) override; |
| 41 |
| 42 // content::NotificationObserver: |
| 43 void Observe(int type, |
| 44 const content::NotificationSource& source, |
| 45 const content::NotificationDetails& details) override; |
| 46 |
| 47 private: |
| 48 // Starts observing the primary user's extension registry. Must only be called |
| 49 // when a user is logged in. |
| 50 void AttachToPrimaryUserExtensionRegistry(); |
| 51 |
| 52 // The primary user's extension registry, if a user is logged in. |
| 53 extensions::ExtensionRegistry* extension_registry_ = nullptr; |
| 54 |
| 55 content::NotificationRegistrar registrar_; |
| 56 |
| 57 DISALLOW_COPY_AND_ASSIGN(VPNDelegateChromeOS); |
| 58 }; |
| 59 |
| 60 #endif // CHROME_BROWSER_UI_ASH_VPN_DELEGATE_CHROMEOS_H_ |
OLD | NEW |