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

Side by Side Diff: ash/renderer_context_menu/open_with_menu_controller.h

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: return std::pair Created 4 years, 9 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef ASH_RENDERER_CONTEXT_MENU_OPEN_WITH_MENU_CONTROLLER_H_
6 #define ASH_RENDERER_CONTEXT_MENU_OPEN_WITH_MENU_CONTROLLER_H_
7
8 #include "ash/ash_export.h"
9 #include "base/macros.h"
10
11 class GURL;
12 class RenderViewContextMenuProxy;
13
14 namespace ash {
15
16 // A class for populating and updating "Open with <app>" menu items in a
17 // renderer context menu.
18 class ASH_EXPORT OpenWithMenuController {
19 public:
20 class Delegate {
21 public:
22 virtual ~Delegate() {}
23 virtual int PopulateOpenWithMenu(RenderViewContextMenuProxy* proxy,
24 int menu_id_start,
25 size_t num_menu_items,
26 const GURL& url) = 0;
27 virtual void ExecuteCommand(int id) = 0;
28 virtual void MenuClosed() = 0;
29 };
30
31 OpenWithMenuController();
32 void SetDelegate(Delegate* delegate);
33
34 // Populates "Open with <app>" context menu items for the |url| either
35 // synchronously or asynchronously. Returns the number of menu items that have
36 // to be enabled right away. When there is nothing to do for the |url|, the
37 // function immediately returns 0. The function adds up to |num_menu_items|
38 // context menu items starting from |menu_id_start| to the |proxy|.
39 int PopulateOpenWithMenu(RenderViewContextMenuProxy* proxy,
40 int menu_id_start,
41 size_t num_menu_items,
42 const GURL& url);
43
44 // Notifies the controller that one of the items in the context menu is
45 // executed. This method can only be called after PopulateOpenWithMenu()
46 // is called and before MenuClosed() is called.
47 void ExecuteCommand(int id);
48
49 // Notifies the controller that the context menu is being closed.
50 void MenuClosed();
51
52 private:
53 Delegate* delegate_;
54
55 DISALLOW_COPY_AND_ASSIGN(OpenWithMenuController);
56 };
57
58 } // namespace ash
59
60 #endif // ASH_RENDERER_CONTEXT_MENU_OPEN_WITH_MENU_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698