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_ |