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

Unified 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: 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/ash/vpn_delegate_chromeos.h
diff --git a/chrome/browser/ui/ash/vpn_delegate_chromeos.h b/chrome/browser/ui/ash/vpn_delegate_chromeos.h
new file mode 100644
index 0000000000000000000000000000000000000000..dae84fec7f4a4b4b710cd3437bac3e5e9f19c4c7
--- /dev/null
+++ b/chrome/browser/ui/ash/vpn_delegate_chromeos.h
@@ -0,0 +1,60 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_ASH_VPN_DELEGATE_CHROMEOS_H_
+#define CHROME_BROWSER_UI_ASH_VPN_DELEGATE_CHROMEOS_H_
+
+#include "ash/system/chromeos/network/vpn_delegate.h"
+#include "base/macros.h"
+#include "content/public/browser/notification_observer.h"
+#include "content/public/browser/notification_registrar.h"
+#include "extensions/browser/extension_registry_observer.h"
+
+namespace extensions {
+class ExtensionRegistry;
+}
+
+// Chrome OS implementation of a delegate that provides UI code in ash with
+// access to the third-party VPN providers enabled in the primary user's
+// profile.
+class VPNDelegateChromeOS : public ash::VPNDelegate,
+ public extensions::ExtensionRegistryObserver,
+ public content::NotificationObserver {
+ public:
+ VPNDelegateChromeOS();
+ ~VPNDelegateChromeOS() override;
+
+ // ash::VPNDelegate:
+ bool HaveThirdPartyVPNProviders() const override;
+ std::vector<ash::VPNProvider> GetThirdPartyVPNProviders() const override;
+ void ShowAddPage(const std::string& id) override;
+
+ // extensions::ExtensionRegistryObserver:
+ void OnExtensionLoaded(content::BrowserContext* browser_context,
+ const extensions::Extension* extension) override;
+ void OnExtensionUnloaded(
+ content::BrowserContext* browser_context,
Daniel Erat 2015/03/09 19:46:19 indent four spaces beyond previous line rather tha
bartfab (slow) 2015/03/09 21:04:23 Done.
+ const extensions::Extension* extension,
+ extensions::UnloadedExtensionInfo::Reason reason) override;
+ void OnShutdown(extensions::ExtensionRegistry* registry) override;
+
+ // content::NotificationObserver:
+ void Observe(int type,
+ const content::NotificationSource& source,
+ const content::NotificationDetails& details) override;
+
+ private:
+ // Starts observing the primary user's extension registry. Must only be called
+ // when a user is logged in.
+ void AttachToPrimaryUserExtensionRegistry();
+
+ // The primary user's extension registry, if a user is logged in.
+ extensions::ExtensionRegistry* extension_registry_ = nullptr;
+
+ content::NotificationRegistrar registrar_;
+
+ DISALLOW_COPY_AND_ASSIGN(VPNDelegateChromeOS);
+};
+
+#endif // CHROME_BROWSER_UI_ASH_VPN_DELEGATE_CHROMEOS_H_

Powered by Google App Engine
This is Rietveld 408576698