| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "chrome/browser/chromeos/arc/intent_helper/arc_settings_service.h" | 5 #include "chrome/browser/chromeos/arc/intent_helper/arc_settings_service.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/gtest_prod_util.h" | 9 #include "base/gtest_prod_util.h" |
| 10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 } | 58 } |
| 59 if (!proxy_list || proxy_list->IsEmpty()) | 59 if (!proxy_list || proxy_list->IsEmpty()) |
| 60 return false; | 60 return false; |
| 61 | 61 |
| 62 const net::ProxyServer& server = proxy_list->Get(); | 62 const net::ProxyServer& server = proxy_list->Get(); |
| 63 *host = server.host_port_pair().host(); | 63 *host = server.host_port_pair().host(); |
| 64 *port = server.host_port_pair().port(); | 64 *port = server.host_port_pair().port(); |
| 65 return !host->empty() && *port; | 65 return !host->empty() && *port; |
| 66 } | 66 } |
| 67 | 67 |
| 68 PrefService* GetPrefs() { |
| 69 return ProfileManager::GetActiveUserProfile()->GetPrefs(); |
| 70 } |
| 71 |
| 68 // Returns whether kProxy pref proxy config is applied. | 72 // Returns whether kProxy pref proxy config is applied. |
| 69 bool IsPrefProxyConfigApplied() { | 73 bool IsPrefProxyConfigApplied() { |
| 70 net::ProxyConfig config; | 74 net::ProxyConfig config; |
| 71 Profile* profile = ProfileManager::GetActiveUserProfile(); | |
| 72 return PrefProxyConfigTrackerImpl::PrefPrecedes( | 75 return PrefProxyConfigTrackerImpl::PrefPrecedes( |
| 73 PrefProxyConfigTrackerImpl::ReadPrefConfig(profile->GetPrefs(), &config)); | 76 PrefProxyConfigTrackerImpl::ReadPrefConfig(GetPrefs(), &config)); |
| 74 } | 77 } |
| 75 | 78 |
| 76 } // namespace | 79 } // namespace |
| 77 | 80 |
| 78 namespace arc { | 81 namespace arc { |
| 79 | 82 |
| 80 // Listens to changes for select Chrome settings (prefs) that Android cares | 83 // Listens to changes for select Chrome settings (prefs) that Android cares |
| 81 // about and sends the new values to Android to keep the state in sync. | 84 // about and sends the new values to Android to keep the state in sync. |
| 82 class ArcSettingsServiceImpl | 85 class ArcSettingsServiceImpl |
| 83 : public chromeos::system::TimezoneSettings::Observer, | 86 : public chromeos::system::TimezoneSettings::Observer, |
| (...skipping 21 matching lines...) Expand all Loading... |
| 105 // NetworkStateHandlerObserver: | 108 // NetworkStateHandlerObserver: |
| 106 void DefaultNetworkChanged(const chromeos::NetworkState* network) override; | 109 void DefaultNetworkChanged(const chromeos::NetworkState* network) override; |
| 107 | 110 |
| 108 private: | 111 private: |
| 109 // Registers to observe changes for Chrome settings we care about. | 112 // Registers to observe changes for Chrome settings we care about. |
| 110 void StartObservingSettingsChanges(); | 113 void StartObservingSettingsChanges(); |
| 111 | 114 |
| 112 // Stops listening for Chrome settings changes. | 115 // Stops listening for Chrome settings changes. |
| 113 void StopObservingSettingsChanges(); | 116 void StopObservingSettingsChanges(); |
| 114 | 117 |
| 118 // Retrieves Chrome's state for the settings that need to be synced on the |
| 119 // initial Android boot and send it to Android. |
| 120 void SyncInitialSettings() const; |
| 115 // Retrieves Chrome's state for the settings that need to be synced on each | 121 // Retrieves Chrome's state for the settings that need to be synced on each |
| 116 // Android boot and send it to Android. | 122 // Android boot and send it to Android. |
| 117 void SyncRuntimeSettings() const; | 123 void SyncRuntimeSettings() const; |
| 118 // Send settings that need to be synced only on Android first start to | 124 // Determine whether a particular setting needs to be synced to Android. |
| 119 // Android. | 125 // Keep these lines ordered lexicographically. |
| 126 bool ShouldSyncBackupEnabled() const; |
| 127 bool ShouldSyncLocationServiceEnabled() const; |
| 128 // Send particular settings to Android. |
| 120 // Keep these lines ordered lexicographically. | 129 // Keep these lines ordered lexicographically. |
| 121 void SyncAccessibilityLargeMouseCursorEnabled() const; | 130 void SyncAccessibilityLargeMouseCursorEnabled() const; |
| 122 void SyncAccessibilityVirtualKeyboardEnabled() const; | 131 void SyncAccessibilityVirtualKeyboardEnabled() const; |
| 123 void SyncBackupEnabled() const; | 132 void SyncBackupEnabled() const; |
| 124 void SyncFocusHighlightEnabled() const; | 133 void SyncFocusHighlightEnabled() const; |
| 125 void SyncFontSize() const; | 134 void SyncFontSize() const; |
| 126 void SyncInitialSettings() const; | |
| 127 void SyncLocale() const; | 135 void SyncLocale() const; |
| 128 void SyncLocationServiceEnabled() const; | 136 void SyncLocationServiceEnabled() const; |
| 129 void SyncProxySettings() const; | 137 void SyncProxySettings() const; |
| 130 void SyncReportingConsent() const; | 138 void SyncReportingConsent() const; |
| 131 void SyncSpokenFeedbackEnabled() const; | 139 void SyncSpokenFeedbackEnabled() const; |
| 132 void SyncTimeZone() const; | 140 void SyncTimeZone() const; |
| 133 void SyncUse24HourClock() const; | 141 void SyncUse24HourClock() const; |
| 134 | 142 |
| 135 void OnBluetoothAdapterInitialized( | 143 void OnBluetoothAdapterInitialized( |
| 136 scoped_refptr<device::BluetoothAdapter> adapter); | 144 scoped_refptr<device::BluetoothAdapter> adapter); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 } | 205 } |
| 198 SyncProxySettings(); | 206 SyncProxySettings(); |
| 199 } else if (pref_name == prefs::kAccessibilityFocusHighlightEnabled) { | 207 } else if (pref_name == prefs::kAccessibilityFocusHighlightEnabled) { |
| 200 SyncFocusHighlightEnabled(); | 208 SyncFocusHighlightEnabled(); |
| 201 } else if (pref_name == prefs::kAccessibilityLargeCursorEnabled) { | 209 } else if (pref_name == prefs::kAccessibilityLargeCursorEnabled) { |
| 202 SyncAccessibilityLargeMouseCursorEnabled(); | 210 SyncAccessibilityLargeMouseCursorEnabled(); |
| 203 } else if (pref_name == prefs::kAccessibilitySpokenFeedbackEnabled) { | 211 } else if (pref_name == prefs::kAccessibilitySpokenFeedbackEnabled) { |
| 204 SyncSpokenFeedbackEnabled(); | 212 SyncSpokenFeedbackEnabled(); |
| 205 } else if (pref_name == prefs::kAccessibilityVirtualKeyboardEnabled) { | 213 } else if (pref_name == prefs::kAccessibilityVirtualKeyboardEnabled) { |
| 206 SyncAccessibilityVirtualKeyboardEnabled(); | 214 SyncAccessibilityVirtualKeyboardEnabled(); |
| 215 } else if (pref_name == prefs::kArcBackupRestoreEnabled) { |
| 216 if (ShouldSyncBackupEnabled()) |
| 217 SyncBackupEnabled(); |
| 207 } else if (pref_name == prefs::kArcLocationServiceEnabled) { | 218 } else if (pref_name == prefs::kArcLocationServiceEnabled) { |
| 208 const PrefService* const prefs = | 219 if (ShouldSyncLocationServiceEnabled()) |
| 209 ProfileManager::GetActiveUserProfile()->GetPrefs(); | |
| 210 if (prefs->IsManagedPreference(prefs::kArcLocationServiceEnabled)) | |
| 211 SyncLocationServiceEnabled(); | 220 SyncLocationServiceEnabled(); |
| 212 } else if (pref_name == prefs::kUse24HourClock) { | 221 } else if (pref_name == prefs::kUse24HourClock) { |
| 213 SyncUse24HourClock(); | 222 SyncUse24HourClock(); |
| 214 } else if (pref_name == prefs::kWebKitDefaultFixedFontSize || | 223 } else if (pref_name == prefs::kWebKitDefaultFixedFontSize || |
| 215 pref_name == prefs::kWebKitDefaultFontSize || | 224 pref_name == prefs::kWebKitDefaultFontSize || |
| 216 pref_name == prefs::kWebKitMinimumFontSize) { | 225 pref_name == prefs::kWebKitMinimumFontSize) { |
| 217 SyncFontSize(); | 226 SyncFontSize(); |
| 218 } else if (pref_name == proxy_config::prefs::kProxy) { | 227 } else if (pref_name == proxy_config::prefs::kProxy) { |
| 219 SyncProxySettings(); | 228 SyncProxySettings(); |
| 220 } else { | 229 } else { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 242 void ArcSettingsServiceImpl::DefaultNetworkChanged( | 251 void ArcSettingsServiceImpl::DefaultNetworkChanged( |
| 243 const chromeos::NetworkState* network) { | 252 const chromeos::NetworkState* network) { |
| 244 // kProxy pref has more priority than the default network update. | 253 // kProxy pref has more priority than the default network update. |
| 245 // If a default network is changed to the network with ONC policy with proxy | 254 // If a default network is changed to the network with ONC policy with proxy |
| 246 // settings, it should be translated here. | 255 // settings, it should be translated here. |
| 247 if (network && !IsPrefProxyConfigApplied()) | 256 if (network && !IsPrefProxyConfigApplied()) |
| 248 SyncProxySettings(); | 257 SyncProxySettings(); |
| 249 } | 258 } |
| 250 | 259 |
| 251 void ArcSettingsServiceImpl::StartObservingSettingsChanges() { | 260 void ArcSettingsServiceImpl::StartObservingSettingsChanges() { |
| 252 Profile* profile = ProfileManager::GetActiveUserProfile(); | 261 registrar_.Init(GetPrefs()); |
| 253 registrar_.Init(profile->GetPrefs()); | |
| 254 | 262 |
| 255 // Keep these lines ordered lexicographically. | 263 // Keep these lines ordered lexicographically. |
| 256 AddPrefToObserve(prefs::kAccessibilityFocusHighlightEnabled); | 264 AddPrefToObserve(prefs::kAccessibilityFocusHighlightEnabled); |
| 257 AddPrefToObserve(prefs::kAccessibilityLargeCursorEnabled); | 265 AddPrefToObserve(prefs::kAccessibilityLargeCursorEnabled); |
| 258 AddPrefToObserve(prefs::kAccessibilitySpokenFeedbackEnabled); | 266 AddPrefToObserve(prefs::kAccessibilitySpokenFeedbackEnabled); |
| 259 AddPrefToObserve(prefs::kAccessibilityVirtualKeyboardEnabled); | 267 AddPrefToObserve(prefs::kAccessibilityVirtualKeyboardEnabled); |
| 260 AddPrefToObserve(prefs::kArcBackupRestoreEnabled); | 268 AddPrefToObserve(prefs::kArcBackupRestoreEnabled); |
| 261 AddPrefToObserve(prefs::kArcLocationServiceEnabled); | 269 AddPrefToObserve(prefs::kArcLocationServiceEnabled); |
| 262 AddPrefToObserve(prefs::kUse24HourClock); | 270 AddPrefToObserve(prefs::kUse24HourClock); |
| 263 AddPrefToObserve(prefs::kWebKitDefaultFixedFontSize); | 271 AddPrefToObserve(prefs::kWebKitDefaultFixedFontSize); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 286 | 294 |
| 287 void ArcSettingsServiceImpl::StopObservingSettingsChanges() { | 295 void ArcSettingsServiceImpl::StopObservingSettingsChanges() { |
| 288 registrar_.RemoveAll(); | 296 registrar_.RemoveAll(); |
| 289 reporting_consent_subscription_.reset(); | 297 reporting_consent_subscription_.reset(); |
| 290 | 298 |
| 291 TimezoneSettings::GetInstance()->RemoveObserver(this); | 299 TimezoneSettings::GetInstance()->RemoveObserver(this); |
| 292 chromeos::NetworkHandler::Get()->network_state_handler()->RemoveObserver( | 300 chromeos::NetworkHandler::Get()->network_state_handler()->RemoveObserver( |
| 293 this, FROM_HERE); | 301 this, FROM_HERE); |
| 294 } | 302 } |
| 295 | 303 |
| 304 void ArcSettingsServiceImpl::SyncInitialSettings() const { |
| 305 // Keep these lines ordered lexicographically. |
| 306 SyncBackupEnabled(); |
| 307 SyncLocationServiceEnabled(); |
| 308 } |
| 309 |
| 296 void ArcSettingsServiceImpl::SyncRuntimeSettings() const { | 310 void ArcSettingsServiceImpl::SyncRuntimeSettings() const { |
| 297 // Keep these lines ordered lexicographically. | 311 // Keep these lines ordered lexicographically. |
| 298 SyncAccessibilityLargeMouseCursorEnabled(); | 312 SyncAccessibilityLargeMouseCursorEnabled(); |
| 299 SyncAccessibilityVirtualKeyboardEnabled(); | 313 SyncAccessibilityVirtualKeyboardEnabled(); |
| 300 SyncFocusHighlightEnabled(); | 314 SyncFocusHighlightEnabled(); |
| 301 SyncFontSize(); | 315 SyncFontSize(); |
| 302 SyncLocale(); | 316 SyncLocale(); |
| 303 SyncProxySettings(); | 317 SyncProxySettings(); |
| 304 SyncReportingConsent(); | 318 SyncReportingConsent(); |
| 305 SyncSpokenFeedbackEnabled(); | 319 SyncSpokenFeedbackEnabled(); |
| 306 SyncTimeZone(); | 320 SyncTimeZone(); |
| 307 SyncUse24HourClock(); | 321 SyncUse24HourClock(); |
| 308 | 322 |
| 309 const PrefService* const prefs = | 323 if (ShouldSyncBackupEnabled()) |
| 310 ProfileManager::GetActiveUserProfile()->GetPrefs(); | |
| 311 if (prefs->IsManagedPreference(prefs::kArcBackupRestoreEnabled)) | |
| 312 SyncBackupEnabled(); | 324 SyncBackupEnabled(); |
| 313 if (prefs->IsManagedPreference(prefs::kArcLocationServiceEnabled)) | 325 if (ShouldSyncLocationServiceEnabled()) |
| 314 SyncLocationServiceEnabled(); | 326 SyncLocationServiceEnabled(); |
| 315 } | 327 } |
| 316 | 328 |
| 329 bool ArcSettingsServiceImpl::ShouldSyncBackupEnabled() const { |
| 330 // Always sync the managed setting. Also sync when the pref is unset, which |
| 331 // normally happens once after the pref changes from the managed state to |
| 332 // unmanaged. |
| 333 return GetPrefs()->IsManagedPreference(prefs::kArcBackupRestoreEnabled) || |
| 334 !GetPrefs()->HasPrefPath(prefs::kArcBackupRestoreEnabled); |
| 335 } |
| 336 |
| 337 bool ArcSettingsServiceImpl::ShouldSyncLocationServiceEnabled() const { |
| 338 // Always sync the managed setting. Also sync when the pref is unset, which |
| 339 // normally happens once after the pref changes from the managed state to |
| 340 // unmanaged. |
| 341 return GetPrefs()->IsManagedPreference(prefs::kArcLocationServiceEnabled) || |
| 342 !GetPrefs()->HasPrefPath(prefs::kArcLocationServiceEnabled); |
| 343 } |
| 344 |
| 317 void ArcSettingsServiceImpl::SyncAccessibilityLargeMouseCursorEnabled() const { | 345 void ArcSettingsServiceImpl::SyncAccessibilityLargeMouseCursorEnabled() const { |
| 318 SendBoolPrefSettingsBroadcast( | 346 SendBoolPrefSettingsBroadcast( |
| 319 prefs::kAccessibilityLargeCursorEnabled, | 347 prefs::kAccessibilityLargeCursorEnabled, |
| 320 "org.chromium.arc.intent_helper.ACCESSIBILITY_LARGE_POINTER_ICON"); | 348 "org.chromium.arc.intent_helper.ACCESSIBILITY_LARGE_POINTER_ICON"); |
| 321 } | 349 } |
| 322 | 350 |
| 323 void ArcSettingsServiceImpl::SyncAccessibilityVirtualKeyboardEnabled() const { | 351 void ArcSettingsServiceImpl::SyncAccessibilityVirtualKeyboardEnabled() const { |
| 324 SendBoolPrefSettingsBroadcast( | 352 SendBoolPrefSettingsBroadcast( |
| 325 prefs::kAccessibilityVirtualKeyboardEnabled, | 353 prefs::kAccessibilityVirtualKeyboardEnabled, |
| 326 "org.chromium.arc.intent_helper.SET_SHOW_IME_WITH_HARD_KEYBOARD"); | 354 "org.chromium.arc.intent_helper.SET_SHOW_IME_WITH_HARD_KEYBOARD"); |
| 327 } | 355 } |
| 328 | 356 |
| 329 void ArcSettingsServiceImpl::SyncBackupEnabled() const { | 357 void ArcSettingsServiceImpl::SyncBackupEnabled() const { |
| 330 SendBoolPrefSettingsBroadcast( | 358 SendBoolPrefSettingsBroadcast( |
| 331 prefs::kArcBackupRestoreEnabled, | 359 prefs::kArcBackupRestoreEnabled, |
| 332 "org.chromium.arc.intent_helper.SET_BACKUP_ENABLED"); | 360 "org.chromium.arc.intent_helper.SET_BACKUP_ENABLED"); |
| 361 if (GetPrefs()->IsManagedPreference(prefs::kArcBackupRestoreEnabled)) { |
| 362 // Unset the user pref so that if the pref becomes unmanaged at some point, |
| 363 // this change will be synced. |
| 364 GetPrefs()->ClearPref(prefs::kArcBackupRestoreEnabled); |
| 365 } else if (!GetPrefs()->HasPrefPath(prefs::kArcBackupRestoreEnabled)) { |
| 366 // Set the pref value in order to prevent the subsequent syncing. The |
| 367 // "false" value is a safe default from the legal/privacy perspective. |
| 368 GetPrefs()->SetBoolean(prefs::kArcBackupRestoreEnabled, false); |
| 369 } |
| 333 } | 370 } |
| 334 | 371 |
| 335 void ArcSettingsServiceImpl::SyncFocusHighlightEnabled() const { | 372 void ArcSettingsServiceImpl::SyncFocusHighlightEnabled() const { |
| 336 SendBoolPrefSettingsBroadcast( | 373 SendBoolPrefSettingsBroadcast( |
| 337 prefs::kAccessibilityFocusHighlightEnabled, | 374 prefs::kAccessibilityFocusHighlightEnabled, |
| 338 "org.chromium.arc.intent_helper.SET_FOCUS_HIGHLIGHT_ENABLED"); | 375 "org.chromium.arc.intent_helper.SET_FOCUS_HIGHLIGHT_ENABLED"); |
| 339 } | 376 } |
| 340 | 377 |
| 341 void ArcSettingsServiceImpl::SyncFontSize() const { | 378 void ArcSettingsServiceImpl::SyncFontSize() const { |
| 342 int default_size = GetIntegerPref(prefs::kWebKitDefaultFontSize); | 379 int default_size = GetIntegerPref(prefs::kWebKitDefaultFontSize); |
| 343 int default_fixed_size = GetIntegerPref(prefs::kWebKitDefaultFixedFontSize); | 380 int default_fixed_size = GetIntegerPref(prefs::kWebKitDefaultFixedFontSize); |
| 344 int minimum_size = GetIntegerPref(prefs::kWebKitMinimumFontSize); | 381 int minimum_size = GetIntegerPref(prefs::kWebKitMinimumFontSize); |
| 345 | 382 |
| 346 double android_scale = ConvertFontSizeChromeToAndroid( | 383 double android_scale = ConvertFontSizeChromeToAndroid( |
| 347 default_size, default_fixed_size, minimum_size); | 384 default_size, default_fixed_size, minimum_size); |
| 348 | 385 |
| 349 base::DictionaryValue extras; | 386 base::DictionaryValue extras; |
| 350 extras.SetDouble("scale", android_scale); | 387 extras.SetDouble("scale", android_scale); |
| 351 SendSettingsBroadcast("org.chromium.arc.intent_helper.SET_FONT_SCALE", | 388 SendSettingsBroadcast("org.chromium.arc.intent_helper.SET_FONT_SCALE", |
| 352 extras); | 389 extras); |
| 353 } | 390 } |
| 354 | 391 |
| 355 void ArcSettingsServiceImpl::SyncInitialSettings() const { | |
| 356 SyncBackupEnabled(); | |
| 357 SyncLocationServiceEnabled(); | |
| 358 } | |
| 359 | |
| 360 void ArcSettingsServiceImpl::SyncLocale() const { | 392 void ArcSettingsServiceImpl::SyncLocale() const { |
| 361 const PrefService::Preference* pref = | 393 const PrefService::Preference* pref = |
| 362 registrar_.prefs()->FindPreference(prefs::kApplicationLocale); | 394 registrar_.prefs()->FindPreference(prefs::kApplicationLocale); |
| 363 DCHECK(pref); | 395 DCHECK(pref); |
| 364 std::string locale; | 396 std::string locale; |
| 365 bool value_exists = pref->GetValue()->GetAsString(&locale); | 397 bool value_exists = pref->GetValue()->GetAsString(&locale); |
| 366 DCHECK(value_exists); | 398 DCHECK(value_exists); |
| 367 base::DictionaryValue extras; | 399 base::DictionaryValue extras; |
| 368 extras.SetString("locale", locale); | 400 extras.SetString("locale", locale); |
| 369 SendSettingsBroadcast("org.chromium.arc.intent_helper.SET_LOCALE", extras); | 401 SendSettingsBroadcast("org.chromium.arc.intent_helper.SET_LOCALE", extras); |
| 370 } | 402 } |
| 371 | 403 |
| 372 void ArcSettingsServiceImpl::SyncLocationServiceEnabled() const { | 404 void ArcSettingsServiceImpl::SyncLocationServiceEnabled() const { |
| 373 SendBoolPrefSettingsBroadcast( | 405 SendBoolPrefSettingsBroadcast( |
| 374 prefs::kArcLocationServiceEnabled, | 406 prefs::kArcLocationServiceEnabled, |
| 375 "org.chromium.arc.intent_helper.SET_LOCATION_SERVICE_ENABLED"); | 407 "org.chromium.arc.intent_helper.SET_LOCATION_SERVICE_ENABLED"); |
| 408 if (GetPrefs()->IsManagedPreference(prefs::kArcLocationServiceEnabled)) { |
| 409 // Unset the user pref so that if the pref becomes unmanaged at some point, |
| 410 // this change will be synced. |
| 411 GetPrefs()->ClearPref(prefs::kArcLocationServiceEnabled); |
| 412 } else if (!GetPrefs()->HasPrefPath(prefs::kArcLocationServiceEnabled)) { |
| 413 // Set the pref value in order to prevent the subsequent syncing. The |
| 414 // "false" value is a safe default from the legal/privacy perspective. |
| 415 GetPrefs()->SetBoolean(prefs::kArcLocationServiceEnabled, false); |
| 416 } |
| 376 } | 417 } |
| 377 | 418 |
| 378 void ArcSettingsServiceImpl::SyncProxySettings() const { | 419 void ArcSettingsServiceImpl::SyncProxySettings() const { |
| 379 std::unique_ptr<ProxyConfigDictionary> proxy_config_dict = | 420 std::unique_ptr<ProxyConfigDictionary> proxy_config_dict = |
| 380 chromeos::ProxyConfigServiceImpl::GetActiveProxyConfigDictionary( | 421 chromeos::ProxyConfigServiceImpl::GetActiveProxyConfigDictionary( |
| 381 ProfileManager::GetActiveUserProfile()->GetPrefs(), | 422 GetPrefs(), g_browser_process->local_state()); |
| 382 g_browser_process->local_state()); | |
| 383 if (!proxy_config_dict) | 423 if (!proxy_config_dict) |
| 384 return; | 424 return; |
| 385 | 425 |
| 386 ProxyPrefs::ProxyMode mode; | 426 ProxyPrefs::ProxyMode mode; |
| 387 if (!proxy_config_dict || !proxy_config_dict->GetMode(&mode)) | 427 if (!proxy_config_dict || !proxy_config_dict->GetMode(&mode)) |
| 388 mode = ProxyPrefs::MODE_DIRECT; | 428 mode = ProxyPrefs::MODE_DIRECT; |
| 389 | 429 |
| 390 base::DictionaryValue extras; | 430 base::DictionaryValue extras; |
| 391 extras.SetString("mode", ProxyPrefs::ProxyModeToString(mode)); | 431 extras.SetString("mode", ProxyPrefs::ProxyModeToString(mode)); |
| 392 | 432 |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 535 | 575 |
| 536 void ArcSettingsService::OnInstanceReady() { | 576 void ArcSettingsService::OnInstanceReady() { |
| 537 impl_.reset(new ArcSettingsServiceImpl(arc_bridge_service())); | 577 impl_.reset(new ArcSettingsServiceImpl(arc_bridge_service())); |
| 538 } | 578 } |
| 539 | 579 |
| 540 void ArcSettingsService::OnInstanceClosed() { | 580 void ArcSettingsService::OnInstanceClosed() { |
| 541 impl_.reset(); | 581 impl_.reset(); |
| 542 } | 582 } |
| 543 | 583 |
| 544 } // namespace arc | 584 } // namespace arc |
| OLD | NEW |