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

Unified Diff: components/wifi_sync/wifi_config_delegate_factory_chromeos.h

Issue 836363002: wifi_sync: add WifiConfigDelegate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@submit-4.1-network-state-helper
Patch Set: Created 5 years, 11 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: components/wifi_sync/wifi_config_delegate_factory_chromeos.h
diff --git a/components/wifi_sync/wifi_config_delegate_factory_chromeos.h b/components/wifi_sync/wifi_config_delegate_factory_chromeos.h
new file mode 100644
index 0000000000000000000000000000000000000000..989748ffb3542ee14a480a9207bcbe8458b204b2
--- /dev/null
+++ b/components/wifi_sync/wifi_config_delegate_factory_chromeos.h
@@ -0,0 +1,58 @@
+// Copyright 2014 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 COMPONENTS_WIFI_SYNC_WIFI_CONFIG_DELEGATE_FACTORY_CHROMEOS_H_
+#define COMPONENTS_WIFI_SYNC_WIFI_CONFIG_DELEGATE_FACTORY_CHROMEOS_H_
+
+#include "base/macros.h"
+#include "base/memory/scoped_ptr.h"
+
+template <typename T> struct DefaultSingletonTraits;
+
+namespace content {
+class BrowserContext;
+}
+
+namespace wifi_sync {
+
+class WifiConfigDelegate;
+
+// Singleton that creates WifiConfigDelegateChromeOs instances.
+// Ownership of the created instance is passed to the caller of
+// BuildInstanceFor.
+class WifiConfigDelegateFactoryChromeOs {
+ public:
+ // Returns the singleton instance.
+ static WifiConfigDelegateFactoryChromeOs* GetInstance();
+
+ // Configures whether the factory will use chromeos::LoginState to
+ // determine the ChromeOS network profile that corresponds to a
+ // content::BrowserContext. If it is not possible to control
+ // LoginState when WifiCredentialSyncableServices are created (such
+ // as in some tests), call this method with false.
+ void SetUseLoginState(bool use_login_state);
+ // Returns a new WifiConfigDelegate, which will make changes to the
+ // ChromeOS network profile corresponding to |browser_context|. The
+ // caller must ensure that the returned delegate does not outlive
+ // the chromeos::internal::DBusServices singleton. (The simplest way
+ // to do so is to have the delegate owned by a KeyedService.)
+ scoped_ptr<WifiConfigDelegate> BuildInstanceFor(
+ content::BrowserContext* browser_context);
+
+ private:
+ friend struct DefaultSingletonTraits<WifiConfigDelegateFactoryChromeOs>;
+
+ WifiConfigDelegateFactoryChromeOs();
+ ~WifiConfigDelegateFactoryChromeOs();
+
+ // Whether or not we should use chromeos::LoginState to map
+ // content::BrowserContexts to ChromeOS network profiles.
+ bool use_login_state_;
+
+ DISALLOW_COPY_AND_ASSIGN(WifiConfigDelegateFactoryChromeOs);
+};
+
+} // namespace wifi_sync
+
+#endif // COMPONENTS_WIFI_SYNC_WIFI_CONFIG_DELEGATE_FACTORY_CHROMEOS_H_

Powered by Google App Engine
This is Rietveld 408576698