OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "content/shell/browser/shell_web_contents_view_delegate.h" | 5 #include "content/shell/browser/shell_web_contents_view_delegate.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "content/public/browser/render_frame_host.h" | 8 #include "content/public/browser/render_frame_host.h" |
9 #include "content/public/browser/render_process_host.h" | 9 #include "content/public/browser/render_process_host.h" |
10 #include "content/public/browser/render_view_host.h" | 10 #include "content/public/browser/render_view_host.h" |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 | 163 |
164 AppendMenu(sub_menu, MF_SEPARATOR, 0, NULL); | 164 AppendMenu(sub_menu, MF_SEPARATOR, 0, NULL); |
165 index++; | 165 index++; |
166 } | 166 } |
167 | 167 |
168 MakeContextMenuItem(sub_menu, | 168 MakeContextMenuItem(sub_menu, |
169 index++, | 169 index++, |
170 L"Inspect...", | 170 L"Inspect...", |
171 ShellContextMenuItemInspectId, | 171 ShellContextMenuItemInspectId, |
172 true); | 172 true); |
173 #if defined(USE_AURA) | |
174 NOTIMPLEMENTED(); | 173 NOTIMPLEMENTED(); |
175 #else | |
176 gfx::Point screen_point(params.x, params.y); | |
177 POINT point = screen_point.ToPOINT(); | |
178 ClientToScreen(web_contents_->GetNativeView(), &point); | |
179 | |
180 int selection = | |
181 TrackPopupMenu(sub_menu, | |
182 TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD, | |
183 point.x, point.y, | |
184 0, | |
185 web_contents_->GetContentNativeView(), | |
186 NULL); | |
187 | |
188 MenuItemSelected(selection); | |
189 #endif | |
190 DestroyMenu(menu); | 174 DestroyMenu(menu); |
191 } | 175 } |
192 | 176 |
193 void ShellWebContentsViewDelegate::MenuItemSelected(int selection) { | 177 void ShellWebContentsViewDelegate::MenuItemSelected(int selection) { |
194 switch (selection) { | 178 switch (selection) { |
195 case ShellContextMenuItemCutId: | 179 case ShellContextMenuItemCutId: |
196 web_contents_->Cut(); | 180 web_contents_->Cut(); |
197 break; | 181 break; |
198 case ShellContextMenuItemCopyId: | 182 case ShellContextMenuItemCopyId: |
199 web_contents_->Copy(); | 183 web_contents_->Copy(); |
(...skipping 26 matching lines...) Expand all Loading... |
226 web_contents_->Focus(); | 210 web_contents_->Focus(); |
227 break; | 211 break; |
228 case ShellContextMenuItemInspectId: { | 212 case ShellContextMenuItemInspectId: { |
229 ShellDevToolsFrontend::Show(web_contents_); | 213 ShellDevToolsFrontend::Show(web_contents_); |
230 break; | 214 break; |
231 } | 215 } |
232 } | 216 } |
233 } | 217 } |
234 | 218 |
235 } // namespace content | 219 } // namespace content |
OLD | NEW |