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

Unified Diff: chrome/browser/chromeos/arc/arc_settings_service.cc

Issue 2357053002: Always use arc::InstanceHolder<T>::GetInstanceForMethod (Closed)
Patch Set: review Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/arc/arc_settings_service.cc
diff --git a/chrome/browser/chromeos/arc/arc_settings_service.cc b/chrome/browser/chromeos/arc/arc_settings_service.cc
index f8626296af96cc0e470b098481c8ef22670e8996..cf9e79a157b30e0e3b91eaab4e670d8237a1d3c0 100644
--- a/chrome/browser/chromeos/arc/arc_settings_service.cc
+++ b/chrome/browser/chromeos/arc/arc_settings_service.cc
@@ -38,6 +38,8 @@ using ::chromeos::system::TimezoneSettings;
namespace {
+constexpr uint32_t kMinVersionForSendBroadcast = 1;
+
bool GetHttpProxyServer(const ProxyConfigDictionary* proxy_config_dict,
std::string* host,
int* port) {
@@ -456,20 +458,17 @@ void ArcSettingsServiceImpl::SyncLocationServiceEnabled() const {
void ArcSettingsServiceImpl::SendSettingsBroadcast(
const std::string& action,
const base::DictionaryValue& extras) const {
- if (!arc_bridge_service_->intent_helper()->instance()) {
- LOG(ERROR) << "IntentHelper instance is not ready.";
+ auto* instance = arc_bridge_service_->intent_helper()->GetInstanceForMethod(
+ "SendBroadcast", kMinVersionForSendBroadcast);
+ if (!instance)
return;
- }
-
std::string extras_json;
bool write_success = base::JSONWriter::Write(extras, &extras_json);
DCHECK(write_success);
- if (arc_bridge_service_->intent_helper()->version() >= 1) {
- arc_bridge_service_->intent_helper()->instance()->SendBroadcast(
- action, "org.chromium.arc.intent_helper",
- "org.chromium.arc.intent_helper.SettingsReceiver", extras_json);
- }
+ instance->SendBroadcast(action, "org.chromium.arc.intent_helper",
+ "org.chromium.arc.intent_helper.SettingsReceiver",
+ extras_json);
}
void ArcSettingsServiceImpl::DefaultNetworkChanged(

Powered by Google App Engine
This is Rietveld 408576698