| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 | 7 |
| 8 #include "chrome/browser/tab_contents/render_view_context_menu.h" | 8 #include "chrome/browser/tab_contents/render_view_context_menu.h" |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 1338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1349 return; | 1349 return; |
| 1350 } | 1350 } |
| 1351 | 1351 |
| 1352 if (id >= IDC_CONTENT_CONTEXT_PROTOCOL_HANDLER_FIRST && | 1352 if (id >= IDC_CONTENT_CONTEXT_PROTOCOL_HANDLER_FIRST && |
| 1353 id <= IDC_CONTENT_CONTEXT_PROTOCOL_HANDLER_LAST) { | 1353 id <= IDC_CONTENT_CONTEXT_PROTOCOL_HANDLER_LAST) { |
| 1354 ProtocolHandlerRegistry::ProtocolHandlerList handlers = | 1354 ProtocolHandlerRegistry::ProtocolHandlerList handlers = |
| 1355 GetHandlersForLinkUrl(); | 1355 GetHandlersForLinkUrl(); |
| 1356 if (handlers.empty()) { | 1356 if (handlers.empty()) { |
| 1357 return; | 1357 return; |
| 1358 } | 1358 } |
| 1359 UserMetrics::RecordAction(UserMetricsAction( |
| 1360 "RegisterProtocolHandler.ContextMenu_Open")); |
| 1359 int handlerIndex = id - IDC_CONTENT_CONTEXT_PROTOCOL_HANDLER_FIRST; | 1361 int handlerIndex = id - IDC_CONTENT_CONTEXT_PROTOCOL_HANDLER_FIRST; |
| 1360 OpenURL( | 1362 OpenURL( |
| 1361 handlers[handlerIndex].TranslateUrl(params_.link_url), | 1363 handlers[handlerIndex].TranslateUrl(params_.link_url), |
| 1362 params_.frame_url.is_empty() ? params_.page_url : params_.frame_url, | 1364 params_.frame_url.is_empty() ? params_.page_url : params_.frame_url, |
| 1363 params_.frame_id, | 1365 params_.frame_id, |
| 1364 NEW_FOREGROUND_TAB, | 1366 NEW_FOREGROUND_TAB, |
| 1365 PageTransition::LINK); | 1367 PageTransition::LINK); |
| 1366 return; | 1368 return; |
| 1367 } | 1369 } |
| 1368 | 1370 |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1671 dir = WebKit::WebTextDirectionRightToLeft; | 1673 dir = WebKit::WebTextDirectionRightToLeft; |
| 1672 rvh->UpdateTextDirection(dir); | 1674 rvh->UpdateTextDirection(dir); |
| 1673 rvh->NotifyTextDirection(); | 1675 rvh->NotifyTextDirection(); |
| 1674 break; | 1676 break; |
| 1675 } | 1677 } |
| 1676 case IDC_CONTENT_CONTEXT_LOOK_UP_IN_DICTIONARY: | 1678 case IDC_CONTENT_CONTEXT_LOOK_UP_IN_DICTIONARY: |
| 1677 LookUpInDictionary(); | 1679 LookUpInDictionary(); |
| 1678 break; | 1680 break; |
| 1679 #endif // OS_MACOSX | 1681 #endif // OS_MACOSX |
| 1680 case IDC_CONTENT_CONTEXT_PROTOCOL_HANDLER_SETTINGS: { | 1682 case IDC_CONTENT_CONTEXT_PROTOCOL_HANDLER_SETTINGS: { |
| 1683 UserMetrics::RecordAction(UserMetricsAction( |
| 1684 "RegisterProtocolHandler.ContextMenu_Settings")); |
| 1681 std::string url = std::string(chrome::kChromeUISettingsURL) + | 1685 std::string url = std::string(chrome::kChromeUISettingsURL) + |
| 1682 chrome::kHandlerSettingsSubPage; | 1686 chrome::kHandlerSettingsSubPage; |
| 1683 OpenURL(GURL(url), GURL(), 0, NEW_FOREGROUND_TAB, PageTransition::LINK); | 1687 OpenURL(GURL(url), GURL(), 0, NEW_FOREGROUND_TAB, PageTransition::LINK); |
| 1684 break; | 1688 break; |
| 1685 } | 1689 } |
| 1686 | 1690 |
| 1687 case IDC_CONTENT_CONTEXT_ADDSEARCHENGINE: { | 1691 case IDC_CONTENT_CONTEXT_ADDSEARCHENGINE: { |
| 1688 // Make sure the model is loaded. | 1692 // Make sure the model is loaded. |
| 1689 TemplateURLService* model = | 1693 TemplateURLService* model = |
| 1690 TemplateURLServiceFactory::GetForProfile(profile_); | 1694 TemplateURLServiceFactory::GetForProfile(profile_); |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1832 g_browser_process->clipboard()); | 1836 g_browser_process->clipboard()); |
| 1833 } | 1837 } |
| 1834 | 1838 |
| 1835 void RenderViewContextMenu::MediaPlayerActionAt( | 1839 void RenderViewContextMenu::MediaPlayerActionAt( |
| 1836 const gfx::Point& location, | 1840 const gfx::Point& location, |
| 1837 const WebMediaPlayerAction& action) { | 1841 const WebMediaPlayerAction& action) { |
| 1838 RenderViewHost* rvh = source_tab_contents_->render_view_host(); | 1842 RenderViewHost* rvh = source_tab_contents_->render_view_host(); |
| 1839 rvh->Send(new ViewMsg_MediaPlayerActionAt( | 1843 rvh->Send(new ViewMsg_MediaPlayerActionAt( |
| 1840 rvh->routing_id(), location, action)); | 1844 rvh->routing_id(), location, action)); |
| 1841 } | 1845 } |
| OLD | NEW |