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

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

Issue 1610813003: Merge arc/common/settings.mojom into intent_helper.mojom (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add back settings.mojom Created 4 years, 11 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_intent_helper_bridge_impl.cc
diff --git a/chrome/browser/chromeos/arc/arc_intent_helper_bridge_impl.cc b/chrome/browser/chromeos/arc/arc_intent_helper_bridge_impl.cc
index 9e4781a8b0b0c45026e1083284bb65bd5b0a2e99..2bc892071192fa8723dd0191847f5b99b6fde38c 100644
--- a/chrome/browser/chromeos/arc/arc_intent_helper_bridge_impl.cc
+++ b/chrome/browser/chromeos/arc/arc_intent_helper_bridge_impl.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/chromeos/arc/arc_intent_helper_bridge_impl.h"
+#include "base/json/json_writer.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/ash/multi_user/multi_user_util.h"
#include "chrome/browser/ui/browser.h"
@@ -28,11 +29,21 @@ void ArcIntentHelperBridgeImpl::StartObservingBridgeServiceChanges() {
bridge_service->AddObserver(this);
}
+void ArcIntentHelperBridgeImpl::OnStateChanged(ArcBridgeService::State state) {
+ // ArcBridgeService::State::READY is emitted before ArcIntentHelper app is
+ // ready to send broadcasts. Instead we wait for the IntentHelperInstance
+ // to be ready.
+ if (state == ArcBridgeService::State::STOPPING) {
+ settings_bridge_.reset();
+ }
+}
+
void ArcIntentHelperBridgeImpl::OnIntentHelperInstanceReady() {
IntentHelperHostPtr host;
binding_.Bind(mojo::GetProxy(&host));
ArcBridgeService* bridge_service = ArcBridgeService::Get();
bridge_service->intent_helper_instance()->Init(std::move(host));
+ settings_bridge_.reset(new SettingsBridge(this));
}
void ArcIntentHelperBridgeImpl::OnOpenUrl(const mojo::String& url) {
@@ -51,4 +62,25 @@ void ArcIntentHelperBridgeImpl::OnOpenUrl(const mojo::String& url) {
displayer.browser()->window()->GetNativeWindow());
}
+void ArcIntentHelperBridgeImpl::OnBroadcastNeeded(
+ const std::string& action,
+ const base::DictionaryValue& extras) {
+ ArcBridgeService* bridge_service = ArcBridgeService::Get();
+ if (!bridge_service ||
+ bridge_service->state() != ArcBridgeService::State::READY) {
+ LOG(ERROR) << "Bridge service is not ready.";
+ return;
+ }
+
+ std::string extras_json;
+ bool write_success = base::JSONWriter::Write(extras, &extras_json);
+ DCHECK(write_success);
+
+ if (bridge_service->intent_helper_version() >= 1) {
+ bridge_service->intent_helper_instance()->SendBroadcast(
+ action, "org.chromium.arc.intent_helper",
+ "org.chromium.arc.intent_helper.SettingsReceiver", extras_json);
+ }
+}
+
} // namespace arc

Powered by Google App Engine
This is Rietveld 408576698