| 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 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 LOG(ERROR) << "Incorrect proxy mode."; | 358 LOG(ERROR) << "Incorrect proxy mode."; |
| 359 return; | 359 return; |
| 360 } | 360 } |
| 361 | 361 |
| 362 SendSettingsBroadcast("org.chromium.arc.intent_helper.SET_PROXY", extras); | 362 SendSettingsBroadcast("org.chromium.arc.intent_helper.SET_PROXY", extras); |
| 363 } | 363 } |
| 364 | 364 |
| 365 void ArcSettingsServiceImpl::SendSettingsBroadcast( | 365 void ArcSettingsServiceImpl::SendSettingsBroadcast( |
| 366 const std::string& action, | 366 const std::string& action, |
| 367 const base::DictionaryValue& extras) const { | 367 const base::DictionaryValue& extras) const { |
| 368 if (!arc_bridge_service_->intent_helper_instance()) { | 368 if (!arc_bridge_service_->intent_helper()->instance()) { |
| 369 LOG(ERROR) << "IntentHelper instance is not ready."; | 369 LOG(ERROR) << "IntentHelper instance is not ready."; |
| 370 return; | 370 return; |
| 371 } | 371 } |
| 372 | 372 |
| 373 std::string extras_json; | 373 std::string extras_json; |
| 374 bool write_success = base::JSONWriter::Write(extras, &extras_json); | 374 bool write_success = base::JSONWriter::Write(extras, &extras_json); |
| 375 DCHECK(write_success); | 375 DCHECK(write_success); |
| 376 | 376 |
| 377 if (arc_bridge_service_->intent_helper_version() >= 1) { | 377 if (arc_bridge_service_->intent_helper()->version() >= 1) { |
| 378 arc_bridge_service_->intent_helper_instance()->SendBroadcast( | 378 arc_bridge_service_->intent_helper()->instance()->SendBroadcast( |
| 379 action, "org.chromium.arc.intent_helper", | 379 action, "org.chromium.arc.intent_helper", |
| 380 "org.chromium.arc.intent_helper.SettingsReceiver", extras_json); | 380 "org.chromium.arc.intent_helper.SettingsReceiver", extras_json); |
| 381 } | 381 } |
| 382 } | 382 } |
| 383 | 383 |
| 384 ArcSettingsService::ArcSettingsService(ArcBridgeService* bridge_service) | 384 ArcSettingsService::ArcSettingsService(ArcBridgeService* bridge_service) |
| 385 : ArcService(bridge_service) { | 385 : ArcService(bridge_service) { |
| 386 arc_bridge_service()->AddObserver(this); | 386 arc_bridge_service()->intent_helper()->AddObserver(this); |
| 387 } | 387 } |
| 388 | 388 |
| 389 ArcSettingsService::~ArcSettingsService() { | 389 ArcSettingsService::~ArcSettingsService() { |
| 390 arc_bridge_service()->RemoveObserver(this); | 390 arc_bridge_service()->intent_helper()->RemoveObserver(this); |
| 391 } | 391 } |
| 392 | 392 |
| 393 void ArcSettingsService::OnIntentHelperInstanceReady() { | 393 void ArcSettingsService::OnInstanceReady() { |
| 394 impl_.reset(new ArcSettingsServiceImpl(arc_bridge_service())); | 394 impl_.reset(new ArcSettingsServiceImpl(arc_bridge_service())); |
| 395 } | 395 } |
| 396 | 396 |
| 397 void ArcSettingsService::OnIntentHelperInstanceClosed() { | 397 void ArcSettingsService::OnInstanceClosed() { |
| 398 impl_.reset(); | 398 impl_.reset(); |
| 399 } | 399 } |
| 400 | 400 |
| 401 } // namespace arc | 401 } // namespace arc |
| OLD | NEW |