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

Side by Side Diff: components/arc/intent_helper/arc_intent_helper_bridge.cc

Issue 1760773004: Add "Open with <ARC-app-name>" items to the context menu (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address dcheng's comment Created 4 years, 8 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 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()->set_link_handler_model_factory(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()->set_link_handler_model_factory(nullptr);
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(new LinkHandlerModelImpl);
41 if (!impl->Init(url))
42 return nullptr;
43 return std::move(impl);
44 }
45
32 } // namespace arc 46 } // namespace arc
OLDNEW
« no previous file with comments | « components/arc/intent_helper/arc_intent_helper_bridge.h ('k') | components/arc/intent_helper/link_handler_model_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698