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

Unified Diff: chrome/browser/ui/ash/vpn_list_client.h

Issue 2513673004: Reland: chromeos: Convert ash VPNDelegate interface to mojo (Closed)
Patch Set: rebase Created 4 years, 1 month 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_list_client.h
diff --git a/chrome/browser/ui/ash/vpn_delegate_chromeos.h b/chrome/browser/ui/ash/vpn_list_client.h
similarity index 58%
rename from chrome/browser/ui/ash/vpn_delegate_chromeos.h
rename to chrome/browser/ui/ash/vpn_list_client.h
index 16c1065daf7a5dc83c238023976861bd52f608fb..e469e1add28a8745e5c87dee6b514c9fd83c4b48 100644
--- a/chrome/browser/ui/ash/vpn_delegate_chromeos.h
+++ b/chrome/browser/ui/ash/vpn_list_client.h
@@ -2,33 +2,34 @@
// 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_
+#ifndef CHROME_BROWSER_UI_ASH_VPN_LIST_CLIENT_H_
+#define CHROME_BROWSER_UI_ASH_VPN_LIST_CLIENT_H_
-#include <vector>
-
-#include "ash/common/system/chromeos/network/vpn_delegate.h"
+#include "ash/public/interfaces/vpn_list.mojom.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
#include "extensions/browser/extension_registry_observer.h"
+#include "mojo/public/cpp/bindings/binding.h"
namespace extensions {
class ExtensionRegistry;
}
-// Chrome OS implementation of a delegate that provides UI code in ash with
-// access to the VPN providers enabled in the primary user's profile.
-class VPNDelegateChromeOS : public ash::VPNDelegate,
- public extensions::ExtensionRegistryObserver,
- public content::NotificationObserver {
+// A service that provides UI code in ash with the list of extension-backed
+// VPN providers in the primary user's profile. The service also allows ash to
+// request that chrome show an "add network" page for a VPN provider.
+class VpnListClient : public ash::mojom::VpnListClient,
+ public extensions::ExtensionRegistryObserver,
+ public content::NotificationObserver {
public:
- VPNDelegateChromeOS();
- ~VPNDelegateChromeOS() override;
+ VpnListClient();
+ ~VpnListClient() override;
- // ash::VPNDelegate:
- void ShowAddPage(const ash::VPNProvider::Key& key) override;
+ // ash::mojom::VpnListClient:
+ void ShowBuiltInAddNetworkPage() override;
+ void ShowThirdPartyAddNetworkPage(const std::string& extension_id) override;
// extensions::ExtensionRegistryObserver:
void OnExtensionLoaded(content::BrowserContext* browser_context,
@@ -45,6 +46,9 @@ class VPNDelegateChromeOS : public ash::VPNDelegate,
const content::NotificationDetails& details) override;
private:
+ // Connects to the VpnList service in ash and returns the interface pointer.
+ ash::mojom::VpnListPtr ConnectToVpnList();
+
// Retrieves the current list of VPN providers enabled in the primary user's
// profile and notifies observers that it has changed. Must only be called
// when a user is logged in and the primary user's extension registry is being
@@ -56,14 +60,20 @@ class VPNDelegateChromeOS : public ash::VPNDelegate,
// initial list. Must only be called when a user is logged in.
void AttachToPrimaryUserExtensionRegistry();
+ // Binds this object to the mojo interface.
+ mojo::Binding<ash::mojom::VpnListClient> binding_;
+
+ // Whether this object has ever sent a third-party provider list to ash.
+ bool sent_providers_ = false;
+
// The primary user's extension registry, if a user is logged in.
extensions::ExtensionRegistry* extension_registry_ = nullptr;
content::NotificationRegistrar registrar_;
- base::WeakPtrFactory<VPNDelegateChromeOS> weak_factory_;
+ base::WeakPtrFactory<VpnListClient> weak_factory_;
- DISALLOW_COPY_AND_ASSIGN(VPNDelegateChromeOS);
+ DISALLOW_COPY_AND_ASSIGN(VpnListClient);
};
-#endif // CHROME_BROWSER_UI_ASH_VPN_DELEGATE_CHROMEOS_H_
+#endif // CHROME_BROWSER_UI_ASH_VPN_LIST_CLIENT_H_

Powered by Google App Engine
This is Rietveld 408576698