OLD | NEW |
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 #include "components/renderer_context_menu/render_view_context_menu_base.h" | 5 #include "components/renderer_context_menu/render_view_context_menu_base.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "content/public/browser/render_frame_host.h" | 13 #include "content/public/browser/render_frame_host.h" |
14 #include "content/public/browser/render_process_host.h" | 14 #include "content/public/browser/render_process_host.h" |
15 #include "content/public/browser/render_view_host.h" | 15 #include "content/public/browser/render_view_host.h" |
16 #include "content/public/browser/render_widget_host_view.h" | 16 #include "content/public/browser/render_widget_host_view.h" |
17 #include "content/public/browser/web_contents.h" | 17 #include "content/public/browser/web_contents.h" |
18 #include "content/public/common/menu_item.h" | 18 #include "content/public/common/menu_item.h" |
| 19 #include "ppapi/features/features.h" |
19 #include "third_party/WebKit/public/web/WebContextMenuData.h" | 20 #include "third_party/WebKit/public/web/WebContextMenuData.h" |
20 | 21 |
21 using blink::WebContextMenuData; | 22 using blink::WebContextMenuData; |
22 using blink::WebString; | 23 using blink::WebString; |
23 using blink::WebURL; | 24 using blink::WebURL; |
24 using content::BrowserContext; | 25 using content::BrowserContext; |
25 using content::OpenURLParams; | 26 using content::OpenURLParams; |
26 using content::RenderFrameHost; | 27 using content::RenderFrameHost; |
27 using content::RenderViewHost; | 28 using content::RenderViewHost; |
28 using content::WebContents; | 29 using content::WebContents; |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 // it to the observer. | 303 // it to the observer. |
303 for (auto& observer : observers_) { | 304 for (auto& observer : observers_) { |
304 if (observer.IsCommandIdSupported(id)) | 305 if (observer.IsCommandIdSupported(id)) |
305 return observer.ExecuteCommand(id); | 306 return observer.ExecuteCommand(id); |
306 } | 307 } |
307 | 308 |
308 // Process custom actions range. | 309 // Process custom actions range. |
309 if (IsContentCustomCommandId(id)) { | 310 if (IsContentCustomCommandId(id)) { |
310 unsigned action = id - content_context_custom_first; | 311 unsigned action = id - content_context_custom_first; |
311 const content::CustomContextMenuContext& context = params_.custom_context; | 312 const content::CustomContextMenuContext& context = params_.custom_context; |
312 #if defined(ENABLE_PLUGINS) | 313 #if BUILDFLAG(ENABLE_PLUGINS) |
313 if (context.request_id && !context.is_pepper_menu) | 314 if (context.request_id && !context.is_pepper_menu) |
314 HandleAuthorizeAllPlugins(); | 315 HandleAuthorizeAllPlugins(); |
315 #endif | 316 #endif |
316 source_web_contents_->ExecuteCustomContextMenuCommand(action, context); | 317 source_web_contents_->ExecuteCustomContextMenuCommand(action, context); |
317 return; | 318 return; |
318 } | 319 } |
319 command_executed_ = false; | 320 command_executed_ = false; |
320 } | 321 } |
321 | 322 |
322 void RenderViewContextMenuBase::MenuWillShow(ui::SimpleMenuModel* source) { | 323 void RenderViewContextMenuBase::MenuWillShow(ui::SimpleMenuModel* source) { |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 NotifyURLOpened(url, new_contents); | 399 NotifyURLOpened(url, new_contents); |
399 } | 400 } |
400 | 401 |
401 bool RenderViewContextMenuBase::IsCustomItemChecked(int id) const { | 402 bool RenderViewContextMenuBase::IsCustomItemChecked(int id) const { |
402 return IsCustomItemCheckedInternal(params_.custom_items, id); | 403 return IsCustomItemCheckedInternal(params_.custom_items, id); |
403 } | 404 } |
404 | 405 |
405 bool RenderViewContextMenuBase::IsCustomItemEnabled(int id) const { | 406 bool RenderViewContextMenuBase::IsCustomItemEnabled(int id) const { |
406 return IsCustomItemEnabledInternal(params_.custom_items, id); | 407 return IsCustomItemEnabledInternal(params_.custom_items, id); |
407 } | 408 } |
OLD | NEW |