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

Unified Diff: chrome/browser/renderer_context_menu/open_with_menu_observer.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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/renderer_context_menu/open_with_menu_observer.h
diff --git a/chrome/browser/renderer_context_menu/open_with_menu_observer.h b/chrome/browser/renderer_context_menu/open_with_menu_observer.h
new file mode 100644
index 0000000000000000000000000000000000000000..71970436ca69db9f6275573bd7e44dd5bfc8e6ac
--- /dev/null
+++ b/chrome/browser/renderer_context_menu/open_with_menu_observer.h
@@ -0,0 +1,38 @@
+// 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 CHROME_BROWSER_RENDERER_CONTEXT_MENU_OPEN_WITH_MENU_OBSERVER_H_
+#define CHROME_BROWSER_RENDERER_CONTEXT_MENU_OPEN_WITH_MENU_OBSERVER_H_
+
+#include <set>
+
+#include "base/compiler_specific.h"
+#include "base/macros.h"
+#include "components/renderer_context_menu/render_view_context_menu_observer.h"
+
+class RenderViewContextMenuProxy;
+
+// An observer that listens to events from the RenderViewContextMenu class and
+// shows app names received from ARC that can handle the current URL.
+class OpenWithMenuObserver : public RenderViewContextMenuObserver {
+ public:
+ explicit OpenWithMenuObserver(RenderViewContextMenuProxy* proxy);
+ ~OpenWithMenuObserver() override;
+
+ // RenderViewContextMenuObserver implementation.
+ void InitMenu(const content::ContextMenuParams& params) override;
+ bool IsCommandIdSupported(int command_id) override;
+ bool IsCommandIdChecked(int command_id) override;
+ bool IsCommandIdEnabled(int command_id) override;
+ void ExecuteCommand(int command_id) override;
+ void OnMenuCancel() override;
+
+ private:
+ RenderViewContextMenuProxy* const proxy_;
+ int num_items_initially_enabled_;
+
+ DISALLOW_COPY_AND_ASSIGN(OpenWithMenuObserver);
+};
+
+#endif // CHROME_BROWSER_RENDERER_CONTEXT_MENU_OPEN_WITH_MENU_OBSERVER_H_

Powered by Google App Engine
This is Rietveld 408576698