Index: ash/renderer_context_menu/open_with_menu_controller.h |
diff --git a/ash/renderer_context_menu/open_with_menu_controller.h b/ash/renderer_context_menu/open_with_menu_controller.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..aa734a38023c984fad097bdd4714c4bf12963656 |
--- /dev/null |
+++ b/ash/renderer_context_menu/open_with_menu_controller.h |
@@ -0,0 +1,55 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef ASH_RENDERER_CONTEXT_MENU_OPEN_WITH_MENU_CONTROLLER_H_ |
+#define ASH_RENDERER_CONTEXT_MENU_OPEN_WITH_MENU_CONTROLLER_H_ |
+ |
+#include "ash/ash_export.h" |
+#include "base/macros.h" |
+ |
+class RenderViewContextMenuObserver; |
+class RenderViewContextMenuProxy; |
+ |
+namespace ash { |
+ |
+// A class for populating and updating "Open with <app>" menu items in a |
+// renderer context menu. |
+class ASH_EXPORT OpenWithMenuController { |
+ public: |
+ class Delegate { |
+ public: |
+ virtual ~Delegate() {} |
+ virtual RenderViewContextMenuObserver* CreateMenu( |
+ RenderViewContextMenuProxy* proxy, |
+ int menu_id_start, |
+ size_t num_menu_items, |
+ int sub_menu_id_start, |
+ size_t num_sub_menu_items) = 0; |
+ }; |
+ |
+ OpenWithMenuController(); |
+ void SetDelegate(Delegate* delegate); |
+ |
+ // Returns a menu observer that populates "Open with <app>" context menu |
+ // items. When such type of a menu is not supported, returns nullptr. |
+ // The returned menu observer will add up to |num_menu_items| main context |
+ // menu items starting from |menu_id_start| to the |proxy|. The object may |
+ // also use up to |num_sub_menu_items| IDsstarting from |sub_menu_id_start| |
+ // when a sub menu is needed. The caller takes ownership of the returned |
+ // object. |
+ RenderViewContextMenuObserver* CreateMenu(RenderViewContextMenuProxy* proxy, |
+ int menu_id_start, |
+ size_t num_menu_items, |
+ int sub_menu_id_start, |
+ size_t num_sub_menu_items); |
+ |
+ private: |
+ Delegate* delegate_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(OpenWithMenuController); |
+}; |
+ |
+} // namespace ash |
+ |
+#endif // ASH_RENDERER_CONTEXT_MENU_OPEN_WITH_MENU_CONTROLLER_H_ |