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

Unified Diff: chrome/browser/renderer_context_menu/render_view_context_menu.cc

Issue 2086333002: Only show the open link as user context menu if at least one of the profiles is open (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: updates Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/renderer_context_menu/render_view_context_menu_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/renderer_context_menu/render_view_context_menu.cc
diff --git a/chrome/browser/renderer_context_menu/render_view_context_menu.cc b/chrome/browser/renderer_context_menu/render_view_context_menu.cc
index aaf2906982487c387e06949519951fa0c96789b3..9ee64a489c8dee5f0fef456dfd62d3642a07b5c7 100644
--- a/chrome/browser/renderer_context_menu/render_view_context_menu.cc
+++ b/chrome/browser/renderer_context_menu/render_view_context_menu.cc
@@ -1005,35 +1005,37 @@ void RenderViewContextMenu::AppendLinkItems() {
kOpenLinkAsUserMaxProfilesReported);
}
- if (target_profiles_entries.size() == 1u) {
- int menu_index = static_cast<int>(profile_link_paths_.size());
- ProfileAttributesEntry* entry = target_profiles_entries.front();
- profile_link_paths_.push_back(entry->GetPath());
- menu_model_.AddItem(
- IDC_OPEN_LINK_IN_PROFILE_FIRST + menu_index,
- l10n_util::GetStringFUTF16(IDS_CONTENT_CONTEXT_OPENLINKINPROFILE,
- entry->GetName()));
- AddAvatarToLastMenuItem(entry->GetAvatarIcon(), &menu_model_);
- } else if (target_profiles_entries.size() > 1u) {
- for (ProfileAttributesEntry* entry : target_profiles_entries) {
+ if (multiple_profiles_open_ && !target_profiles_entries.empty()) {
+ if (target_profiles_entries.size() == 1) {
int menu_index = static_cast<int>(profile_link_paths_.size());
- // In extreme cases, we might have more profiles than available
- // command ids. In that case, just stop creating new entries - the
- // menu is probably useless at this point already.
- if (IDC_OPEN_LINK_IN_PROFILE_FIRST + menu_index >
- IDC_OPEN_LINK_IN_PROFILE_LAST) {
- break;
- }
+ ProfileAttributesEntry* entry = target_profiles_entries.front();
profile_link_paths_.push_back(entry->GetPath());
- profile_link_submenu_model_.AddItem(
- IDC_OPEN_LINK_IN_PROFILE_FIRST + menu_index, entry->GetName());
- AddAvatarToLastMenuItem(entry->GetAvatarIcon(),
- &profile_link_submenu_model_);
+ menu_model_.AddItem(
+ IDC_OPEN_LINK_IN_PROFILE_FIRST + menu_index,
+ l10n_util::GetStringFUTF16(IDS_CONTENT_CONTEXT_OPENLINKINPROFILE,
+ entry->GetName()));
+ AddAvatarToLastMenuItem(entry->GetAvatarIcon(), &menu_model_);
+ } else {
+ for (ProfileAttributesEntry* entry : target_profiles_entries) {
+ int menu_index = static_cast<int>(profile_link_paths_.size());
+ // In extreme cases, we might have more profiles than available
+ // command ids. In that case, just stop creating new entries - the
+ // menu is probably useless at this point already.
+ if (IDC_OPEN_LINK_IN_PROFILE_FIRST + menu_index >
+ IDC_OPEN_LINK_IN_PROFILE_LAST) {
+ break;
+ }
+ profile_link_paths_.push_back(entry->GetPath());
+ profile_link_submenu_model_.AddItem(
+ IDC_OPEN_LINK_IN_PROFILE_FIRST + menu_index, entry->GetName());
+ AddAvatarToLastMenuItem(entry->GetAvatarIcon(),
+ &profile_link_submenu_model_);
+ }
+ menu_model_.AddSubMenuWithStringId(
+ IDC_CONTENT_CONTEXT_OPENLINKINPROFILE,
+ IDS_CONTENT_CONTEXT_OPENLINKINPROFILES,
+ &profile_link_submenu_model_);
}
- menu_model_.AddSubMenuWithStringId(
- IDC_CONTENT_CONTEXT_OPENLINKINPROFILE,
- IDS_CONTENT_CONTEXT_OPENLINKINPROFILES,
- &profile_link_submenu_model_);
}
}
#endif // !defined(OS_CHROMEOS)
« no previous file with comments | « no previous file | chrome/browser/renderer_context_menu/render_view_context_menu_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698