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

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: Fixed crash during device-local account login. 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 "base/memory/weak_ptr.h"
13 #include "content/public/browser/notification_observer.h"
14 #include "content/public/browser/notification_registrar.h"
15 #include "extensions/browser/extension_registry_observer.h"
16
17 namespace extensions {
18 class ExtensionRegistry;
19 }
20
21 // Chrome OS implementation of a delegate that provides UI code in ash with
22 // access to the VPN providers enabled in the primary user's profile.
23 class VPNDelegateChromeOS : public ash::VPNDelegate,
24 public extensions::ExtensionRegistryObserver,
25 public content::NotificationObserver {
26 public:
27 VPNDelegateChromeOS();
28 ~VPNDelegateChromeOS() override;
29
30 // ash::VPNDelegate:
31 bool HaveThirdPartyVPNProviders() const override;
32 const std::vector<ash::VPNProvider>& GetVPNProviders() const override;
33 void ShowAddPage(const ash::VPNProvider::Key& key) override;
34
35 // extensions::ExtensionRegistryObserver:
36 void OnExtensionLoaded(content::BrowserContext* browser_context,
37 const extensions::Extension* extension) override;
38 void OnExtensionUnloaded(
39 content::BrowserContext* browser_context,
40 const extensions::Extension* extension,
41 extensions::UnloadedExtensionInfo::Reason reason) override;
42 void OnShutdown(extensions::ExtensionRegistry* registry) override;
43
44 // content::NotificationObserver:
45 void Observe(int type,
46 const content::NotificationSource& source,
47 const content::NotificationDetails& details) override;
48
49 private:
50 // Retrieves the current list of VPN providers enabled in the primary user's
51 // profile and notifies observers that it has changed. Must only be called
52 // when a user is logged in and the primary user's extension registry is being
53 // observed.
54 void UpdateVPNProviders();
55
56 // Starts observing the primary user's extension registry to detect changes to
57 // the list of VPN providers enabled in the user's profile and caches the
58 // initial list. Must only be called when a user is logged in.
59 void AttachToPrimaryUserExtensionRegistry();
60
61 // The primary user's extension registry, if a user is logged in.
62 extensions::ExtensionRegistry* extension_registry_ = nullptr;
63
64 // A cache of the VPN providers enabled in the primary user's profile.
65 std::vector<ash::VPNProvider> vpn_providers_;
66
67 content::NotificationRegistrar registrar_;
68
69 base::WeakPtrFactory<VPNDelegateChromeOS> weak_factory_;
70
71 DISALLOW_COPY_AND_ASSIGN(VPNDelegateChromeOS);
72 };
73
74 #endif // CHROME_BROWSER_UI_ASH_VPN_DELEGATE_CHROMEOS_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/system_tray_delegate_chromeos.cc ('k') | chrome/browser/ui/ash/vpn_delegate_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698