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

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

Issue 2522613004: Revert of chromeos: Convert ash VPNDelegate interface to mojo (Closed)
Patch Set: Created 4 years 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_LIST_FORWARDER_H_
6 #define CHROME_BROWSER_UI_ASH_VPN_LIST_FORWARDER_H_
7
8 #include "base/macros.h"
9 #include "base/memory/weak_ptr.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 // Forwards the list of extension-backed VPN providers in the primary user's
19 // profile to ash over mojo.
20 class VpnListForwarder : public extensions::ExtensionRegistryObserver,
21 public content::NotificationObserver {
22 public:
23 VpnListForwarder();
24 ~VpnListForwarder() override;
25
26 // extensions::ExtensionRegistryObserver:
27 void OnExtensionLoaded(content::BrowserContext* browser_context,
28 const extensions::Extension* extension) override;
29 void OnExtensionUnloaded(
30 content::BrowserContext* browser_context,
31 const extensions::Extension* extension,
32 extensions::UnloadedExtensionInfo::Reason reason) override;
33 void OnShutdown(extensions::ExtensionRegistry* registry) override;
34
35 // content::NotificationObserver:
36 void Observe(int type,
37 const content::NotificationSource& source,
38 const content::NotificationDetails& details) override;
39
40 private:
41 // 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
43 // when a user is logged in and the primary user's extension registry is being
44 // observed.
45 void UpdateVPNProviders();
46
47 // Starts observing the primary user's extension registry to detect changes to
48 // the list of VPN providers enabled in the user's profile and caches the
49 // initial list. Must only be called when a user is logged in.
50 void AttachToPrimaryUserExtensionRegistry();
51
52 // Whether this object has ever sent a third-party provider list to ash.
53 bool sent_providers_ = false;
54
55 // The primary user's extension registry, if a user is logged in.
56 extensions::ExtensionRegistry* extension_registry_ = nullptr;
57
58 content::NotificationRegistrar registrar_;
59
60 base::WeakPtrFactory<VpnListForwarder> weak_factory_;
61
62 DISALLOW_COPY_AND_ASSIGN(VpnListForwarder);
63 };
64
65 #endif // CHROME_BROWSER_UI_ASH_VPN_LIST_FORWARDER_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/vpn_delegate_chromeos.cc ('k') | chrome/browser/ui/ash/vpn_list_forwarder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698