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

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

Issue 2692913003: Move save/generate password options to the top of the context menu (Closed)
Patch Set: Revert generated_resources.grd Created 3 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <set> 10 #include <set>
(...skipping 1449 matching lines...) Expand 10 before | Expand all | Expand 10 after
1460 l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_OPENLINKWITH_CONFIGURE)); 1460 l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_OPENLINKWITH_CONFIGURE));
1461 1461
1462 menu_model_.AddSubMenu( 1462 menu_model_.AddSubMenu(
1463 IDC_CONTENT_CONTEXT_OPENLINKWITH, 1463 IDC_CONTENT_CONTEXT_OPENLINKWITH,
1464 l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_OPENLINKWITH), 1464 l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_OPENLINKWITH),
1465 &protocol_handler_submenu_model_); 1465 &protocol_handler_submenu_model_);
1466 } 1466 }
1467 1467
1468 void RenderViewContextMenu::AppendPasswordItems() { 1468 void RenderViewContextMenu::AppendPasswordItems() {
1469 bool separator_added = false; 1469 bool separator_added = false;
1470 int menu_position = 0;
1470 if (password_manager::ForceSavingExperimentEnabled()) { 1471 if (password_manager::ForceSavingExperimentEnabled()) {
1471 menu_model_.AddSeparator(ui::NORMAL_SEPARATOR); 1472 menu_model_.InsertItemWithStringIdAt(menu_position,
lazyboy 2017/02/14 19:26:41 instead of using mix of menu_position, ++menu_posi
edwardjung 2017/02/14 20:17:21 Of course. yes this is much simpler and removes th
1473 IDC_CONTENT_CONTEXT_FORCESAVEPASSWORD,
1474 IDS_CONTENT_CONTEXT_FORCESAVEPASSWORD);
1475 menu_model_.InsertSeparatorAt(++menu_position, ui::NORMAL_SEPARATOR);
1472 separator_added = true; 1476 separator_added = true;
1473 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_FORCESAVEPASSWORD,
1474 IDS_CONTENT_CONTEXT_FORCESAVEPASSWORD);
1475 } 1477 }
1476 if (password_manager::ManualPasswordGenerationEnabled()) { 1478 if (password_manager::ManualPasswordGenerationEnabled()) {
1479 menu_model_.InsertItemWithStringIdAt(menu_position,
1480 IDC_CONTENT_CONTEXT_GENERATEPASSWORD,
1481 IDS_CONTENT_CONTEXT_GENERATEPASSWORD);
1477 if (!separator_added) 1482 if (!separator_added)
1478 menu_model_.AddSeparator(ui::NORMAL_SEPARATOR); 1483 menu_model_.InsertSeparatorAt(menu_position + 1, ui::NORMAL_SEPARATOR);
1479 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_GENERATEPASSWORD,
1480 IDS_CONTENT_CONTEXT_GENERATEPASSWORD);
1481 } 1484 }
1482 } 1485 }
1483 1486
1484 // Menu delegate functions ----------------------------------------------------- 1487 // Menu delegate functions -----------------------------------------------------
1485 1488
1486 bool RenderViewContextMenu::IsCommandIdEnabled(int id) const { 1489 bool RenderViewContextMenu::IsCommandIdEnabled(int id) const {
1487 { 1490 {
1488 bool enabled = false; 1491 bool enabled = false;
1489 if (RenderViewContextMenuBase::IsCommandIdKnown(id, &enabled)) 1492 if (RenderViewContextMenuBase::IsCommandIdKnown(id, &enabled))
1490 return enabled; 1493 return enabled;
(...skipping 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after
2524 void RenderViewContextMenu::PluginActionAt( 2527 void RenderViewContextMenu::PluginActionAt(
2525 const gfx::Point& location, 2528 const gfx::Point& location,
2526 const WebPluginAction& action) { 2529 const WebPluginAction& action) {
2527 source_web_contents_->GetRenderViewHost()-> 2530 source_web_contents_->GetRenderViewHost()->
2528 ExecutePluginActionAtLocation(location, action); 2531 ExecutePluginActionAtLocation(location, action);
2529 } 2532 }
2530 2533
2531 Browser* RenderViewContextMenu::GetBrowser() const { 2534 Browser* RenderViewContextMenu::GetBrowser() const {
2532 return chrome::FindBrowserWithWebContents(embedder_web_contents_); 2535 return chrome::FindBrowserWithWebContents(embedder_web_contents_);
2533 } 2536 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698