OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 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 COMPONENTS_WIFI_SYNC_WIFI_CONFIG_DELEGATE_FACTORY_CHROMEOS_H_ |
| 6 #define COMPONENTS_WIFI_SYNC_WIFI_CONFIG_DELEGATE_FACTORY_CHROMEOS_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 #include "base/memory/scoped_ptr.h" |
| 10 |
| 11 template <typename T> struct DefaultSingletonTraits; |
| 12 |
| 13 namespace content { |
| 14 class BrowserContext; |
| 15 } |
| 16 |
| 17 namespace wifi_sync { |
| 18 |
| 19 class WifiConfigDelegate; |
| 20 |
| 21 // Singleton that creates WifiConfigDelegateChromeOs instances. |
| 22 // Ownership of the created instance is passed to the caller of |
| 23 // BuildInstanceFor. |
| 24 class WifiConfigDelegateFactoryChromeOs { |
| 25 public: |
| 26 // Returns the singleton instance. |
| 27 static WifiConfigDelegateFactoryChromeOs* GetInstance(); |
| 28 |
| 29 // Configures whether the factory will use chromeos::LoginState to |
| 30 // determine the ChromeOS network profile that corresponds to a |
| 31 // content::BrowserContext. If it is not possible to control |
| 32 // LoginState when WifiCredentialSyncableServices are created (such |
| 33 // as in some tests), call this method with false. |
| 34 void SetUseLoginState(bool use_login_state); |
| 35 // Returns a new WifiConfigDelegate, which will make changes to the |
| 36 // ChromeOS network profile corresponding to |browser_context|. The |
| 37 // caller must ensure that the returned delegate does not outlive |
| 38 // the chromeos::internal::DBusServices singleton. (The simplest way |
| 39 // to do so is to have the delegate owned by a KeyedService.) |
| 40 scoped_ptr<WifiConfigDelegate> BuildInstanceFor( |
| 41 content::BrowserContext* browser_context); |
| 42 |
| 43 private: |
| 44 friend struct DefaultSingletonTraits<WifiConfigDelegateFactoryChromeOs>; |
| 45 |
| 46 WifiConfigDelegateFactoryChromeOs(); |
| 47 ~WifiConfigDelegateFactoryChromeOs(); |
| 48 |
| 49 // Whether or not we should use chromeos::LoginState to map |
| 50 // content::BrowserContexts to ChromeOS network profiles. |
| 51 bool use_login_state_; |
| 52 |
| 53 DISALLOW_COPY_AND_ASSIGN(WifiConfigDelegateFactoryChromeOs); |
| 54 }; |
| 55 |
| 56 } // namespace wifi_sync |
| 57 |
| 58 #endif // COMPONENTS_WIFI_SYNC_WIFI_CONFIG_DELEGATE_FACTORY_CHROMEOS_H_ |
OLD | NEW |