summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsargrass@google.com <sargrass@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-18 18:45:05 +0000
committersargrass@google.com <sargrass@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-18 18:45:05 +0000
commit7dc32b81d5947c6817c44792940f9f8b957184e7 (patch)
treeb939ea94c95fccd92a017331ae8b5f0c8e0ca624
parent8a880c328848de5dbef6e081a7f3e0c847672aed (diff)
downloadchromium_src-7dc32b81d5947c6817c44792940f9f8b957184e7.zip
chromium_src-7dc32b81d5947c6817c44792940f9f8b957184e7.tar.gz
chromium_src-7dc32b81d5947c6817c44792940f9f8b957184e7.tar.bz2
Make the saved passwords tab work.
BUG=49093 TEST=None Review URL: http://codereview.chromium.org/3194002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@56571 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/dom_ui/options_ui.cc2
-rw-r--r--chrome/browser/dom_ui/passwords_exceptions_handler.cc48
-rw-r--r--chrome/browser/dom_ui/passwords_exceptions_handler.h14
-rw-r--r--chrome/browser/dom_ui/passwords_remove_all_handler.cc41
-rw-r--r--chrome/browser/dom_ui/passwords_remove_all_handler.h26
-rw-r--r--chrome/browser/resources/options.html4
-rw-r--r--chrome/browser/resources/options/passwords_exceptions.html5
-rw-r--r--chrome/browser/resources/options/passwords_exceptions.js34
-rw-r--r--chrome/browser/resources/options/passwords_exceptions_list.js134
-rw-r--r--chrome/browser/resources/options/passwords_remove_all_overlay.html7
-rw-r--r--chrome/browser/resources/options/passwords_remove_all_overlay.js50
-rw-r--r--chrome/chrome_browser.gypi2
12 files changed, 311 insertions, 56 deletions
diff --git a/chrome/browser/dom_ui/options_ui.cc b/chrome/browser/dom_ui/options_ui.cc
index 7708cac..525a07b 100644
--- a/chrome/browser/dom_ui/options_ui.cc
+++ b/chrome/browser/dom_ui/options_ui.cc
@@ -28,6 +28,7 @@
#include "chrome/browser/dom_ui/font_settings_handler.h"
#include "chrome/browser/dom_ui/import_data_handler.h"
#include "chrome/browser/dom_ui/passwords_exceptions_handler.h"
+#include "chrome/browser/dom_ui/passwords_remove_all_handler.h"
#include "chrome/browser/dom_ui/personal_options_handler.h"
#include "chrome/browser/dom_ui/search_engine_manager_handler.h"
#include "chrome/browser/dom_ui/stop_syncing_handler.h"
@@ -137,6 +138,7 @@ OptionsUI::OptionsUI(TabContents* contents) : DOMUI(contents) {
AddOptionsPageUIHandler(localized_strings, new ContentSettingsHandler());
AddOptionsPageUIHandler(localized_strings, new FontSettingsHandler());
AddOptionsPageUIHandler(localized_strings, new PasswordsExceptionsHandler());
+ AddOptionsPageUIHandler(localized_strings, new PasswordsRemoveAllHandler());
AddOptionsPageUIHandler(localized_strings, new PersonalOptionsHandler());
AddOptionsPageUIHandler(localized_strings, new SearchEngineManagerHandler());
AddOptionsPageUIHandler(localized_strings, new ImportDataHandler());
diff --git a/chrome/browser/dom_ui/passwords_exceptions_handler.cc b/chrome/browser/dom_ui/passwords_exceptions_handler.cc
index c41bf10..ecd72ed 100644
--- a/chrome/browser/dom_ui/passwords_exceptions_handler.cc
+++ b/chrome/browser/dom_ui/passwords_exceptions_handler.cc
@@ -6,6 +6,7 @@
#include "app/l10n_util.h"
#include "base/callback.h"
+#include "base/stl_util-inl.h"
#include "base/string_number_conversions.h"
#include "base/utf_string_conversions.h"
#include "base/values.h"
@@ -64,8 +65,17 @@ void PasswordsExceptionsHandler::RegisterMessages() {
"loadSavedPasswords",
NewCallback(this, &PasswordsExceptionsHandler::LoadSavedPasswords));
dom_ui_->RegisterMessageCallback(
- "removeAutofillable",
- NewCallback(this, &PasswordsExceptionsHandler::RemoveEntry));
+ "removeSavedPassword",
+ NewCallback(this, &PasswordsExceptionsHandler::RemoveSavedPassword));
+ dom_ui_->RegisterMessageCallback(
+ "removePasswordException",
+ NewCallback(this, &PasswordsExceptionsHandler::RemovePasswordsException));
+ dom_ui_->RegisterMessageCallback(
+ "removeAllSavedPasswords",
+ NewCallback(this, &PasswordsExceptionsHandler::RemoveAllSavedPasswords));
+ dom_ui_->RegisterMessageCallback(
+ "removeAllPasswordExceptions", NewCallback(
+ this, &PasswordsExceptionsHandler::RemoveAllPasswordsExceptions));
dom_ui_->RegisterMessageCallback(
"showSelectedPassword",
NewCallback(this, &PasswordsExceptionsHandler::ShowSelectedPassword));
@@ -79,7 +89,7 @@ void PasswordsExceptionsHandler::LoadSavedPasswords(const Value* value) {
populater_.Populate();
}
-void PasswordsExceptionsHandler::RemoveEntry(const Value* value) {
+void PasswordsExceptionsHandler::RemoveSavedPassword(const Value* value) {
if (!value || !value->IsType(Value::TYPE_LIST)) {
NOTREACHED();
return;
@@ -101,6 +111,38 @@ void PasswordsExceptionsHandler::RemoveEntry(const Value* value) {
SetPasswordList();
}
+void PasswordsExceptionsHandler::RemovePasswordsException(const Value* value) {
+ if (!value || !value->IsType(Value::TYPE_LIST)) {
+ NOTREACHED();
+ return;
+ }
+
+ const ListValue* param_values = static_cast<const ListValue*>(value);
+ std::string string_value;
+ if (param_values->GetSize() != 1 ||
+ !param_values->GetString(0, &string_value)) {
+ NOTREACHED();
+ return;
+ }
+ int selected_index;
+ base::StringToInt(string_value, &selected_index);
+
+ //TODO(sargrass): remove selected password exception
+}
+
+void PasswordsExceptionsHandler::RemoveAllSavedPasswords(const Value* value) {
+ PasswordStore* store = GetPasswordStore();
+ for (size_t i = 0; i < password_list_.size(); ++i)
+ store->RemoveLogin(*password_list_[i]);
+ STLDeleteElements(&password_list_);
+ SetPasswordList();
+}
+
+void PasswordsExceptionsHandler::RemoveAllPasswordsExceptions(
+ const Value* value) {
+ //TOD(sargrass): remove all password exception
+}
+
void PasswordsExceptionsHandler::ShowSelectedPassword(const Value* value) {
if (!value || !value->IsType(Value::TYPE_LIST)) {
NOTREACHED();
diff --git a/chrome/browser/dom_ui/passwords_exceptions_handler.h b/chrome/browser/dom_ui/passwords_exceptions_handler.h
index 1738125..fba40dd 100644
--- a/chrome/browser/dom_ui/passwords_exceptions_handler.h
+++ b/chrome/browser/dom_ui/passwords_exceptions_handler.h
@@ -28,9 +28,19 @@ class PasswordsExceptionsHandler : public OptionsPageUIHandler {
// Fired when user clicks 'show saved passwords' button in personal page.
void LoadSavedPasswords(const Value* value);
- // Remove an entry.
+ // Remove a saved password.
// @param value the entry index to be removed.
- void RemoveEntry(const Value* value);
+ void RemoveSavedPassword(const Value* value);
+
+ // Remove an password exception.
+ // @param value the entry index to be removed.
+ void RemovePasswordsException(const Value* value);
+
+ // Remove all saved passwords
+ void RemoveAllSavedPasswords(const Value* value);
+
+ // Remove All password exceptions
+ void RemoveAllPasswordsExceptions(const Value* value);
// Get password value for the selected entry.
// @param value the selected entry index.
diff --git a/chrome/browser/dom_ui/passwords_remove_all_handler.cc b/chrome/browser/dom_ui/passwords_remove_all_handler.cc
new file mode 100644
index 0000000..ecf15a6
--- /dev/null
+++ b/chrome/browser/dom_ui/passwords_remove_all_handler.cc
@@ -0,0 +1,41 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/dom_ui/passwords_remove_all_handler.h"
+
+#include "app/l10n_util.h"
+#include "base/basictypes.h"
+#include "base/values.h"
+#include "base/callback.h"
+#include "grit/chromium_strings.h"
+#include "grit/generated_resources.h"
+#include "chrome/browser/sync/profile_sync_service.h"
+#include "chrome/browser/profile.h"
+#include "chrome/browser/profile_manager.h"
+#include "chrome/browser/dom_ui/passwords_exceptions_handler.h"
+
+PasswordsRemoveAllHandler::PasswordsRemoveAllHandler() {
+}
+
+PasswordsRemoveAllHandler::~PasswordsRemoveAllHandler() {
+}
+
+void PasswordsRemoveAllHandler::GetLocalizedValues(
+ DictionaryValue* localized_strings) {
+ DCHECK(localized_strings);
+ localized_strings->SetString("remove_all_explanation",
+ l10n_util::GetStringUTF16(
+ IDS_PASSWORDS_PAGE_VIEW_TEXT_DELETE_ALL_PASSWORDS));
+ localized_strings->SetString("remove_all_title",
+ l10n_util::GetStringUTF16(
+ IDS_PASSWORDS_PAGE_VIEW_CAPTION_DELETE_ALL_PASSWORDS));
+ localized_strings->SetString("remove_all_yes",
+ l10n_util::GetStringUTF16(IDS_CONFIRM_MESSAGEBOX_YES_BUTTON_LABEL));
+ localized_strings->SetString("remove_all_no",
+ l10n_util::GetStringUTF16(IDS_CONFIRM_MESSAGEBOX_NO_BUTTON_LABEL));
+}
+
+void PasswordsRemoveAllHandler::RegisterMessages() {
+ DCHECK(dom_ui_);
+}
diff --git a/chrome/browser/dom_ui/passwords_remove_all_handler.h b/chrome/browser/dom_ui/passwords_remove_all_handler.h
new file mode 100644
index 0000000..08795c1
--- /dev/null
+++ b/chrome/browser/dom_ui/passwords_remove_all_handler.h
@@ -0,0 +1,26 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_DOM_UI_PASSWORDS_REMOVE_ALL_HANDLER_H_
+#define CHROME_BROWSER_DOM_UI_PASSWORDS_REMOVE_ALL_HANDLER_H_
+
+#include "chrome/browser/dom_ui/options_ui.h"
+
+// Chrome passwords and exceptions remove all overlay UI handler.
+class PasswordsRemoveAllHandler : public OptionsPageUIHandler {
+ public:
+ PasswordsRemoveAllHandler();
+ virtual ~PasswordsRemoveAllHandler();
+
+ // OptionsUIHandler implementation.
+ virtual void GetLocalizedValues(DictionaryValue* localized_strings);
+
+ // DOMMessageHandler implementation.
+ virtual void RegisterMessages();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(PasswordsRemoveAllHandler);
+};
+
+#endif // CHROME_BROWSER_DOM_UI_PASSWORDSREMOVE_ALL_HANDLER_H_
diff --git a/chrome/browser/resources/options.html b/chrome/browser/resources/options.html
index cf9d9aa..ec254bf 100644
--- a/chrome/browser/resources/options.html
+++ b/chrome/browser/resources/options.html
@@ -55,6 +55,7 @@
<script src="options/import_data_overlay.js"></script>
<script src="options/passwords_exceptions.js"></script>
<script src="options/passwords_exceptions_list.js"></script>
+<script src="options/passwords_remove_all_overlay.js"></script>
<script src="options/personal_options.js"></script>
<script src="options/search_engine_manager.js"></script>
<script src="options/search_engine_manager_engine_list.js"></script>
@@ -76,6 +77,7 @@ var PersonalOptions = options.PersonalOptions;
var Preferences = options.Preferences;
var SearchEngineManager = options.SearchEngineManager;
var StopSyncingOverlay = options.StopSyncingOverlay;
+var PasswordsRemoveAllOverlay = options.PasswordsRemoveAllOverlay;
/**
* Window onload handler, sets up the page.
@@ -101,6 +103,7 @@ function load() {
OptionsPage.registerOverlay(FontSettingsOverlay.getInstance());
OptionsPage.registerOverlay(ImportDataOverlay.getInstance());
OptionsPage.registerOverlay(StopSyncingOverlay.getInstance());
+ OptionsPage.registerOverlay(PasswordsRemoveAllOverlay.getInstance());
if (cr.isChromeOS) {
OptionsPage.register(AccountsOptions.getInstance());
@@ -195,6 +198,7 @@ window.onpopstate = function(e) {
<include src="options/font_settings_overlay.html">
<include src="options/import_data_overlay.html">
<include src="options/stop_syncing_overlay.html">
+ <include src="options/passwords_remove_all_overlay.html">
<if expr="pp_ifdef('chromeos')">
<include src="options/chromeos_language_add_language_overlay.html">
</if>
diff --git a/chrome/browser/resources/options/passwords_exceptions.html b/chrome/browser/resources/options/passwords_exceptions.html
index fe7b7bd..c16d29b 100644
--- a/chrome/browser/resources/options/passwords_exceptions.html
+++ b/chrome/browser/resources/options/passwords_exceptions.html
@@ -17,7 +17,7 @@
<!-- Passwords tab contents -->
<div id="passwordsTab" class="subpages-tab-contents">
<section>
- <div id="passwordsArea">
+ <div id="passwordsArea" contentType="passwords">
<list id="autofillableLoginsList"></list>
</div>
</section>
@@ -26,7 +26,8 @@
<!-- Exceptions tab contents -->
<div id="passwordsExceptionsTab" class="subpages-tab-contents">
<section>
- <div id="passwordsExceptionsArea">
+ <div id="passwordsExceptionsArea" contentType="passwordsExceptions">
+ <list id="passwordsExceptionsList"></list>
</div>
</section>
</div>
diff --git a/chrome/browser/resources/options/passwords_exceptions.js b/chrome/browser/resources/options/passwords_exceptions.js
index 3a979be..87ac3bb 100644
--- a/chrome/browser/resources/options/passwords_exceptions.js
+++ b/chrome/browser/resources/options/passwords_exceptions.js
@@ -28,12 +28,11 @@ cr.define('options', function() {
initializePage: function() {
OptionsPage.prototype.initializePage.call(this);
- options.passwordsExceptions.ListArea.decorate($('passwordsArea'));
-
- // TODO(sargrass): Passwords filter page --------------------------
-
- // TODO(sargrass): Exceptions filter page -------------------------
-
+ var areas = document.querySelectorAll(
+ '#passwordsExceptionsPage div[contentType]');
+ for (var i = 0; i < areas.length; i++) {
+ options.passwordsExceptions.ListArea.decorate(areas[i]);
+ }
},
setAutofillableLogins_: function(entries) {
@@ -48,8 +47,27 @@ cr.define('options', function() {
chrome.send('loadSavedPasswords');
};
- PasswordsExceptions.removeAutofillable = function(index) {
- chrome.send('removeAutofillable', [String(index)]);
+ /**
+ * Call to remove a row.
+ * @param tab contentType of the tab currently on.
+ * @param rowIndex indicating the row to remove.
+ */
+ PasswordsExceptions.removeEntry = function(tab, rowIndex) {
+ if(tab == 'passwords')
+ chrome.send('removeSavedPassword', [String(rowIndex)]);
+ else
+ chrome.send('removePasswordsException', [String(rowIndex)]);
+ };
+
+ /**
+ * Call to remove all saved passwords or passwords exceptions.
+ * @param tab contentType of the tab currently on.
+ */
+ PasswordsExceptions.removeAll = function(tab) {
+ if(tab == 'passwords')
+ chrome.send('removeAllSavedPasswords');
+ else
+ chrome.send('removeAllPasswordsExceptions')
};
PasswordsExceptions.showSelectedPassword = function(index) {
diff --git a/chrome/browser/resources/options/passwords_exceptions_list.js b/chrome/browser/resources/options/passwords_exceptions_list.js
index 8bf232e..ba0b9a7 100644
--- a/chrome/browser/resources/options/passwords_exceptions_list.js
+++ b/chrome/browser/resources/options/passwords_exceptions_list.js
@@ -10,12 +10,14 @@ cr.define('options.passwordsExceptions', function() {
/**
* Creates a new passwords list item.
+ * @param contentType passwords or passwordsExceptions
* @param {Array} entry A pair of the form [url, username].
* @constructor
* @extends {cr.ui.ListItem}
*/
- function PasswordsListItem(entry) {
+ function PasswordsListItem(contentType, entry) {
var el = cr.doc.createElement('li');
+ el.contentType = contentType;
el.dataItem = entry;
el.__proto__ = PasswordsListItem.prototype;
el.decorate();
@@ -36,14 +38,15 @@ cr.define('options.passwordsExceptions', function() {
var urlLabel = cr.doc.createElement('span');
urlLabel.textContent = this.url;
this.appendChild(urlLabel);
-
- var usernameLabel = cr.doc.createElement('span');
- usernameLabel.textContent = this.username;
- usernameLabel.className = 'passwordsUsername';
- this.appendChild(usernameLabel);
-
this.urlLabel = urlLabel;
- this.usernameLabel = usernameLabel;
+
+ if (this.contentType == 'passwords') {
+ var usernameLabel = cr.doc.createElement('span');
+ usernameLabel.textContent = this.username;
+ usernameLabel.className = 'passwordsUsername';
+ this.appendChild(usernameLabel);
+ this.usernameLabel = usernameLabel;
+ }
},
/**
@@ -62,11 +65,15 @@ cr.define('options.passwordsExceptions', function() {
* @type {string}
*/
get username() {
- return this.dataItem[1];
- },
- set username(username) {
- this.dataItem[1] = username;
- },
+ if (this.contentType == 'passwords')
+ return this.dataItem[1];
+ else
+ return undefined;
+ },
+ set username(username) {
+ if (this.contentType == 'passwords')
+ this.dataItem[1] = username;
+ },
};
/**
@@ -92,7 +99,7 @@ cr.define('options.passwordsExceptions', function() {
* @param {Object} entry The element from the data model for this row.
*/
createItem: function(entry) {
- return new PasswordsListItem(entry);
+ return new PasswordsListItem(this.contentType, entry);
},
/**
@@ -115,12 +122,21 @@ cr.define('options.passwordsExceptions', function() {
*/
removeSelectedRow: function() {
var selectedIndex = this.selectionModel.selectedIndex;
- PasswordsExceptions.removeAutofillable(selectedIndex);
+ PasswordsExceptions.removeEntry(this.contentType, selectedIndex);
},
showSelectedPassword: function() {
- var selectedIndex = this.selectionModel.selectedIndex;
- PasswordsExceptions.showSelectedPassword(selectedIndex);
+ if (this.contentType == 'passwords') {
+ var selectedIndex = this.selectionModel.selectedIndex;
+ PasswordsExceptions.showSelectedPassword(selectedIndex);
+ }
+ },
+
+ /**
+ * The length of the list.
+ */
+ get length() {
+ return this.dataModel.length;
},
};
@@ -137,37 +153,56 @@ cr.define('options.passwordsExceptions', function() {
PasswordsList.decorate(this.passwordsList);
this.passwordsList.selectionModel.addEventListener(
'change', cr.bind(this.handleOnSelectionChange_, this));
+ this.passwordsList.dataModel.addEventListener(
+ 'change', cr.bind(this.handleOnDataModelChange_, this));
var removeRow = cr.doc.createElement('button');
removeRow.textContent = templateData.passwordsRemoveButton;
this.appendChild(removeRow);
this.removeRow = removeRow;
- var showHidePassword = cr.doc.createElement('button');
- showHidePassword.textContent = templateData.passwordsShowButton;
- this.appendChild(showHidePassword);
- this.showHidePassword = showHidePassword;
- this.showingPassword = false
+ var removeAll = cr.doc.createElement('button');
+ removeAll.textContent = templateData.passwordsRemoveAllButton;
+ this.appendChild(removeAll);
+ this.removeAll = removeAll;
- var passwordLabel = cr.doc.createElement('span');
- this.appendChild(passwordLabel);
- this.passwordLabel = passwordLabel;
+ if (this.contentType == 'passwords') {
+ var showHidePassword = cr.doc.createElement('button');
+ showHidePassword.textContent = templateData.passwordsShowButton;
+ this.appendChild(showHidePassword);
+ this.showHidePassword = showHidePassword;
+ this.showingPassword = false
+
+ var passwordLabel = cr.doc.createElement('span');
+ this.appendChild(passwordLabel);
+ this.passwordLabel = passwordLabel;
+ }
var self = this;
removeRow.onclick = function(event) {
self.passwordsList.removeSelectedRow();
};
- showHidePassword.onclick = function(event) {
- if(self.showingPassword) {
- self.passwordLabel.textContent = "";
- this.textContent = templateData.passwordsShowButton;
- } else {
- self.passwordsList.showSelectedPassword();
- this.textContent = templateData.passwordsHideButton;
- }
- self.showingPassword = !self.showingPassword;
- };
+ if (this.contentType == 'passwords') {
+ showHidePassword.onclick = function(event) {
+ if(self.showingPassword) {
+ self.passwordLabel.textContent = "";
+ this.textContent = templateData.passwordsShowButton;
+ } else {
+ self.passwordsList.showSelectedPassword();
+ this.textContent = templateData.passwordsHideButton;
+ }
+ self.showingPassword = !self.showingPassword;
+ };
+
+ removeAll.onclick = function(event) {
+ OptionsPage.showOverlay('passwordsRemoveAllOverlay');
+ };
+ } else {
+ removeAll.onclick = function(event) {
+ PasswordsExceptions.removeAll(this.contentType);
+ };
+ }
this.updateButtonSensitivity();
},
@@ -184,29 +219,46 @@ cr.define('options.passwordsExceptions', function() {
},
displayReturnedPassword: function(password) {
- this.passwordLabel.textContent = password;
+ if (this.contentType == 'passwords') {
+ this.passwordLabel.textContent = password;
+ }
},
/**
* Update the button's states
*/
updateButtonSensitivity: function() {
- var selectionSize = autofillableLoginsList.selectedItems.length;
+ var selectionSize = this.passwordsList.selectedItems.length;
this.removeRow.disabled = selectionSize == 0;
- this.showHidePassword.disabled = selectionSize == 0;
+ if (this.contentType == 'passwords')
+ this.showHidePassword.disabled = selectionSize == 0;
},
+ updateRemoveAllSensitivity: function() {
+ this.removeAll.disabled = this.passwordsList.length == 0;
+ },
/**
* Callback from selection model
* @param {!cr.Event} ce Event with change info.
* @private
*/
handleOnSelectionChange_: function(ce) {
- this.passwordLabel.textContent = "";
- this.showHidePassword.textContent = templateData.passwordsShowButton;
- this.showingPassword = false;
+ if (this.contentType == 'passwords') {
+ this.passwordLabel.textContent = "";
+ this.showHidePassword.textContent = templateData.passwordsShowButton;
+ this.showingPassword = false;
+ }
this.updateButtonSensitivity();
},
+
+ /**
+ * Callback from data model
+ * @param {!cr.Event} ce Event with change info.
+ * @private
+ */
+ handleOnDataModelChange_: function(ce) {
+ this.updateRemoveAllSensitivity();
+ },
};
return {
diff --git a/chrome/browser/resources/options/passwords_remove_all_overlay.html b/chrome/browser/resources/options/passwords_remove_all_overlay.html
new file mode 100644
index 0000000..4216612
--- /dev/null
+++ b/chrome/browser/resources/options/passwords_remove_all_overlay.html
@@ -0,0 +1,7 @@
+<div class="page hidden" id="passwordsRemoveAllOverlay">
+ <h1 i18n-content="remove_all_title"></h1>
+
+ <div i18n-content="remove_all_explanation"></div>
+ <button id="remove-all-cancel" i18n-content="remove_all_no"></button>
+ <button id="remove-all-confirm" i18n-content="remove_all_yes"></button>
+</div>
diff --git a/chrome/browser/resources/options/passwords_remove_all_overlay.js b/chrome/browser/resources/options/passwords_remove_all_overlay.js
new file mode 100644
index 0000000..76d17ea
--- /dev/null
+++ b/chrome/browser/resources/options/passwords_remove_all_overlay.js
@@ -0,0 +1,50 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+cr.define('options', function() {
+
+ var OptionsPage = options.OptionsPage;
+
+ /**
+ * PasswordsRemoveAllOverlay class
+ * Encapsulated handling of the 'Remove All' overlay page.
+ * @class
+ */
+ function PasswordsRemoveAllOverlay() {
+ OptionsPage.call(this, 'passwordsRemoveAllOverlay',
+ templateData.remove_all_title,
+ 'passwordsRemoveAllOverlay');
+ }
+
+ cr.addSingletonGetter(PasswordsRemoveAllOverlay);
+
+ PasswordsRemoveAllOverlay.prototype = {
+ // Inherit StopSyncingOverlay from OptionsPage.
+ __proto__: OptionsPage.prototype,
+
+ /**
+ * Initialize the page.
+ */
+ initializePage: function() {
+ // Call base class implementation to starts preference initialization.
+ OptionsPage.prototype.initializePage.call(this);
+
+ $('remove-all-cancel').onclick = function(e) {
+ OptionsPage.clearOverlays();
+ }
+
+ $('remove-all-confirm').onclick = function(e) {
+ PasswordsExceptions.removeAll('passwords');
+ OptionsPage.clearOverlays();
+ }
+ }
+ };
+
+ // Export
+ return {
+ PasswordsRemoveAllOverlay: PasswordsRemoveAllOverlay
+ };
+
+});
+
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index 9693d0d..f2c2ec7 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -1164,6 +1164,8 @@
'browser/dom_ui/font_settings_utils_win.cc',
'browser/dom_ui/passwords_exceptions_handler.cc',
'browser/dom_ui/passwords_exceptions_handler.h',
+ 'browser/dom_ui/passwords_remove_all_handler.cc',
+ 'browser/dom_ui/passwords_remove_all_handler.h',
'browser/dom_ui/personal_options_handler.cc',
'browser/dom_ui/personal_options_handler.h',
'browser/dom_ui/sync_options_handler.cc',