| 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 "chrome/browser/renderer_context_menu/render_view_context_menu.h" | 5 #include "chrome/browser/renderer_context_menu/render_view_context_menu.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 1398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1409 if (id >= IDC_EXTENSIONS_CONTEXT_CUSTOM_FIRST && | 1409 if (id >= IDC_EXTENSIONS_CONTEXT_CUSTOM_FIRST && |
| 1410 id <= IDC_EXTENSIONS_CONTEXT_CUSTOM_LAST) { | 1410 id <= IDC_EXTENSIONS_CONTEXT_CUSTOM_LAST) { |
| 1411 return extension_items_.IsCommandIdChecked(id); | 1411 return extension_items_.IsCommandIdChecked(id); |
| 1412 } | 1412 } |
| 1413 | 1413 |
| 1414 return false; | 1414 return false; |
| 1415 } | 1415 } |
| 1416 | 1416 |
| 1417 void RenderViewContextMenu::ExecuteCommand(int id, int event_flags) { | 1417 void RenderViewContextMenu::ExecuteCommand(int id, int event_flags) { |
| 1418 command_executed_ = true; | 1418 command_executed_ = true; |
| 1419 RecordUsedItem(id); | |
| 1420 | |
| 1421 // If this command is is added by one of our observers, we dispatch it to the | 1419 // If this command is is added by one of our observers, we dispatch it to the |
| 1422 // observer. | 1420 // observer. |
| 1423 ObserverListBase<RenderViewContextMenuObserver>::Iterator it(observers_); | 1421 ObserverListBase<RenderViewContextMenuObserver>::Iterator it(observers_); |
| 1424 RenderViewContextMenuObserver* observer; | 1422 RenderViewContextMenuObserver* observer; |
| 1425 while ((observer = it.GetNext()) != NULL) { | 1423 while ((observer = it.GetNext()) != NULL) { |
| 1426 if (observer->IsCommandIdSupported(id)) | 1424 if (observer->IsCommandIdSupported(id)) |
| 1427 return observer->ExecuteCommand(id); | 1425 return observer->ExecuteCommand(id); |
| 1428 } | 1426 } |
| 1429 | 1427 |
| 1428 RecordUsedItem(id); |
| 1429 |
| 1430 RenderFrameHost* render_frame_host = | 1430 RenderFrameHost* render_frame_host = |
| 1431 RenderFrameHost::FromID(render_process_id_, render_frame_id_); | 1431 RenderFrameHost::FromID(render_process_id_, render_frame_id_); |
| 1432 | 1432 |
| 1433 // Process custom actions range. | 1433 // Process custom actions range. |
| 1434 if (id >= IDC_CONTENT_CONTEXT_CUSTOM_FIRST && | 1434 if (id >= IDC_CONTENT_CONTEXT_CUSTOM_FIRST && |
| 1435 id <= IDC_CONTENT_CONTEXT_CUSTOM_LAST) { | 1435 id <= IDC_CONTENT_CONTEXT_CUSTOM_LAST) { |
| 1436 unsigned action = id - IDC_CONTENT_CONTEXT_CUSTOM_FIRST; | 1436 unsigned action = id - IDC_CONTENT_CONTEXT_CUSTOM_FIRST; |
| 1437 const content::CustomContextMenuContext& context = params_.custom_context; | 1437 const content::CustomContextMenuContext& context = params_.custom_context; |
| 1438 #if defined(ENABLE_PLUGINS) | 1438 #if defined(ENABLE_PLUGINS) |
| 1439 if (context.request_id && !context.is_pepper_menu) { | 1439 if (context.request_id && !context.is_pepper_menu) { |
| (...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1987 source_web_contents_->GetRenderViewHost()-> | 1987 source_web_contents_->GetRenderViewHost()-> |
| 1988 ExecuteMediaPlayerActionAtLocation(location, action); | 1988 ExecuteMediaPlayerActionAtLocation(location, action); |
| 1989 } | 1989 } |
| 1990 | 1990 |
| 1991 void RenderViewContextMenu::PluginActionAt( | 1991 void RenderViewContextMenu::PluginActionAt( |
| 1992 const gfx::Point& location, | 1992 const gfx::Point& location, |
| 1993 const WebPluginAction& action) { | 1993 const WebPluginAction& action) { |
| 1994 source_web_contents_->GetRenderViewHost()-> | 1994 source_web_contents_->GetRenderViewHost()-> |
| 1995 ExecutePluginActionAtLocation(location, action); | 1995 ExecutePluginActionAtLocation(location, action); |
| 1996 } | 1996 } |
| OLD | NEW |