| 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/arc_settings_service.h" | 5 #include "chrome/browser/chromeos/arc/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 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 instance->SendBroadcast(action, "org.chromium.arc.intent_helper", | 469 instance->SendBroadcast(action, "org.chromium.arc.intent_helper", |
| 470 "org.chromium.arc.intent_helper.SettingsReceiver", | 470 "org.chromium.arc.intent_helper.SettingsReceiver", |
| 471 extras_json); | 471 extras_json); |
| 472 } | 472 } |
| 473 | 473 |
| 474 void ArcSettingsServiceImpl::DefaultNetworkChanged( | 474 void ArcSettingsServiceImpl::DefaultNetworkChanged( |
| 475 const chromeos::NetworkState* network) { | 475 const chromeos::NetworkState* network) { |
| 476 // kProxy pref and ONC policy have more priority than the default network | 476 // kProxy pref and ONC policy have more priority than the default network |
| 477 // update. | 477 // update. |
| 478 Profile* profile = ProfileManager::GetActiveUserProfile(); | 478 Profile* profile = ProfileManager::GetActiveUserProfile(); |
| 479 if (!chromeos::onc::HasPolicyForNetwork( | 479 if (network && !IsPrefProxyConfigApplied() && |
| 480 profile->GetPrefs(), g_browser_process->local_state(), *network) && | 480 !chromeos::onc::HasPolicyForNetwork( |
| 481 !IsPrefProxyConfigApplied()) { | 481 profile->GetPrefs(), g_browser_process->local_state(), *network)) { |
| 482 SyncProxySettings(); | 482 SyncProxySettings(); |
| 483 } | 483 } |
| 484 } | 484 } |
| 485 | 485 |
| 486 ArcSettingsService::ArcSettingsService(ArcBridgeService* bridge_service) | 486 ArcSettingsService::ArcSettingsService(ArcBridgeService* bridge_service) |
| 487 : ArcService(bridge_service) { | 487 : ArcService(bridge_service) { |
| 488 arc_bridge_service()->intent_helper()->AddObserver(this); | 488 arc_bridge_service()->intent_helper()->AddObserver(this); |
| 489 } | 489 } |
| 490 | 490 |
| 491 ArcSettingsService::~ArcSettingsService() { | 491 ArcSettingsService::~ArcSettingsService() { |
| 492 arc_bridge_service()->intent_helper()->RemoveObserver(this); | 492 arc_bridge_service()->intent_helper()->RemoveObserver(this); |
| 493 } | 493 } |
| 494 | 494 |
| 495 void ArcSettingsService::OnInstanceReady() { | 495 void ArcSettingsService::OnInstanceReady() { |
| 496 impl_.reset(new ArcSettingsServiceImpl(arc_bridge_service())); | 496 impl_.reset(new ArcSettingsServiceImpl(arc_bridge_service())); |
| 497 } | 497 } |
| 498 | 498 |
| 499 void ArcSettingsService::OnInstanceClosed() { | 499 void ArcSettingsService::OnInstanceClosed() { |
| 500 impl_.reset(); | 500 impl_.reset(); |
| 501 } | 501 } |
| 502 | 502 |
| 503 } // namespace arc | 503 } // namespace arc |
| OLD | NEW |