| 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 #ifndef CHROME_BROWSER_UI_ASH_VPN_LIST_FORWARDER_H_ | 5 #ifndef CHROME_BROWSER_UI_ASH_VPN_LIST_FORWARDER_H_ |
| 6 #define CHROME_BROWSER_UI_ASH_VPN_LIST_FORWARDER_H_ | 6 #define CHROME_BROWSER_UI_ASH_VPN_LIST_FORWARDER_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "content/public/browser/notification_observer.h" | 10 #include "content/public/browser/notification_observer.h" |
| 11 #include "content/public/browser/notification_registrar.h" | 11 #include "content/public/browser/notification_registrar.h" |
| 12 #include "extensions/browser/extension_registry_observer.h" | 12 #include "extensions/browser/extension_registry_observer.h" |
| 13 | 13 |
| 14 namespace extensions { | 14 namespace extensions { |
| 15 class ExtensionRegistry; | 15 class ExtensionRegistry; |
| 16 } | 16 } |
| 17 | 17 |
| 18 // Forwards the list of extension-backed VPN providers in the primary user's | 18 // Forwards the list of extension-backed VPN providers in the primary user's |
| 19 // profile to ash over mojo. | 19 // profile to ash over mojo. |
| 20 class VpnListForwarder : public extensions::ExtensionRegistryObserver, | 20 class VpnListForwarder : public extensions::ExtensionRegistryObserver, |
| 21 public content::NotificationObserver { | 21 public content::NotificationObserver { |
| 22 public: | 22 public: |
| 23 VpnListForwarder(); | 23 VpnListForwarder(); |
| 24 ~VpnListForwarder() override; | 24 ~VpnListForwarder() override; |
| 25 | 25 |
| 26 // extensions::ExtensionRegistryObserver: | 26 // extensions::ExtensionRegistryObserver: |
| 27 void OnExtensionLoaded(content::BrowserContext* browser_context, | 27 void OnExtensionLoaded(content::BrowserContext* browser_context, |
| 28 const extensions::Extension* extension) override; | 28 const extensions::Extension* extension) override; |
| 29 void OnExtensionUnloaded( | 29 void OnExtensionUnloaded(content::BrowserContext* browser_context, |
| 30 content::BrowserContext* browser_context, | 30 const extensions::Extension* extension, |
| 31 const extensions::Extension* extension, | 31 extensions::UnloadedExtensionReason reason) override; |
| 32 extensions::UnloadedExtensionInfo::Reason reason) override; | |
| 33 void OnShutdown(extensions::ExtensionRegistry* registry) override; | 32 void OnShutdown(extensions::ExtensionRegistry* registry) override; |
| 34 | 33 |
| 35 // content::NotificationObserver: | 34 // content::NotificationObserver: |
| 36 void Observe(int type, | 35 void Observe(int type, |
| 37 const content::NotificationSource& source, | 36 const content::NotificationSource& source, |
| 38 const content::NotificationDetails& details) override; | 37 const content::NotificationDetails& details) override; |
| 39 | 38 |
| 40 private: | 39 private: |
| 41 // Retrieves the current list of VPN providers enabled in the primary user's | 40 // Retrieves the current list of VPN providers enabled in the primary user's |
| 42 // profile and notifies observers that it has changed. Must only be called | 41 // profile and notifies observers that it has changed. Must only be called |
| (...skipping 13 matching lines...) Expand all Loading... |
| 56 extensions::ExtensionRegistry* extension_registry_ = nullptr; | 55 extensions::ExtensionRegistry* extension_registry_ = nullptr; |
| 57 | 56 |
| 58 content::NotificationRegistrar registrar_; | 57 content::NotificationRegistrar registrar_; |
| 59 | 58 |
| 60 base::WeakPtrFactory<VpnListForwarder> weak_factory_; | 59 base::WeakPtrFactory<VpnListForwarder> weak_factory_; |
| 61 | 60 |
| 62 DISALLOW_COPY_AND_ASSIGN(VpnListForwarder); | 61 DISALLOW_COPY_AND_ASSIGN(VpnListForwarder); |
| 63 }; | 62 }; |
| 64 | 63 |
| 65 #endif // CHROME_BROWSER_UI_ASH_VPN_LIST_FORWARDER_H_ | 64 #endif // CHROME_BROWSER_UI_ASH_VPN_LIST_FORWARDER_H_ |
| OLD | NEW |