| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <functional> | 5 #include <functional> |
| 6 | 6 |
| 7 #include "chrome/browser/tab_contents/render_view_context_menu.h" | 7 #include "chrome/browser/tab_contents/render_view_context_menu.h" |
| 8 | 8 |
| 9 #include "app/clipboard/clipboard.h" | 9 #include "app/clipboard/clipboard.h" |
| 10 #include "app/clipboard/scoped_clipboard_writer.h" | 10 #include "app/clipboard/scoped_clipboard_writer.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 | 48 |
| 49 using WebKit::WebContextMenuData; | 49 using WebKit::WebContextMenuData; |
| 50 using WebKit::WebMediaPlayerAction; | 50 using WebKit::WebMediaPlayerAction; |
| 51 | 51 |
| 52 // static | 52 // static |
| 53 bool RenderViewContextMenu::IsDevToolsURL(const GURL& url) { | 53 bool RenderViewContextMenu::IsDevToolsURL(const GURL& url) { |
| 54 return url.SchemeIs(chrome::kChromeUIScheme) && | 54 return url.SchemeIs(chrome::kChromeUIScheme) && |
| 55 url.host() == chrome::kChromeUIDevToolsHost; | 55 url.host() == chrome::kChromeUIDevToolsHost; |
| 56 } | 56 } |
| 57 | 57 |
| 58 // static |
| 59 bool RenderViewContextMenu::IsSyncResourcesURL(const GURL& url) { |
| 60 return url.SchemeIs(chrome::kChromeUIScheme) && |
| 61 url.host() == chrome::kSyncResourcesHost; |
| 62 } |
| 63 |
| 58 static const int kSpellcheckRadioGroup = 1; | 64 static const int kSpellcheckRadioGroup = 1; |
| 59 static const int kExtensionsRadioGroup = 2; | 65 static const int kExtensionsRadioGroup = 2; |
| 60 | 66 |
| 61 RenderViewContextMenu::RenderViewContextMenu( | 67 RenderViewContextMenu::RenderViewContextMenu( |
| 62 TabContents* tab_contents, | 68 TabContents* tab_contents, |
| 63 const ContextMenuParams& params) | 69 const ContextMenuParams& params) |
| 64 : params_(params), | 70 : params_(params), |
| 65 source_tab_contents_(tab_contents), | 71 source_tab_contents_(tab_contents), |
| 66 profile_(tab_contents->profile()), | 72 profile_(tab_contents->profile()), |
| 67 ALLOW_THIS_IN_INITIALIZER_LIST(menu_model_(this)), | 73 ALLOW_THIS_IN_INITIALIZER_LIST(menu_model_(this)), |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 // When no special node or text is selected and selection has no link, | 289 // When no special node or text is selected and selection has no link, |
| 284 // show page items. | 290 // show page items. |
| 285 bool is_devtools = false; | 291 bool is_devtools = false; |
| 286 if (params_.media_type == WebContextMenuData::MediaTypeNone && | 292 if (params_.media_type == WebContextMenuData::MediaTypeNone && |
| 287 !has_link && | 293 !has_link && |
| 288 !params_.is_editable && | 294 !params_.is_editable && |
| 289 !has_selection) { | 295 !has_selection) { |
| 290 // If context is in subframe, show subframe options instead. | 296 // If context is in subframe, show subframe options instead. |
| 291 if (!params_.frame_url.is_empty()) { | 297 if (!params_.frame_url.is_empty()) { |
| 292 is_devtools = IsDevToolsURL(params_.frame_url); | 298 is_devtools = IsDevToolsURL(params_.frame_url); |
| 293 if (!is_devtools) | 299 if (!is_devtools && !IsSyncResourcesURL(params_.frame_url)) |
| 294 AppendFrameItems(); | 300 AppendFrameItems(); |
| 295 } else if (!params_.page_url.is_empty()) { | 301 } else if (!params_.page_url.is_empty()) { |
| 296 is_devtools = IsDevToolsURL(params_.page_url); | 302 is_devtools = IsDevToolsURL(params_.page_url); |
| 297 if (!is_devtools) | 303 if (!is_devtools && !IsSyncResourcesURL(params_.page_url)) |
| 298 AppendPageItems(); | 304 AppendPageItems(); |
| 299 } | 305 } |
| 300 } | 306 } |
| 301 | 307 |
| 302 if (has_link) { | 308 if (has_link) { |
| 303 AppendLinkItems(); | 309 AppendLinkItems(); |
| 304 if (params_.media_type != WebContextMenuData::MediaTypeNone) | 310 if (params_.media_type != WebContextMenuData::MediaTypeNone) |
| 305 menu_model_.AddSeparator(); | 311 menu_model_.AddSeparator(); |
| 306 } | 312 } |
| 307 | 313 |
| (...skipping 1029 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1337 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages), | 1343 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages), |
| 1338 g_browser_process->clipboard()); | 1344 g_browser_process->clipboard()); |
| 1339 } | 1345 } |
| 1340 | 1346 |
| 1341 void RenderViewContextMenu::MediaPlayerActionAt( | 1347 void RenderViewContextMenu::MediaPlayerActionAt( |
| 1342 const gfx::Point& location, | 1348 const gfx::Point& location, |
| 1343 const WebMediaPlayerAction& action) { | 1349 const WebMediaPlayerAction& action) { |
| 1344 source_tab_contents_->render_view_host()->MediaPlayerActionAt( | 1350 source_tab_contents_->render_view_host()->MediaPlayerActionAt( |
| 1345 location, action); | 1351 location, action); |
| 1346 } | 1352 } |
| OLD | NEW |