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

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

Issue 1191453002: Implement "open link as user" context menu entry (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: updates Created 5 years, 6 months 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 19 matching lines...) Expand all
30 #include "chrome/browser/download/download_service_factory.h" 30 #include "chrome/browser/download/download_service_factory.h"
31 #include "chrome/browser/download/download_stats.h" 31 #include "chrome/browser/download/download_stats.h"
32 #include "chrome/browser/extensions/devtools_util.h" 32 #include "chrome/browser/extensions/devtools_util.h"
33 #include "chrome/browser/extensions/extension_service.h" 33 #include "chrome/browser/extensions/extension_service.h"
34 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" 34 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h"
35 #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"
36 #include "chrome/browser/password_manager/chrome_password_manager_client.h" 36 #include "chrome/browser/password_manager/chrome_password_manager_client.h"
37 #include "chrome/browser/plugins/chrome_plugin_service_filter.h" 37 #include "chrome/browser/plugins/chrome_plugin_service_filter.h"
38 #include "chrome/browser/prefs/incognito_mode_prefs.h" 38 #include "chrome/browser/prefs/incognito_mode_prefs.h"
39 #include "chrome/browser/profiles/profile.h" 39 #include "chrome/browser/profiles/profile.h"
40 #include "chrome/browser/profiles/profile_avatar_icon_util.h"
41 #include "chrome/browser/profiles/profile_info_cache.h"
40 #include "chrome/browser/profiles/profile_io_data.h" 42 #include "chrome/browser/profiles/profile_io_data.h"
43 #include "chrome/browser/profiles/profile_manager.h"
44 #include "chrome/browser/profiles/profile_window.h"
41 #include "chrome/browser/renderer_context_menu/context_menu_content_type_factory .h" 45 #include "chrome/browser/renderer_context_menu/context_menu_content_type_factory .h"
42 #include "chrome/browser/renderer_context_menu/spellchecker_submenu_observer.h" 46 #include "chrome/browser/renderer_context_menu/spellchecker_submenu_observer.h"
43 #include "chrome/browser/renderer_context_menu/spelling_menu_observer.h" 47 #include "chrome/browser/renderer_context_menu/spelling_menu_observer.h"
44 #include "chrome/browser/search/search.h" 48 #include "chrome/browser/search/search.h"
45 #include "chrome/browser/search_engines/template_url_service_factory.h" 49 #include "chrome/browser/search_engines/template_url_service_factory.h"
46 #include "chrome/browser/spellchecker/spellcheck_host_metrics.h" 50 #include "chrome/browser/spellchecker/spellcheck_host_metrics.h"
47 #include "chrome/browser/spellchecker/spellcheck_service.h" 51 #include "chrome/browser/spellchecker/spellcheck_service.h"
48 #include "chrome/browser/tab_contents/retargeting_details.h" 52 #include "chrome/browser/tab_contents/retargeting_details.h"
49 #include "chrome/browser/translate/chrome_translate_client.h" 53 #include "chrome/browser/translate/chrome_translate_client.h"
50 #include "chrome/browser/translate/translate_service.h" 54 #include "chrome/browser/translate/translate_service.h"
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 {58, IDC_SPELLCHECK_SUGGESTION_0}, 222 {58, IDC_SPELLCHECK_SUGGESTION_0},
219 {59, IDC_SPELLCHECK_ADD_TO_DICTIONARY}, 223 {59, IDC_SPELLCHECK_ADD_TO_DICTIONARY},
220 {60, IDC_SPELLPANEL_TOGGLE}, 224 {60, IDC_SPELLPANEL_TOGGLE},
221 {61, IDC_CONTENT_CONTEXT_OPEN_ORIGINAL_IMAGE_NEW_TAB}, 225 {61, IDC_CONTENT_CONTEXT_OPEN_ORIGINAL_IMAGE_NEW_TAB},
222 {62, IDC_WRITING_DIRECTION_MENU}, 226 {62, IDC_WRITING_DIRECTION_MENU},
223 {63, IDC_WRITING_DIRECTION_DEFAULT}, 227 {63, IDC_WRITING_DIRECTION_DEFAULT},
224 {64, IDC_WRITING_DIRECTION_LTR}, 228 {64, IDC_WRITING_DIRECTION_LTR},
225 {65, IDC_WRITING_DIRECTION_RTL}, 229 {65, IDC_WRITING_DIRECTION_RTL},
226 {66, IDC_CONTENT_CONTEXT_SHOW_ORIGINAL_IMAGE}, 230 {66, IDC_CONTENT_CONTEXT_SHOW_ORIGINAL_IMAGE},
227 {67, IDC_CONTENT_CONTEXT_FORCESAVEPASSWORD}, 231 {67, IDC_CONTENT_CONTEXT_FORCESAVEPASSWORD},
232 {68, IDC_OPEN_LINK_IN_PROFILE_FIRST},
228 // Add new items here and use |enum_id| from the next line. 233 // Add new items here and use |enum_id| from the next line.
229 // Also, add new items to RenderViewContextMenuItem enum in histograms.xml. 234 // Also, add new items to RenderViewContextMenuItem enum in histograms.xml.
230 {68, 0}, // Must be the last. Increment |enum_id| when new IDC was added. 235 {69, 0}, // Must be the last. Increment |enum_id| when new IDC was added.
231 }; 236 };
232 237
233 // Collapses large ranges of ids before looking for UMA enum. 238 // Collapses large ranges of ids before looking for UMA enum.
234 int CollapseCommandsForUMA(int id) { 239 int CollapseCommandsForUMA(int id) {
235 DCHECK(!RenderViewContextMenu::IsContentCustomCommandId(id)); 240 DCHECK(!RenderViewContextMenu::IsContentCustomCommandId(id));
236 DCHECK(!ContextMenuMatcher::IsExtensionsCustomCommandId(id)); 241 DCHECK(!ContextMenuMatcher::IsExtensionsCustomCommandId(id));
237 242
238 if (id >= IDC_CONTENT_CONTEXT_PROTOCOL_HANDLER_FIRST && 243 if (id >= IDC_CONTENT_CONTEXT_PROTOCOL_HANDLER_FIRST &&
239 id <= IDC_CONTENT_CONTEXT_PROTOCOL_HANDLER_LAST) { 244 id <= IDC_CONTENT_CONTEXT_PROTOCOL_HANDLER_LAST) {
240 return IDC_CONTENT_CONTEXT_PROTOCOL_HANDLER_FIRST; 245 return IDC_CONTENT_CONTEXT_PROTOCOL_HANDLER_FIRST;
241 } 246 }
242 247
243 if (id >= IDC_SPELLCHECK_LANGUAGES_FIRST && 248 if (id >= IDC_SPELLCHECK_LANGUAGES_FIRST &&
244 id <= IDC_SPELLCHECK_LANGUAGES_LAST) { 249 id <= IDC_SPELLCHECK_LANGUAGES_LAST) {
245 return IDC_SPELLCHECK_LANGUAGES_FIRST; 250 return IDC_SPELLCHECK_LANGUAGES_FIRST;
246 } 251 }
247 252
248 if (id >= IDC_SPELLCHECK_SUGGESTION_0 && 253 if (id >= IDC_SPELLCHECK_SUGGESTION_0 &&
249 id <= IDC_SPELLCHECK_SUGGESTION_LAST) { 254 id <= IDC_SPELLCHECK_SUGGESTION_LAST) {
250 return IDC_SPELLCHECK_SUGGESTION_0; 255 return IDC_SPELLCHECK_SUGGESTION_0;
251 } 256 }
252 257
258 if (id >= IDC_OPEN_LINK_IN_PROFILE_FIRST &&
259 id <= IDC_OPEN_LINK_IN_PROFILE_LAST) {
260 return IDC_OPEN_LINK_IN_PROFILE_FIRST;
261 }
262
253 return id; 263 return id;
254 } 264 }
255 265
256 // Returns UMA enum value for command specified by |id| or -1 if not found. 266 // Returns UMA enum value for command specified by |id| or -1 if not found.
257 int FindUMAEnumValueForCommand(int id) { 267 int FindUMAEnumValueForCommand(int id) {
258 if (RenderViewContextMenu::IsContentCustomCommandId(id)) 268 if (RenderViewContextMenu::IsContentCustomCommandId(id))
259 return 0; 269 return 0;
260 270
261 if (ContextMenuMatcher::IsExtensionsCustomCommandId(id)) 271 if (ContextMenuMatcher::IsExtensionsCustomCommandId(id))
262 return 1; 272 return 1;
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 } 374 }
365 375
366 RenderViewContextMenu::RenderViewContextMenu( 376 RenderViewContextMenu::RenderViewContextMenu(
367 content::RenderFrameHost* render_frame_host, 377 content::RenderFrameHost* render_frame_host,
368 const content::ContextMenuParams& params) 378 const content::ContextMenuParams& params)
369 : RenderViewContextMenuBase(render_frame_host, params), 379 : RenderViewContextMenuBase(render_frame_host, params),
370 extension_items_(browser_context_, 380 extension_items_(browser_context_,
371 this, 381 this,
372 &menu_model_, 382 &menu_model_,
373 base::Bind(MenuItemMatchesParams, params_)), 383 base::Bind(MenuItemMatchesParams, params_)),
384 profile_link_submenu_model_(this),
374 protocol_handler_submenu_model_(this), 385 protocol_handler_submenu_model_(this),
375 protocol_handler_registry_( 386 protocol_handler_registry_(
376 ProtocolHandlerRegistryFactory::GetForBrowserContext(GetProfile())), 387 ProtocolHandlerRegistryFactory::GetForBrowserContext(GetProfile())),
377 embedder_web_contents_(GetWebContentsToUse(source_web_contents_)) { 388 embedder_web_contents_(GetWebContentsToUse(source_web_contents_)) {
378 if (!g_custom_id_ranges_initialized) { 389 if (!g_custom_id_ranges_initialized) {
379 g_custom_id_ranges_initialized = true; 390 g_custom_id_ranges_initialized = true;
380 SetContentCustomCommandIdRange(IDC_CONTENT_CONTEXT_CUSTOM_FIRST, 391 SetContentCustomCommandIdRange(IDC_CONTENT_CONTEXT_CUSTOM_FIRST,
381 IDC_CONTENT_CONTEXT_CUSTOM_LAST); 392 IDC_CONTENT_CONTEXT_CUSTOM_LAST);
382 } 393 }
383 set_content_type(ContextMenuContentTypeFactory::Create( 394 set_content_type(ContextMenuContentTypeFactory::Create(
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
725 void RenderViewContextMenu::AppendLinkItems() { 736 void RenderViewContextMenu::AppendLinkItems() {
726 if (!params_.link_url.is_empty()) { 737 if (!params_.link_url.is_empty()) {
727 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_OPENLINKNEWTAB, 738 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_OPENLINKNEWTAB,
728 IDS_CONTENT_CONTEXT_OPENLINKNEWTAB); 739 IDS_CONTENT_CONTEXT_OPENLINKNEWTAB);
729 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_OPENLINKNEWWINDOW, 740 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_OPENLINKNEWWINDOW,
730 IDS_CONTENT_CONTEXT_OPENLINKNEWWINDOW); 741 IDS_CONTENT_CONTEXT_OPENLINKNEWWINDOW);
731 if (params_.link_url.is_valid()) { 742 if (params_.link_url.is_valid()) {
732 AppendProtocolHandlerSubMenu(); 743 AppendProtocolHandlerSubMenu();
733 } 744 }
734 745
746 // g_browser_process->profile_manager() is NULL during unit tests.
747 if (g_browser_process->profile_manager() &&
748 GetProfile()->GetProfileType() == Profile::REGULAR_PROFILE) {
749 ProfileManager* profile_manager = g_browser_process->profile_manager();
750 const ProfileInfoCache& profile_info_cache =
751 profile_manager->GetProfileInfoCache();
752
753 // Find all regular profiles other than the current one which have at
754 // least one open window.
755 std::vector<Profile*> target_profiles;
756 std::vector<Profile*> all_profiles = profile_manager->GetLoadedProfiles();
757 chrome::HostDesktopType desktop_type =
758 chrome::GetHostDesktopTypeForNativeView(
759 source_web_contents_->GetNativeView());
760 for (Profile* profile : all_profiles) {
761 if ((profile->GetProfileType() == Profile::REGULAR_PROFILE) &&
762 (profile != GetProfile()) &&
763 chrome::FindLastActiveWithProfile(profile, desktop_type)) {
Peter Kasting 2015/06/16 08:20:24 Nit: {} not necessary
jochen (gone - plz use gerrit) 2015/06/16 09:01:50 done
764 target_profiles.push_back(profile);
765 }
766 }
767
768 if (target_profiles.size() == 1) {
769 Profile* profile = target_profiles[0];
770 size_t profile_index =
771 profile_info_cache.GetIndexOfProfileWithPath(profile->GetPath());
772 menu_model_.AddItem(
773 IDC_OPEN_LINK_IN_PROFILE_FIRST + profile_index,
774 l10n_util::GetStringFUTF16(
775 IDS_CONTENT_CONTEXT_OPENLINKINPROFILE,
776 profile_info_cache.GetNameOfProfileAtIndex(profile_index)));
777 } else if (target_profiles.size() > 1) {
778 for (Profile* profile: target_profiles) {
Peter Kasting 2015/06/16 08:20:24 Nit: space before colon
jochen (gone - plz use gerrit) 2015/06/16 09:01:50 done
779 size_t profile_index =
780 profile_info_cache.GetIndexOfProfileWithPath(profile->GetPath());
781 profile_link_submenu_model_.AddItem(
782 IDC_OPEN_LINK_IN_PROFILE_FIRST + profile_index,
783 profile_info_cache.GetNameOfProfileAtIndex(profile_index));
784 gfx::Image icon =
785 profile_info_cache.GetAvatarIconOfProfileAtIndex(profile_index);
786 int width = icon.Width();
787 int height = icon.Height();
788 gfx::CalculateFaviconTargetSize(&width, &height);
789 profile_link_submenu_model_.SetIcon(
790 profile_link_submenu_model_.GetItemCount() - 1,
791 profiles::GetSizedAvatarIcon(icon, true, width, height));
792 }
793 menu_model_.AddSubMenuWithStringId(
794 IDC_CONTENT_CONTEXT_OPENLINKINPROFILE,
795 IDS_CONTENT_CONTEXT_OPENLINKINPROFILES,
796 &profile_link_submenu_model_);
797 }
798 }
799
735 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_OPENLINKOFFTHERECORD, 800 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_OPENLINKOFFTHERECORD,
736 IDS_CONTENT_CONTEXT_OPENLINKOFFTHERECORD); 801 IDS_CONTENT_CONTEXT_OPENLINKOFFTHERECORD);
737 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_SAVELINKAS, 802 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_SAVELINKAS,
738 IDS_CONTENT_CONTEXT_SAVELINKAS); 803 IDS_CONTENT_CONTEXT_SAVELINKAS);
739 } 804 }
740 805
741 menu_model_.AddItemWithStringId( 806 menu_model_.AddItemWithStringId(
742 IDC_CONTENT_CONTEXT_COPYLINKLOCATION, 807 IDC_CONTENT_CONTEXT_COPYLINKLOCATION,
743 params_.link_url.SchemeIs(url::kMailToScheme) ? 808 params_.link_url.SchemeIs(url::kMailToScheme) ?
744 IDS_CONTENT_CONTEXT_COPYEMAILADDRESS : 809 IDS_CONTENT_CONTEXT_COPYEMAILADDRESS :
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
1087 1152
1088 // Extension items. 1153 // Extension items.
1089 if (ContextMenuMatcher::IsExtensionsCustomCommandId(id)) 1154 if (ContextMenuMatcher::IsExtensionsCustomCommandId(id))
1090 return extension_items_.IsCommandIdEnabled(id); 1155 return extension_items_.IsCommandIdEnabled(id);
1091 1156
1092 if (id >= IDC_CONTENT_CONTEXT_PROTOCOL_HANDLER_FIRST && 1157 if (id >= IDC_CONTENT_CONTEXT_PROTOCOL_HANDLER_FIRST &&
1093 id <= IDC_CONTENT_CONTEXT_PROTOCOL_HANDLER_LAST) { 1158 id <= IDC_CONTENT_CONTEXT_PROTOCOL_HANDLER_LAST) {
1094 return true; 1159 return true;
1095 } 1160 }
1096 1161
1162 if (id >= IDC_OPEN_LINK_IN_PROFILE_FIRST &&
1163 id <= IDC_OPEN_LINK_IN_PROFILE_LAST) {
1164 return params_.link_url.is_valid();
1165 }
1166
1097 IncognitoModePrefs::Availability incognito_avail = 1167 IncognitoModePrefs::Availability incognito_avail =
1098 IncognitoModePrefs::GetAvailability(prefs); 1168 IncognitoModePrefs::GetAvailability(prefs);
1099 switch (id) { 1169 switch (id) {
1100 case IDC_BACK: 1170 case IDC_BACK:
1101 return embedder_web_contents_->GetController().CanGoBack(); 1171 return embedder_web_contents_->GetController().CanGoBack();
1102 1172
1103 case IDC_FORWARD: 1173 case IDC_FORWARD:
1104 return embedder_web_contents_->GetController().CanGoForward(); 1174 return embedder_web_contents_->GetController().CanGoForward();
1105 1175
1106 case IDC_RELOAD: { 1176 case IDC_RELOAD: {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
1153 // There are some application locales which can't be used as a 1223 // There are some application locales which can't be used as a
1154 // target language for translation. 1224 // target language for translation.
1155 translate::TranslateDownloadManager::IsSupportedLanguage( 1225 translate::TranslateDownloadManager::IsSupportedLanguage(
1156 target_lang) && 1226 target_lang) &&
1157 // Disable on the Instant Extended NTP. 1227 // Disable on the Instant Extended NTP.
1158 !chrome::IsInstantNTP(embedder_web_contents_); 1228 !chrome::IsInstantNTP(embedder_web_contents_);
1159 } 1229 }
1160 1230
1161 case IDC_CONTENT_CONTEXT_OPENLINKNEWTAB: 1231 case IDC_CONTENT_CONTEXT_OPENLINKNEWTAB:
1162 case IDC_CONTENT_CONTEXT_OPENLINKNEWWINDOW: 1232 case IDC_CONTENT_CONTEXT_OPENLINKNEWWINDOW:
1233 case IDC_CONTENT_CONTEXT_OPENLINKINPROFILE:
1163 return params_.link_url.is_valid(); 1234 return params_.link_url.is_valid();
1164 1235
1165 case IDC_CONTENT_CONTEXT_COPYLINKLOCATION: 1236 case IDC_CONTENT_CONTEXT_COPYLINKLOCATION:
1166 return params_.unfiltered_link_url.is_valid(); 1237 return params_.unfiltered_link_url.is_valid();
1167 1238
1168 case IDC_CONTENT_CONTEXT_SAVELINKAS: { 1239 case IDC_CONTENT_CONTEXT_SAVELINKAS: {
1169 PrefService* local_state = g_browser_process->local_state(); 1240 PrefService* local_state = g_browser_process->local_state();
1170 DCHECK(local_state); 1241 DCHECK(local_state);
1171 // Test if file-selection dialogs are forbidden by policy. 1242 // Test if file-selection dialogs are forbidden by policy.
1172 if (!local_state->GetBoolean(prefs::kAllowFileSelectionDialogs)) 1243 if (!local_state->GetBoolean(prefs::kAllowFileSelectionDialogs))
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
1410 int handlerIndex = id - IDC_CONTENT_CONTEXT_PROTOCOL_HANDLER_FIRST; 1481 int handlerIndex = id - IDC_CONTENT_CONTEXT_PROTOCOL_HANDLER_FIRST;
1411 WindowOpenDisposition disposition = 1482 WindowOpenDisposition disposition =
1412 ForceNewTabDispositionFromEventFlags(event_flags); 1483 ForceNewTabDispositionFromEventFlags(event_flags);
1413 OpenURL(handlers[handlerIndex].TranslateUrl(params_.link_url), 1484 OpenURL(handlers[handlerIndex].TranslateUrl(params_.link_url),
1414 GetDocumentURL(params_), 1485 GetDocumentURL(params_),
1415 disposition, 1486 disposition,
1416 ui::PAGE_TRANSITION_LINK); 1487 ui::PAGE_TRANSITION_LINK);
1417 return; 1488 return;
1418 } 1489 }
1419 1490
1491 if (id >= IDC_OPEN_LINK_IN_PROFILE_FIRST &&
1492 id <= IDC_OPEN_LINK_IN_PROFILE_LAST) {
1493 ProfileManager* profile_manager = g_browser_process->profile_manager();
1494 const ProfileInfoCache& profile_info_cache =
1495 profile_manager->GetProfileInfoCache();
1496
1497 base::FilePath profile_path = profile_info_cache.GetPathOfProfileAtIndex(
1498 id - IDC_OPEN_LINK_IN_PROFILE_FIRST);
1499 Profile* profile = profile_manager->GetProfileByPath(profile_path);
1500 DCHECK(profile);
1501
1502 chrome::HostDesktopType desktop_type =
1503 chrome::GetHostDesktopTypeForNativeView(
1504 source_web_contents_->GetNativeView());
1505
1506 Browser* browser = chrome::FindLastActiveWithProfile(profile, desktop_type);
1507 chrome::NavigateParams nav_params(browser, params_.link_url,
1508 ui::PAGE_TRANSITION_LINK);
1509 nav_params.disposition = NEW_FOREGROUND_TAB;
1510 nav_params.referrer = content::Referrer::SanitizeForRequest(
1511 params_.link_url,
1512 content::Referrer(GetDocumentURL(params_).GetAsReferrer(),
1513 params_.referrer_policy));
1514 nav_params.window_action = chrome::NavigateParams::SHOW_WINDOW;
1515 if (!browser) {
1516 profiles::FindOrCreateNewWindowForProfile(
1517 profile, chrome::startup::IS_NOT_PROCESS_STARTUP,
1518 chrome::startup::IS_NOT_FIRST_RUN, desktop_type,
1519 false /* always_create */);
1520 nav_params.browser =
1521 chrome::FindLastActiveWithProfile(profile, desktop_type);
1522 DCHECK(nav_params.browser);
1523 nav_params.disposition = CURRENT_TAB;
1524 }
1525 chrome::Navigate(&nav_params);
1526 return;
1527 }
1528
1420 switch (id) { 1529 switch (id) {
1421 case IDC_CONTENT_CONTEXT_OPENLINKNEWTAB: { 1530 case IDC_CONTENT_CONTEXT_OPENLINKNEWTAB: {
1422 Browser* browser = 1531 Browser* browser =
1423 chrome::FindBrowserWithWebContents(source_web_contents_); 1532 chrome::FindBrowserWithWebContents(source_web_contents_);
1424 OpenURL(params_.link_url, 1533 OpenURL(params_.link_url,
1425 GetDocumentURL(params_), 1534 GetDocumentURL(params_),
1426 !browser || browser->is_app() ? 1535 !browser || browser->is_app() ?
1427 NEW_FOREGROUND_TAB : NEW_BACKGROUND_TAB, 1536 NEW_FOREGROUND_TAB : NEW_BACKGROUND_TAB,
1428 ui::PAGE_TRANSITION_LINK); 1537 ui::PAGE_TRANSITION_LINK);
1429 break; 1538 break;
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
1910 source_web_contents_->GetRenderViewHost()-> 2019 source_web_contents_->GetRenderViewHost()->
1911 ExecuteMediaPlayerActionAtLocation(location, action); 2020 ExecuteMediaPlayerActionAtLocation(location, action);
1912 } 2021 }
1913 2022
1914 void RenderViewContextMenu::PluginActionAt( 2023 void RenderViewContextMenu::PluginActionAt(
1915 const gfx::Point& location, 2024 const gfx::Point& location,
1916 const WebPluginAction& action) { 2025 const WebPluginAction& action) {
1917 source_web_contents_->GetRenderViewHost()-> 2026 source_web_contents_->GetRenderViewHost()->
1918 ExecutePluginActionAtLocation(location, action); 2027 ExecutePluginActionAtLocation(location, action);
1919 } 2028 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698