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

Side by Side Diff: components/renderer_context_menu/render_view_context_menu_base.h

Issue 678653003: Remove Downcasting RVContextMenuBase in ContextMenuDeleagate implementations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sync @toot Created 6 years, 1 month 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #ifndef COMPONENTS_RENDERER_CONTEXT_MENU_RENDER_VIEW_CONTEXT_MENU_BASE_H_ 5 #ifndef COMPONENTS_RENDERER_CONTEXT_MENU_RENDER_VIEW_CONTEXT_MENU_BASE_H_
6 #define COMPONENTS_RENDERER_CONTEXT_MENU_RENDER_VIEW_CONTEXT_MENU_BASE_H_ 6 #define COMPONENTS_RENDERER_CONTEXT_MENU_RENDER_VIEW_CONTEXT_MENU_BASE_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 static int ConvertToContentCustomCommandId(int id); 62 static int ConvertToContentCustomCommandId(int id);
63 63
64 // True if the given id is the one generated for content context menu. 64 // True if the given id is the one generated for content context menu.
65 static bool IsContentCustomCommandId(int id); 65 static bool IsContentCustomCommandId(int id);
66 66
67 RenderViewContextMenuBase(content::RenderFrameHost* render_frame_host, 67 RenderViewContextMenuBase(content::RenderFrameHost* render_frame_host,
68 const content::ContextMenuParams& params); 68 const content::ContextMenuParams& params);
69 69
70 ~RenderViewContextMenuBase() override; 70 ~RenderViewContextMenuBase() override;
71 71
72 // Displays the menu.
73 // Different platform will have their own implementation.
74 virtual void Show() = 0;
75
72 // Initializes the context menu. 76 // Initializes the context menu.
73 void Init(); 77 void Init();
74 78
75 // Programmatically closes the context menu. 79 // Programmatically closes the context menu.
76 void Cancel(); 80 void Cancel();
77 81
78 const ui::SimpleMenuModel& menu_model() const { return menu_model_; } 82 const ui::SimpleMenuModel& menu_model() const { return menu_model_; }
79 const content::ContextMenuParams& params() const { return params_; } 83 const content::ContextMenuParams& params() const { return params_; }
80 84
81 // Returns true if the specified command id is known and valid for 85 // Returns true if the specified command id is known and valid for
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 118
115 void set_toolkit_delegate(scoped_ptr<ToolkitDelegate> delegate) { 119 void set_toolkit_delegate(scoped_ptr<ToolkitDelegate> delegate) {
116 toolkit_delegate_ = delegate.Pass(); 120 toolkit_delegate_ = delegate.Pass();
117 } 121 }
118 122
119 ToolkitDelegate* toolkit_delegate() { 123 ToolkitDelegate* toolkit_delegate() {
120 return toolkit_delegate_.get(); 124 return toolkit_delegate_.get();
121 } 125 }
122 126
123 // TODO(oshima): Make these methods delegate. 127 // TODO(oshima): Make these methods delegate.
128 // Fills in |params_| with screen coordinates.
129 virtual void CalculateScreenCoordinatesInParams() = 0;
124 130
125 // Menu Construction. 131 // Menu Construction.
126 virtual void InitMenu(); 132 virtual void InitMenu();
127 133
128 // Increments histogram value for used items specified by |id|. 134 // Increments histogram value for used items specified by |id|.
129 virtual void RecordUsedItem(int id) = 0; 135 virtual void RecordUsedItem(int id) = 0;
130 136
131 // Increments histogram value for visible context menu item specified by |id|. 137 // Increments histogram value for visible context menu item specified by |id|.
132 virtual void RecordShownItem(int id) = 0; 138 virtual void RecordShownItem(int id) = 0;
133 139
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 187
182 // The RenderFrameHost's IDs. 188 // The RenderFrameHost's IDs.
183 int render_process_id_; 189 int render_process_id_;
184 190
185 scoped_ptr<ToolkitDelegate> toolkit_delegate_; 191 scoped_ptr<ToolkitDelegate> toolkit_delegate_;
186 192
187 DISALLOW_COPY_AND_ASSIGN(RenderViewContextMenuBase); 193 DISALLOW_COPY_AND_ASSIGN(RenderViewContextMenuBase);
188 }; 194 };
189 195
190 #endif // COMPONENTS_RENDERER_CONTEXT_MENU_RENDER_VIEW_CONTEXT_MENU_BASE_H_ 196 #endif // COMPONENTS_RENDERER_CONTEXT_MENU_RENDER_VIEW_CONTEXT_MENU_BASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698