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

Side by Side Diff: components/wifi_sync/wifi_credential_syncable_service_factory.cc

Issue 1426393003: NOT FOR REVIEW Base URL: https://chromium.googlesource.com/chromium/src.git@submit-4.5-split-wcss
Patch Set: Created 5 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/wifi_sync/wifi_credential_syncable_service_factory.h" 5 #include "components/wifi_sync/wifi_credential_syncable_service_factory.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "components/keyed_service/content/browser_context_dependency_manager.h" 11 #include "components/keyed_service/content/browser_context_dependency_manager.h"
12 #include "components/wifi_sync/wifi_config_delegate.h" 12 #include "components/wifi_sync/wifi_config_delegate.h"
13 #include "components/wifi_sync/wifi_credential_syncable_service_impl.h" 13 #include "components/wifi_sync/wifi_credential_syncable_service_impl.h"
14 #include "content/public/browser/browser_context.h" 14 #include "content/public/browser/browser_context.h"
15 15
16 #if defined(OS_CHROMEOS) 16 #if defined(OS_CHROMEOS)
17 #include "base/files/file_path.h" 17 #include "base/files/file_path.h"
18 #include "chromeos/login/login_state.h" 18 #include "chromeos/login/login_state.h"
19 #include "chromeos/network/network_handler.h" 19 #include "chromeos/network/network_handler.h"
20 #include "components/wifi_sync/wifi_config_delegate_chromeos.h" 20 #include "components/wifi_sync/wifi_config_delegate_chromeos.h"
21 #include "components/wifi_sync/wifi_config_observer_chromeos.h"
21 #endif 22 #endif
22 23
23 namespace wifi_sync { 24 namespace wifi_sync {
24 25
25 namespace { 26 namespace {
26 27
27 #if defined(OS_CHROMEOS) 28 #if defined(OS_CHROMEOS)
28 // Returns a string identifying a ChromeOS network settings profile, 29 // Returns a string identifying a ChromeOS network settings profile,
29 // by that profile's UserHash property. This value may be communicated 30 // by that profile's UserHash property. This value may be communicated
30 // to the ChromeOS connection manager ("Shill"), but must not be 31 // to the ChromeOS connection manager ("Shill"), but must not be
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 74
74 WifiCredentialSyncableServiceFactory::~WifiCredentialSyncableServiceFactory() { 75 WifiCredentialSyncableServiceFactory::~WifiCredentialSyncableServiceFactory() {
75 } 76 }
76 77
77 KeyedService* WifiCredentialSyncableServiceFactory::BuildServiceInstanceFor( 78 KeyedService* WifiCredentialSyncableServiceFactory::BuildServiceInstanceFor(
78 content::BrowserContext* context) const { 79 content::BrowserContext* context) const {
79 // TODO(quiche): Figure out if this behaves properly for multi-profile. 80 // TODO(quiche): Figure out if this behaves properly for multi-profile.
80 // crbug.com/430681. 81 // crbug.com/430681.
81 #if defined(OS_CHROMEOS) 82 #if defined(OS_CHROMEOS)
82 return new WifiCredentialSyncableServiceImpl( 83 return new WifiCredentialSyncableServiceImpl(
83 BuildWifiConfigDelegateChromeOs(context)); 84 BuildWifiConfigDelegateChromeOs(context),
85 BuildWifiConfigObserverChromeOs(context));
84 #else 86 #else
85 NOTREACHED(); 87 NOTREACHED();
86 return nullptr; 88 return nullptr;
87 #endif 89 #endif
88 } 90 }
89 91
90 #if defined(OS_CHROMEOS) 92 #if defined(OS_CHROMEOS)
91 scoped_ptr<WifiConfigDelegate> 93 scoped_ptr<WifiConfigDelegate>
92 WifiCredentialSyncableServiceFactory::BuildWifiConfigDelegateChromeOs( 94 WifiCredentialSyncableServiceFactory::BuildWifiConfigDelegateChromeOs(
93 content::BrowserContext* context) const { 95 content::BrowserContext* context) const {
94 // Note: NetworkHandler is a singleton that is managed by 96 // Note: NetworkHandler is a singleton that is managed by
95 // ChromeBrowserMainPartsChromeos, and destroyed after all 97 // ChromeBrowserMainPartsChromeos, and destroyed after all
96 // KeyedService instances are destroyed. 98 // KeyedService instances are destroyed.
97 chromeos::NetworkHandler* network_handler = chromeos::NetworkHandler::Get(); 99 chromeos::NetworkHandler* network_handler = chromeos::NetworkHandler::Get();
98 return make_scoped_ptr(new WifiConfigDelegateChromeOs( 100 return make_scoped_ptr(new WifiConfigDelegateChromeOs(
99 GetUserHash(context, !ignore_login_state_for_test_), 101 GetUserHash(context, !ignore_login_state_for_test_),
100 network_handler->managed_network_configuration_handler())); 102 network_handler->managed_network_configuration_handler()));
101 } 103 }
104
105 scoped_ptr<WifiConfigObserver>
106 WifiCredentialSyncableServiceFactory::BuildWifiConfigObserverChromeOs(
107 content::BrowserContext* context) const {
108 // Note: NetworkHandler is a singleton that is managed by
109 // ChromeBrowserMainPartsChromeos, and destroyed after all
110 // KeyedService instances are destroyed.
111 chromeos::NetworkHandler* network_handler = chromeos::NetworkHandler::Get();
112 return make_scoped_ptr(new WifiConfigObserverChromeOs(
113 GetUserHash(context, !ignore_login_state_for_test_), // XXX
114 network_handler->managed_network_configuration_handler(),
115 network_handler->network_configuration_handler(),
116 network_handler->network_state_handler()));
117 }
102 #endif 118 #endif
103 119
104 } // namespace wifi_sync 120 } // namespace wifi_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698