Chromium Code Reviews| 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..cfdef0e767555ca7f41a6dc93c722120254538e3 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_) { |
|
Peter Kasting
2016/06/22 22:53:21
Nit: If you change this to "if (multiple_profiles_
jochen (gone - plz use gerrit)
2016/06/23 09:21:07
the idea is that you need to have at least one add
Peter Kasting
2016/06/23 09:26:13
I don't understand how this reply has anything to
Peter Kasting
2016/06/23 09:39:02
Please reply on the comment thread in question nex
jochen (gone - plz use gerrit)
2016/06/23 09:43:33
ah, thanks for clarifying. updated the CL.
|
| + if (target_profiles_entries.size() == 1u) { |
|
Peter Kasting
2016/06/22 22:53:21
Nit: Remove 'u' suffix (2 places)
|
| 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 if (target_profiles_entries.size() > 1u) { |
| + 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) |