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 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 | 270 |
271 void RenderViewContextMenu::Init() { | 271 void RenderViewContextMenu::Init() { |
272 InitMenu(); | 272 InitMenu(); |
273 PlatformInit(); | 273 PlatformInit(); |
274 } | 274 } |
275 | 275 |
276 void RenderViewContextMenu::Cancel() { | 276 void RenderViewContextMenu::Cancel() { |
277 PlatformCancel(); | 277 PlatformCancel(); |
278 } | 278 } |
279 | 279 |
280 static bool ExtensionPatternMatch(const URLPatternSet& patterns, | 280 static bool ExtensionPatternMatch(const extensions::URLPatternSet& patterns, |
281 const GURL& url) { | 281 const GURL& url) { |
282 // No patterns means no restriction, so that implicitly matches. | 282 // No patterns means no restriction, so that implicitly matches. |
283 if (patterns.is_empty()) | 283 if (patterns.is_empty()) |
284 return true; | 284 return true; |
285 return patterns.MatchesURL(url); | 285 return patterns.MatchesURL(url); |
286 } | 286 } |
287 | 287 |
288 // static | 288 // static |
289 bool RenderViewContextMenu::ExtensionContextAndPatternMatch( | 289 bool RenderViewContextMenu::ExtensionContextAndPatternMatch( |
290 const content::ContextMenuParams& params, | 290 const content::ContextMenuParams& params, |
291 MenuItem::ContextList contexts, | 291 MenuItem::ContextList contexts, |
292 const URLPatternSet& target_url_patterns) { | 292 const extensions::URLPatternSet& target_url_patterns) { |
293 bool has_link = !params.link_url.is_empty(); | 293 bool has_link = !params.link_url.is_empty(); |
294 bool has_selection = !params.selection_text.empty(); | 294 bool has_selection = !params.selection_text.empty(); |
295 bool in_frame = !params.frame_url.is_empty(); | 295 bool in_frame = !params.frame_url.is_empty(); |
296 | 296 |
297 if (contexts.Contains(MenuItem::ALL) || | 297 if (contexts.Contains(MenuItem::ALL) || |
298 (has_selection && contexts.Contains(MenuItem::SELECTION)) || | 298 (has_selection && contexts.Contains(MenuItem::SELECTION)) || |
299 (params.is_editable && contexts.Contains(MenuItem::EDITABLE)) || | 299 (params.is_editable && contexts.Contains(MenuItem::EDITABLE)) || |
300 (in_frame && contexts.Contains(MenuItem::FRAME))) | 300 (in_frame && contexts.Contains(MenuItem::FRAME))) |
301 return true; | 301 return true; |
302 | 302 |
(...skipping 1555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1858 source_web_contents_->GetRenderViewHost()-> | 1858 source_web_contents_->GetRenderViewHost()-> |
1859 ExecuteMediaPlayerActionAtLocation(location, action); | 1859 ExecuteMediaPlayerActionAtLocation(location, action); |
1860 } | 1860 } |
1861 | 1861 |
1862 void RenderViewContextMenu::PluginActionAt( | 1862 void RenderViewContextMenu::PluginActionAt( |
1863 const gfx::Point& location, | 1863 const gfx::Point& location, |
1864 const WebPluginAction& action) { | 1864 const WebPluginAction& action) { |
1865 source_web_contents_->GetRenderViewHost()-> | 1865 source_web_contents_->GetRenderViewHost()-> |
1866 ExecutePluginActionAtLocation(location, action); | 1866 ExecutePluginActionAtLocation(location, action); |
1867 } | 1867 } |
OLD | NEW |