Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(99)

Side by Side Diff: chrome/browser/ui/ash/vpn_delegate_chromeos.h

Issue 984863005: Add ash::VPNDelegate and Chrome OS implementation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move knowledge of the built-in OpenVPN provider from ash UI into the VPNDelegate. Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 <vector>
9
10 #include "ash/system/chromeos/network/vpn_delegate.h"
11 #include "base/macros.h"
12 #include "content/public/browser/notification_observer.h"
13 #include "content/public/browser/notification_registrar.h"
14 #include "extensions/browser/extension_registry_observer.h"
15
16 namespace extensions {
17 class ExtensionRegistry;
18 }
19
20 // Chrome OS implementation of a delegate that provides UI code in ash with
21 // access to the VPN providers enabled in the primary user's profile.
22 class VPNDelegateChromeOS : public ash::VPNDelegate,
23 public extensions::ExtensionRegistryObserver,
24 public content::NotificationObserver {
25 public:
26 VPNDelegateChromeOS();
27 ~VPNDelegateChromeOS() override;
28
29 // ash::VPNDelegate:
30 bool HaveThirdPartyVPNProviders() const override;
31 const std::vector<ash::VPNProvider>& GetVPNProviders() const override;
32 void ShowAddPage(const std::string& id) override;
33
34 // extensions::ExtensionRegistryObserver:
35 void OnExtensionLoaded(content::BrowserContext* browser_context,
36 const extensions::Extension* extension) override;
37 void OnExtensionUnloaded(
38 content::BrowserContext* browser_context,
39 const extensions::Extension* extension,
40 extensions::UnloadedExtensionInfo::Reason reason) override;
41 void OnShutdown(extensions::ExtensionRegistry* registry) override;
42
43 // content::NotificationObserver:
44 void Observe(int type,
45 const content::NotificationSource& source,
46 const content::NotificationDetails& details) override;
47
48 private:
49 // Retrieves the current list of VPN providers enabled in the primary user's
50 // profile and notifies observers that it has changed. Must only be called
51 // when a user is logged in and the primary user's extension registry is being
52 // observed.
53 void UpdateVPNProviders();
54
55 // Starts observing the primary user's extension registry to detect changes to
56 // the list of VPN providers enabled in the user's profile and caches the
57 // initial list. Must only be called when a user is logged in.
58 void AttachToPrimaryUserExtensionRegistry();
59
60 // The primary user's extension registry, if a user is logged in.
61 extensions::ExtensionRegistry* extension_registry_ = nullptr;
62
63 // A cache of the VPN providers enabled in the primary user's profile.
64 std::vector<ash::VPNProvider> vpn_providers_;
65
66 content::NotificationRegistrar registrar_;
67
68 DISALLOW_COPY_AND_ASSIGN(VPNDelegateChromeOS);
69 };
70
71 #endif // CHROME_BROWSER_UI_ASH_VPN_DELEGATE_CHROMEOS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698