| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <set> | 6 #include <set> |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "chrome/browser/tab_contents/render_view_context_menu.h" | 9 #include "chrome/browser/tab_contents/render_view_context_menu.h" |
| 10 | 10 |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 | 266 |
| 267 void RenderViewContextMenu::Init() { | 267 void RenderViewContextMenu::Init() { |
| 268 InitMenu(); | 268 InitMenu(); |
| 269 PlatformInit(); | 269 PlatformInit(); |
| 270 } | 270 } |
| 271 | 271 |
| 272 void RenderViewContextMenu::Cancel() { | 272 void RenderViewContextMenu::Cancel() { |
| 273 PlatformCancel(); | 273 PlatformCancel(); |
| 274 } | 274 } |
| 275 | 275 |
| 276 static bool ExtensionPatternMatch(const URLPatternSet& patterns, | 276 static bool ExtensionPatternMatch(const extensions::URLPatternSet& patterns, |
| 277 const GURL& url) { | 277 const GURL& url) { |
| 278 // No patterns means no restriction, so that implicitly matches. | 278 // No patterns means no restriction, so that implicitly matches. |
| 279 if (patterns.is_empty()) | 279 if (patterns.is_empty()) |
| 280 return true; | 280 return true; |
| 281 return patterns.MatchesURL(url); | 281 return patterns.MatchesURL(url); |
| 282 } | 282 } |
| 283 | 283 |
| 284 // static | 284 // static |
| 285 bool RenderViewContextMenu::ExtensionContextAndPatternMatch( | 285 bool RenderViewContextMenu::ExtensionContextAndPatternMatch( |
| 286 const content::ContextMenuParams& params, | 286 const content::ContextMenuParams& params, |
| 287 MenuItem::ContextList contexts, | 287 MenuItem::ContextList contexts, |
| 288 const URLPatternSet& target_url_patterns) { | 288 const extensions::URLPatternSet& target_url_patterns) { |
| 289 bool has_link = !params.link_url.is_empty(); | 289 bool has_link = !params.link_url.is_empty(); |
| 290 bool has_selection = !params.selection_text.empty(); | 290 bool has_selection = !params.selection_text.empty(); |
| 291 bool in_frame = !params.frame_url.is_empty(); | 291 bool in_frame = !params.frame_url.is_empty(); |
| 292 | 292 |
| 293 if (contexts.Contains(MenuItem::ALL) || | 293 if (contexts.Contains(MenuItem::ALL) || |
| 294 (has_selection && contexts.Contains(MenuItem::SELECTION)) || | 294 (has_selection && contexts.Contains(MenuItem::SELECTION)) || |
| 295 (params.is_editable && contexts.Contains(MenuItem::EDITABLE)) || | 295 (params.is_editable && contexts.Contains(MenuItem::EDITABLE)) || |
| 296 (in_frame && contexts.Contains(MenuItem::FRAME))) | 296 (in_frame && contexts.Contains(MenuItem::FRAME))) |
| 297 return true; | 297 return true; |
| 298 | 298 |
| (...skipping 1555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1854 source_web_contents_->GetRenderViewHost()-> | 1854 source_web_contents_->GetRenderViewHost()-> |
| 1855 ExecuteMediaPlayerActionAtLocation(location, action); | 1855 ExecuteMediaPlayerActionAtLocation(location, action); |
| 1856 } | 1856 } |
| 1857 | 1857 |
| 1858 void RenderViewContextMenu::PluginActionAt( | 1858 void RenderViewContextMenu::PluginActionAt( |
| 1859 const gfx::Point& location, | 1859 const gfx::Point& location, |
| 1860 const WebPluginAction& action) { | 1860 const WebPluginAction& action) { |
| 1861 source_web_contents_->GetRenderViewHost()-> | 1861 source_web_contents_->GetRenderViewHost()-> |
| 1862 ExecutePluginActionAtLocation(location, action); | 1862 ExecutePluginActionAtLocation(location, action); |
| 1863 } | 1863 } |
| OLD | NEW |