Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(38)

Side by Side Diff: chrome/browser/renderer_context_menu/render_view_context_menu.cc

Issue 1415333002: [Media Router] Add experiment control logic. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 12 matching lines...) Expand all
23 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" 23 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h"
24 #include "chrome/browser/browser_process.h" 24 #include "chrome/browser/browser_process.h"
25 #include "chrome/browser/chrome_notification_types.h" 25 #include "chrome/browser/chrome_notification_types.h"
26 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h" 26 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h"
27 #include "chrome/browser/devtools/devtools_window.h" 27 #include "chrome/browser/devtools/devtools_window.h"
28 #include "chrome/browser/download/download_service.h" 28 #include "chrome/browser/download/download_service.h"
29 #include "chrome/browser/download/download_service_factory.h" 29 #include "chrome/browser/download/download_service_factory.h"
30 #include "chrome/browser/download/download_stats.h" 30 #include "chrome/browser/download/download_stats.h"
31 #include "chrome/browser/extensions/devtools_util.h" 31 #include "chrome/browser/extensions/devtools_util.h"
32 #include "chrome/browser/extensions/extension_service.h" 32 #include "chrome/browser/extensions/extension_service.h"
33 #include "chrome/browser/media/router/media_router_dialog_controller.h" 33 #include "chrome/browser/media/router/media_router_feature.h"
34 #include "chrome/browser/media/router/media_router_metrics.h"
35 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" 34 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h"
36 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_fact ory.h" 35 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_fact ory.h"
37 #include "chrome/browser/password_manager/chrome_password_manager_client.h" 36 #include "chrome/browser/password_manager/chrome_password_manager_client.h"
38 #include "chrome/browser/plugins/chrome_plugin_service_filter.h" 37 #include "chrome/browser/plugins/chrome_plugin_service_filter.h"
39 #include "chrome/browser/prefs/incognito_mode_prefs.h" 38 #include "chrome/browser/prefs/incognito_mode_prefs.h"
40 #include "chrome/browser/profiles/profile.h" 39 #include "chrome/browser/profiles/profile.h"
41 #include "chrome/browser/profiles/profile_avatar_icon_util.h" 40 #include "chrome/browser/profiles/profile_avatar_icon_util.h"
42 #include "chrome/browser/profiles/profile_info_cache.h" 41 #include "chrome/browser/profiles/profile_info_cache.h"
43 #include "chrome/browser/profiles/profile_io_data.h" 42 #include "chrome/browser/profiles/profile_io_data.h"
44 #include "chrome/browser/profiles/profile_manager.h" 43 #include "chrome/browser/profiles/profile_manager.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 #if defined(ENABLE_PRINT_PREVIEW) 125 #if defined(ENABLE_PRINT_PREVIEW)
127 #include "chrome/browser/printing/print_preview_context_menu_observer.h" 126 #include "chrome/browser/printing/print_preview_context_menu_observer.h"
128 #include "chrome/browser/printing/print_preview_dialog_controller.h" 127 #include "chrome/browser/printing/print_preview_dialog_controller.h"
129 #endif // defined(ENABLE_PRINT_PREVIEW) 128 #endif // defined(ENABLE_PRINT_PREVIEW)
130 #endif // defined(ENABLE_PRINTING) 129 #endif // defined(ENABLE_PRINTING)
131 130
132 #if defined(OS_CHROMEOS) 131 #if defined(OS_CHROMEOS)
133 #include "chrome/browser/chromeos/profiles/profile_helper.h" 132 #include "chrome/browser/chromeos/profiles/profile_helper.h"
134 #endif 133 #endif
135 134
135 #if defined(ENABLE_MEDIA_ROUTER)
136 #include "chrome/browser/media/router/media_router_dialog_controller.h"
137 #include "chrome/browser/media/router/media_router_metrics.h"
138 #endif
139
136 using base::UserMetricsAction; 140 using base::UserMetricsAction;
137 using blink::WebContextMenuData; 141 using blink::WebContextMenuData;
138 using blink::WebMediaPlayerAction; 142 using blink::WebMediaPlayerAction;
139 using blink::WebPluginAction; 143 using blink::WebPluginAction;
140 using blink::WebString; 144 using blink::WebString;
141 using blink::WebURL; 145 using blink::WebURL;
142 using content::BrowserContext; 146 using content::BrowserContext;
143 using content::ChildProcessSecurityPolicy; 147 using content::ChildProcessSecurityPolicy;
144 using content::DownloadManager; 148 using content::DownloadManager;
145 using content::DownloadUrlParameters; 149 using content::DownloadUrlParameters;
(...skipping 904 matching lines...) Expand 10 before | Expand all | Expand 10 after
1050 1054
1051 void RenderViewContextMenu::AppendPrintItem() { 1055 void RenderViewContextMenu::AppendPrintItem() {
1052 if (GetPrefs(browser_context_)->GetBoolean(prefs::kPrintingEnabled) && 1056 if (GetPrefs(browser_context_)->GetBoolean(prefs::kPrintingEnabled) &&
1053 (params_.media_type == WebContextMenuData::MediaTypeNone || 1057 (params_.media_type == WebContextMenuData::MediaTypeNone ||
1054 params_.media_flags & WebContextMenuData::MediaCanPrint)) { 1058 params_.media_flags & WebContextMenuData::MediaCanPrint)) {
1055 menu_model_.AddItemWithStringId(IDC_PRINT, IDS_CONTENT_CONTEXT_PRINT); 1059 menu_model_.AddItemWithStringId(IDC_PRINT, IDS_CONTENT_CONTEXT_PRINT);
1056 } 1060 }
1057 } 1061 }
1058 1062
1059 void RenderViewContextMenu::AppendMediaRouterItem() { 1063 void RenderViewContextMenu::AppendMediaRouterItem() {
1060 if (switches::MediaRouterEnabled() && !browser_context_->IsOffTheRecord()) 1064 if (media_router::MediaRouterEnabled() &&
1065 !browser_context_->IsOffTheRecord()) {
1061 menu_model_.AddItemWithStringId(IDC_ROUTE_MEDIA, 1066 menu_model_.AddItemWithStringId(IDC_ROUTE_MEDIA,
1062 IDS_MEDIA_ROUTER_MENU_ITEM_TITLE); 1067 IDS_MEDIA_ROUTER_MENU_ITEM_TITLE);
1068 }
1063 } 1069 }
1064 1070
1065 void RenderViewContextMenu::AppendRotationItems() { 1071 void RenderViewContextMenu::AppendRotationItems() {
1066 if (params_.media_flags & WebContextMenuData::MediaCanRotate) { 1072 if (params_.media_flags & WebContextMenuData::MediaCanRotate) {
1067 menu_model_.AddSeparator(ui::NORMAL_SEPARATOR); 1073 menu_model_.AddSeparator(ui::NORMAL_SEPARATOR);
1068 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_ROTATECW, 1074 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_ROTATECW,
1069 IDS_CONTENT_CONTEXT_ROTATECW); 1075 IDS_CONTENT_CONTEXT_ROTATECW);
1070 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_ROTATECCW, 1076 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_ROTATECCW,
1071 IDS_CONTENT_CONTEXT_ROTATECCW); 1077 IDS_CONTENT_CONTEXT_ROTATECCW);
1072 } 1078 }
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
1517 return true; 1523 return true;
1518 #endif 1524 #endif
1519 1525
1520 case IDC_SPELLCHECK_MENU: 1526 case IDC_SPELLCHECK_MENU:
1521 case IDC_CONTENT_CONTEXT_OPENLINKWITH: 1527 case IDC_CONTENT_CONTEXT_OPENLINKWITH:
1522 case IDC_CONTENT_CONTEXT_PROTOCOL_HANDLER_SETTINGS: 1528 case IDC_CONTENT_CONTEXT_PROTOCOL_HANDLER_SETTINGS:
1523 case IDC_CONTENT_CONTEXT_FORCESAVEPASSWORD: 1529 case IDC_CONTENT_CONTEXT_FORCESAVEPASSWORD:
1524 return true; 1530 return true;
1525 1531
1526 case IDC_ROUTE_MEDIA: { 1532 case IDC_ROUTE_MEDIA: {
1527 DCHECK(switches::MediaRouterEnabled()); 1533 DCHECK(media_router::MediaRouterEnabled());
1528 1534
1529 // Disable the command if there is an active modal dialog. 1535 // Disable the command if there is an active modal dialog.
1530 Browser* browser = 1536 Browser* browser =
1531 chrome::FindBrowserWithWebContents(source_web_contents_); 1537 chrome::FindBrowserWithWebContents(source_web_contents_);
1532 if (!browser || browser->profile()->IsOffTheRecord()) 1538 if (!browser || browser->profile()->IsOffTheRecord())
1533 return false; 1539 return false;
1534 1540
1535 WebContents* web_contents = 1541 WebContents* web_contents =
1536 browser->tab_strip_model()->GetActiveWebContents(); 1542 browser->tab_strip_model()->GetActiveWebContents();
1537 if (!web_contents) 1543 if (!web_contents)
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
1835 1841
1836 printing::StartPrint( 1842 printing::StartPrint(
1837 source_web_contents_, 1843 source_web_contents_,
1838 GetPrefs(browser_context_)->GetBoolean(prefs::kPrintPreviewDisabled), 1844 GetPrefs(browser_context_)->GetBoolean(prefs::kPrintPreviewDisabled),
1839 !params_.selection_text.empty()); 1845 !params_.selection_text.empty());
1840 #endif // ENABLE_PRINTING 1846 #endif // ENABLE_PRINTING
1841 break; 1847 break;
1842 } 1848 }
1843 1849
1844 case IDC_ROUTE_MEDIA: { 1850 case IDC_ROUTE_MEDIA: {
1845 DCHECK(switches::MediaRouterEnabled()); 1851 DCHECK(media_router::MediaRouterEnabled());
1846 1852 #if defined(ENABLE_MEDIA_ROUTER)
1847 Browser* browser = 1853 Browser* browser =
1848 chrome::FindBrowserWithWebContents(source_web_contents_); 1854 chrome::FindBrowserWithWebContents(source_web_contents_);
1849 DCHECK(browser && !browser->profile()->IsOffTheRecord()); 1855 DCHECK(browser && !browser->profile()->IsOffTheRecord());
1850 1856
1851 media_router::MediaRouterDialogController* dialog_controller = 1857 media_router::MediaRouterDialogController* dialog_controller =
1852 media_router::MediaRouterDialogController::GetOrCreateForWebContents( 1858 media_router::MediaRouterDialogController::GetOrCreateForWebContents(
1853 source_web_contents_); 1859 source_web_contents_);
1854
1855 if (!dialog_controller) 1860 if (!dialog_controller)
1856 return; 1861 return;
1857 1862
1858 dialog_controller->ShowMediaRouterDialog(); 1863 dialog_controller->ShowMediaRouterDialog();
1859
1860 media_router::MediaRouterMetrics::RecordMediaRouterDialogOrigin( 1864 media_router::MediaRouterMetrics::RecordMediaRouterDialogOrigin(
1861 media_router::CONTEXTUAL_MENU); 1865 media_router::CONTEXTUAL_MENU);
1862 1866 #endif // defined(ENABLE_MEDIA_ROUTER)
1863 break; 1867 break;
1864 } 1868 }
1865 1869
1866 case IDC_VIEW_SOURCE: 1870 case IDC_VIEW_SOURCE:
1867 embedder_web_contents_->ViewSource(); 1871 embedder_web_contents_->ViewSource();
1868 break; 1872 break;
1869 1873
1870 case IDC_CONTENT_CONTEXT_INSPECTELEMENT: 1874 case IDC_CONTENT_CONTEXT_INSPECTELEMENT:
1871 Inspect(params_.x, params_.y); 1875 Inspect(params_.x, params_.y);
1872 break; 1876 break;
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
2127 source_web_contents_->GetRenderViewHost()-> 2131 source_web_contents_->GetRenderViewHost()->
2128 ExecuteMediaPlayerActionAtLocation(location, action); 2132 ExecuteMediaPlayerActionAtLocation(location, action);
2129 } 2133 }
2130 2134
2131 void RenderViewContextMenu::PluginActionAt( 2135 void RenderViewContextMenu::PluginActionAt(
2132 const gfx::Point& location, 2136 const gfx::Point& location,
2133 const WebPluginAction& action) { 2137 const WebPluginAction& action) {
2134 source_web_contents_->GetRenderViewHost()-> 2138 source_web_contents_->GetRenderViewHost()->
2135 ExecutePluginActionAtLocation(location, action); 2139 ExecutePluginActionAtLocation(location, action);
2136 } 2140 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698