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

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: add a missing override; 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/open_with_menu_observer.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(NULL);
Luis Héctor Chávez 2016/04/04 23:12:43 nit: s/NULL/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 RenderViewContextMenuObserver* ArcIntentHelperBridge::CreateMenu(
39 RenderViewContextMenuProxy* proxy,
40 int menu_id_start,
41 size_t num_menu_items,
42 int sub_menu_id_start,
43 size_t num_sub_menu_items) {
44 return new OpenWithMenuObserver(arc_bridge_service(), proxy, menu_id_start,
45 num_menu_items, sub_menu_id_start,
46 num_sub_menu_items);
47 }
48
32 } // namespace arc 49 } // namespace arc
OLDNEW
« no previous file with comments | « components/arc/intent_helper/arc_intent_helper_bridge.h ('k') | components/arc/intent_helper/open_with_menu_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698