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

Side by Side Diff: chrome/browser/chromeos/arc/arc_settings_service.cc

Issue 2190483003: arc: Revamp the ArcBridgeService interface (Closed) Base URL: https://chromium.googlesource.com/a/chromium/src.git@2785
Patch Set: One less diff line Created 4 years, 4 months 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 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 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 base::DictionaryValue extras; 376 base::DictionaryValue extras;
377 extras.SetBoolean("enabled", enabled); 377 extras.SetBoolean("enabled", enabled);
378 extras.SetBoolean("managed", !pref->IsUserModifiable()); 378 extras.SetBoolean("managed", !pref->IsUserModifiable());
379 SendSettingsBroadcast("org.chromium.arc.intent_helper.SET_BACKUP_ENABLED", 379 SendSettingsBroadcast("org.chromium.arc.intent_helper.SET_BACKUP_ENABLED",
380 extras); 380 extras);
381 } 381 }
382 382
383 void ArcSettingsServiceImpl::SendSettingsBroadcast( 383 void ArcSettingsServiceImpl::SendSettingsBroadcast(
384 const std::string& action, 384 const std::string& action,
385 const base::DictionaryValue& extras) const { 385 const base::DictionaryValue& extras) const {
386 if (!arc_bridge_service_->intent_helper_instance()) { 386 if (!arc_bridge_service_->intent_helper()->instance()) {
387 LOG(ERROR) << "IntentHelper instance is not ready."; 387 LOG(ERROR) << "IntentHelper instance is not ready.";
388 return; 388 return;
389 } 389 }
390 390
391 std::string extras_json; 391 std::string extras_json;
392 bool write_success = base::JSONWriter::Write(extras, &extras_json); 392 bool write_success = base::JSONWriter::Write(extras, &extras_json);
393 DCHECK(write_success); 393 DCHECK(write_success);
394 394
395 if (arc_bridge_service_->intent_helper_version() >= 1) { 395 if (arc_bridge_service_->intent_helper()->version() >= 1) {
396 arc_bridge_service_->intent_helper_instance()->SendBroadcast( 396 arc_bridge_service_->intent_helper()->instance()->SendBroadcast(
397 action, "org.chromium.arc.intent_helper", 397 action, "org.chromium.arc.intent_helper",
398 "org.chromium.arc.intent_helper.SettingsReceiver", extras_json); 398 "org.chromium.arc.intent_helper.SettingsReceiver", extras_json);
399 } 399 }
400 } 400 }
401 401
402 ArcSettingsService::ArcSettingsService(ArcBridgeService* bridge_service) 402 ArcSettingsService::ArcSettingsService(ArcBridgeService* bridge_service)
403 : ArcService(bridge_service) { 403 : ArcService(bridge_service) {
404 arc_bridge_service()->AddObserver(this); 404 arc_bridge_service()->intent_helper()->AddObserver(this);
405 } 405 }
406 406
407 ArcSettingsService::~ArcSettingsService() { 407 ArcSettingsService::~ArcSettingsService() {
408 arc_bridge_service()->RemoveObserver(this); 408 arc_bridge_service()->intent_helper()->RemoveObserver(this);
409 } 409 }
410 410
411 void ArcSettingsService::OnIntentHelperInstanceReady() { 411 void ArcSettingsService::OnInstanceReady() {
412 impl_.reset(new ArcSettingsServiceImpl(arc_bridge_service())); 412 impl_.reset(new ArcSettingsServiceImpl(arc_bridge_service()));
413 } 413 }
414 414
415 void ArcSettingsService::OnIntentHelperInstanceClosed() { 415 void ArcSettingsService::OnInstanceClosed() {
416 impl_.reset(); 416 impl_.reset();
417 } 417 }
418 418
419 } // namespace arc 419 } // namespace arc
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/arc/arc_settings_service.h ('k') | chrome/browser/chromeos/arc/gpu_arc_video_service_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698