OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_intent_helper_bridge.h" | 5 #include "chrome/browser/chromeos/arc/arc_intent_helper_bridge.h" |
6 | 6 |
7 #include "base/json/json_writer.h" | 7 #include "base/json/json_writer.h" |
8 #include "chrome/browser/profiles/profile_manager.h" | 8 #include "chrome/browser/profiles/profile_manager.h" |
9 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" | 9 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" |
10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
11 #include "chrome/browser/ui/browser_tabstrip.h" | 11 #include "chrome/browser/ui/browser_tabstrip.h" |
12 #include "chrome/browser/ui/browser_window.h" | 12 #include "chrome/browser/ui/browser_window.h" |
13 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" | 13 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" |
14 #include "components/arc/common/intent_helper.mojom.h" | 14 #include "components/arc/common/intent_helper.mojom.h" |
15 | 15 |
16 namespace arc { | 16 namespace arc { |
17 | 17 |
18 ArcIntentHelperBridge::ArcIntentHelperBridge(ArcBridgeService* bridge_service) | 18 ArcIntentHelperBridge::ArcIntentHelperBridge(ArcBridgeService* bridge_service) |
19 : ArcService(bridge_service), binding_(this) { | 19 : ArcService(bridge_service), binding_(this) { |
20 arc_bridge_service()->AddObserver(this); | 20 arc_bridge_service()->AddObserver(this); |
21 } | 21 } |
22 | 22 |
23 ArcIntentHelperBridge::~ArcIntentHelperBridge() { | 23 ArcIntentHelperBridge::~ArcIntentHelperBridge() { |
24 arc_bridge_service()->RemoveObserver(this); | 24 arc_bridge_service()->RemoveObserver(this); |
25 } | 25 } |
26 | 26 |
27 void ArcIntentHelperBridge::OnIntentHelperInstanceReady() { | 27 void ArcIntentHelperBridge::OnIntentHelperInstanceReady() { |
28 IntentHelperHostPtr host; | 28 arc_bridge_service()->intent_helper_instance()->Init( |
29 binding_.Bind(mojo::GetProxy(&host)); | 29 binding_.CreateInterfacePtrAndBind()); |
30 arc_bridge_service()->intent_helper_instance()->Init(std::move(host)); | |
31 settings_bridge_.reset(new SettingsBridge(this)); | 30 settings_bridge_.reset(new SettingsBridge(this)); |
32 } | 31 } |
33 | 32 |
34 void ArcIntentHelperBridge::OnIntentHelperInstanceClosed() { | 33 void ArcIntentHelperBridge::OnIntentHelperInstanceClosed() { |
35 settings_bridge_.reset(); | 34 settings_bridge_.reset(); |
36 } | 35 } |
37 | 36 |
38 void ArcIntentHelperBridge::OnOpenUrl(const mojo::String& url) { | 37 void ArcIntentHelperBridge::OnOpenUrl(const mojo::String& url) { |
39 GURL gurl(url.get()); | 38 GURL gurl(url.get()); |
40 if (!gurl.is_valid()) | 39 if (!gurl.is_valid()) |
(...skipping 23 matching lines...) Expand all Loading... |
64 DCHECK(write_success); | 63 DCHECK(write_success); |
65 | 64 |
66 if (arc_bridge_service()->intent_helper_version() >= 1) { | 65 if (arc_bridge_service()->intent_helper_version() >= 1) { |
67 arc_bridge_service()->intent_helper_instance()->SendBroadcast( | 66 arc_bridge_service()->intent_helper_instance()->SendBroadcast( |
68 action, "org.chromium.arc.intent_helper", | 67 action, "org.chromium.arc.intent_helper", |
69 "org.chromium.arc.intent_helper.SettingsReceiver", extras_json); | 68 "org.chromium.arc.intent_helper.SettingsReceiver", extras_json); |
70 } | 69 } |
71 } | 70 } |
72 | 71 |
73 } // namespace arc | 72 } // namespace arc |
OLD | NEW |