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

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

Issue 1142923002: Add a "Save password" item to the context menu. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 5 years, 7 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
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 3c5e9a0f5346255c6f231d7a99b227bee6f1430d..2c54f9709bb2615ed44fe955b473458a6246361e 100644
--- a/chrome/browser/renderer_context_menu/render_view_context_menu.cc
+++ b/chrome/browser/renderer_context_menu/render_view_context_menu.cc
@@ -66,6 +66,7 @@
#include "components/google/core/browser/google_util.h"
#include "components/metrics/proto/omnibox_input_type.pb.h"
#include "components/omnibox/autocomplete_match.h"
+#include "components/password_manager/core/common/experiments.h"
#include "components/search_engines/template_url.h"
#include "components/search_engines/template_url_service.h"
#include "components/translate/core/browser/translate_download_manager.h"
@@ -222,9 +223,10 @@ const struct UmaEnumCommandIdPair {
{64, IDC_WRITING_DIRECTION_LTR},
{65, IDC_WRITING_DIRECTION_RTL},
{66, IDC_CONTENT_CONTEXT_SHOW_ORIGINAL_IMAGE},
+ {67, IDC_CONTENT_CONTEXT_FORCESAVEPASSWORD},
// Add new items here and use |enum_id| from the next line.
// Also, add new items to RenderViewContextMenuItem enum in histograms.xml.
- {67, 0}, // Must be the last. Increment |enum_id| when new IDC was added.
+ {68, 0}, // Must be the last. Increment |enum_id| when new IDC was added.
};
// Collapses large ranges of ids before looking for UMA enum.
@@ -629,6 +631,11 @@ void RenderViewContextMenu::InitMenu() {
ContextMenuContentType::ITEM_GROUP_PRINT_PREVIEW)) {
AppendPrintPreviewItems();
}
+
+ if (content_type_->SupportsGroup(
+ ContextMenuContentType::ITEM_GROUP_PASSWORD)) {
+ AppendPasswordItems();
+ }
}
Profile* RenderViewContextMenu::GetProfile() {
@@ -1038,6 +1045,15 @@ void RenderViewContextMenu::AppendProtocolHandlerSubMenu() {
&protocol_handler_submenu_model_);
}
+void RenderViewContextMenu::AppendPasswordItems() {
+ if (!password_manager::ForceSavingExperimentEnabled())
+ return;
+
+ menu_model_.AddSeparator(ui::NORMAL_SEPARATOR);
+ menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_FORCESAVEPASSWORD,
+ IDS_CONTENT_CONTEXT_FORCESAVEPASSWORD);
+}
+
// Menu delegate functions -----------------------------------------------------
bool RenderViewContextMenu::IsCommandIdEnabled(int id) const {
@@ -1340,6 +1356,9 @@ bool RenderViewContextMenu::IsCommandIdEnabled(int id) const {
case IDC_CONTENT_CONTEXT_PROTOCOL_HANDLER_SETTINGS:
return true;
+ case IDC_CONTENT_CONTEXT_FORCESAVEPASSWORD:
+ return true;
+
default:
NOTREACHED();
return false;
@@ -1780,6 +1799,10 @@ void RenderViewContextMenu::ExecuteCommand(int id, int event_flags) {
break;
}
+ case IDC_CONTENT_CONTEXT_FORCESAVEPASSWORD:
+ // TODO(msramek): Force-save the password.
+ break;
+
default:
NOTREACHED();
break;

Powered by Google App Engine
This is Rietveld 408576698