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

Side by Side Diff: chrome/browser/ui/webui/ntp/android/context_menu_handler.h

Issue 10861042: Add Android's context menu handler used on the NTP. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Switch to using a weakptr instead of callback obj. Created 8 years, 4 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 (c) 2012 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 CHROME_BROWSER_UI_WEBUI_NTP_ANDROID_CONTEXT_MENU_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_NTP_ANDROID_CONTEXT_MENU_HANDLER_H_
7
8 #include "base/memory/weak_ptr.h"
9 #include "content/public/browser/web_ui_message_handler.h"
10
11 namespace base {
12 class ListValue;
13 }
14
15 // The handler for JavaScript messages related to the context menus.
16 // It's the job of the actual HTML page to intercept the contextmenu event,
17 // disable it and show its own custom menu.
18 class ContextMenuHandler : public content::WebUIMessageHandler {
19 public:
20 ContextMenuHandler();
21 virtual ~ContextMenuHandler();
22
23 // WebUIMessageHandler override and implementation.
24 virtual void RegisterMessages() OVERRIDE;
25
26 // Invoked (by on_item_selected_callback_) when an item has been selected.
27 void OnItemSelected(int item_id);
28
29 // Callback for the "showContextMenu" message.
30 void HandleShowContextMenu(const base::ListValue* args);
31
32 // Below are the message that are so far only triggered by the context menu.
33 // They should be moved to other files if they become used from other places.
34
35 // Callback for the "openInNewTab" message.
36 void HandleOpenInNewTab(const base::ListValue* args);
37
38 // Callback for the "openInIncognitoTab" message.
39 void HandleOpenInIncognitoTab(const base::ListValue* args);
40
41 private:
42 // Used to get a WeakPtr to self on the UI thread.
43 base::WeakPtrFactory<ContextMenuHandler> weak_ptr_factory_;
44
45 DISALLOW_COPY_AND_ASSIGN(ContextMenuHandler);
46 };
47
48 #endif // CHROME_BROWSER_UI_WEBUI_NTP_ANDROID_CONTEXT_MENU_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698