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 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 bool write_success = base::JSONWriter::Write(extras, &extras_json); | 467 bool write_success = base::JSONWriter::Write(extras, &extras_json); |
468 DCHECK(write_success); | 468 DCHECK(write_success); |
469 | 469 |
470 instance->SendBroadcast(action, "org.chromium.arc.intent_helper", | 470 instance->SendBroadcast(action, "org.chromium.arc.intent_helper", |
471 "org.chromium.arc.intent_helper.SettingsReceiver", | 471 "org.chromium.arc.intent_helper.SettingsReceiver", |
472 extras_json); | 472 extras_json); |
473 } | 473 } |
474 | 474 |
475 void ArcSettingsServiceImpl::DefaultNetworkChanged( | 475 void ArcSettingsServiceImpl::DefaultNetworkChanged( |
476 const chromeos::NetworkState* network) { | 476 const chromeos::NetworkState* network) { |
477 // kProxy pref and ONC policy have more priority than the default network | 477 // kProxy pref has more priority than the default network update. |
478 // update. | 478 // If a default network is changed to the network with ONC policy with proxy |
479 Profile* profile = ProfileManager::GetActiveUserProfile(); | 479 // settings, it should be translated here. |
480 if (network && !IsPrefProxyConfigApplied() && | 480 if (network && !IsPrefProxyConfigApplied()) |
481 !chromeos::onc::HasPolicyForNetwork( | |
482 profile->GetPrefs(), g_browser_process->local_state(), *network)) { | |
483 SyncProxySettings(); | 481 SyncProxySettings(); |
484 } | |
485 } | 482 } |
486 | 483 |
487 ArcSettingsService::ArcSettingsService(ArcBridgeService* bridge_service) | 484 ArcSettingsService::ArcSettingsService(ArcBridgeService* bridge_service) |
488 : ArcService(bridge_service) { | 485 : ArcService(bridge_service) { |
489 arc_bridge_service()->intent_helper()->AddObserver(this); | 486 arc_bridge_service()->intent_helper()->AddObserver(this); |
490 } | 487 } |
491 | 488 |
492 ArcSettingsService::~ArcSettingsService() { | 489 ArcSettingsService::~ArcSettingsService() { |
493 arc_bridge_service()->intent_helper()->RemoveObserver(this); | 490 arc_bridge_service()->intent_helper()->RemoveObserver(this); |
494 } | 491 } |
495 | 492 |
496 void ArcSettingsService::OnInstanceReady() { | 493 void ArcSettingsService::OnInstanceReady() { |
497 impl_.reset(new ArcSettingsServiceImpl(arc_bridge_service())); | 494 impl_.reset(new ArcSettingsServiceImpl(arc_bridge_service())); |
498 } | 495 } |
499 | 496 |
500 void ArcSettingsService::OnInstanceClosed() { | 497 void ArcSettingsService::OnInstanceClosed() { |
501 impl_.reset(); | 498 impl_.reset(); |
502 } | 499 } |
503 | 500 |
504 } // namespace arc | 501 } // namespace arc |
OLD | NEW |