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 "components/arc/intent_helper/arc_intent_helper_bridge.h" | 5 #include "components/arc/intent_helper/arc_intent_helper_bridge.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/shell_delegate.h" | 8 #include "ash/shell_delegate.h" |
9 #include "components/arc/intent_helper/link_handler_model_impl.h" | |
9 #include "url/gurl.h" | 10 #include "url/gurl.h" |
10 | 11 |
11 namespace arc { | 12 namespace arc { |
12 | 13 |
13 ArcIntentHelperBridge::ArcIntentHelperBridge(ArcBridgeService* bridge_service) | 14 ArcIntentHelperBridge::ArcIntentHelperBridge(ArcBridgeService* bridge_service) |
14 : ArcService(bridge_service), binding_(this) { | 15 : ArcService(bridge_service), binding_(this) { |
15 arc_bridge_service()->AddObserver(this); | 16 arc_bridge_service()->AddObserver(this); |
16 } | 17 } |
17 | 18 |
18 ArcIntentHelperBridge::~ArcIntentHelperBridge() { | 19 ArcIntentHelperBridge::~ArcIntentHelperBridge() { |
19 arc_bridge_service()->RemoveObserver(this); | 20 arc_bridge_service()->RemoveObserver(this); |
20 } | 21 } |
21 | 22 |
22 void ArcIntentHelperBridge::OnIntentHelperInstanceReady() { | 23 void ArcIntentHelperBridge::OnIntentHelperInstanceReady() { |
24 ash::Shell::GetInstance()->open_with_menu_controller()->SetDelegate(this); | |
23 arc_bridge_service()->intent_helper_instance()->Init( | 25 arc_bridge_service()->intent_helper_instance()->Init( |
24 binding_.CreateInterfacePtrAndBind()); | 26 binding_.CreateInterfacePtrAndBind()); |
25 } | 27 } |
26 | 28 |
29 void ArcIntentHelperBridge::OnIntentHelperInstanceClosed() { | |
30 ash::Shell::GetInstance()->open_with_menu_controller()->SetDelegate(nullptr); | |
hidehiko
2016/04/20 18:10:18
Could you verify this is always called before this
Yusuke Sato
2016/04/22 05:27:48
Done. Copied line 30 to the destructor following a
| |
31 } | |
32 | |
27 void ArcIntentHelperBridge::OnOpenUrl(const mojo::String& url) { | 33 void ArcIntentHelperBridge::OnOpenUrl(const mojo::String& url) { |
28 GURL gurl(url.get()); | 34 GURL gurl(url.get()); |
29 ash::Shell::GetInstance()->delegate()->OpenUrl(gurl); | 35 ash::Shell::GetInstance()->delegate()->OpenUrl(gurl); |
30 } | 36 } |
31 | 37 |
38 std::unique_ptr<ash::LinkHandlerModel> ArcIntentHelperBridge::CreateModel( | |
39 const GURL& url) { | |
40 std::unique_ptr<LinkHandlerModelImpl> impl( | |
41 new LinkHandlerModelImpl(arc_bridge_service())); | |
42 if (!impl->Init(url)) | |
43 return nullptr; | |
44 return std::move(impl); | |
45 } | |
46 | |
32 } // namespace arc | 47 } // namespace arc |
OLD | NEW |