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

Side by Side Diff: chrome/browser/ui/webui/options/password_manager_handler.cc

Issue 71003002: Merge browser/ui/password and browser/ui/passwords. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/ui/webui/options/password_manager_handler.h" 5 #include "chrome/browser/ui/webui/options/password_manager_handler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 } 83 }
84 84
85 void PasswordManagerHandler::InitializeHandler() { 85 void PasswordManagerHandler::InitializeHandler() {
86 password_manager_presenter_.Initialize(); 86 password_manager_presenter_.Initialize();
87 } 87 }
88 88
89 void PasswordManagerHandler::HandleRemoveSavedPassword(const ListValue* args) { 89 void PasswordManagerHandler::HandleRemoveSavedPassword(const ListValue* args) {
90 std::string string_value = UTF16ToUTF8(ExtractStringValue(args)); 90 std::string string_value = UTF16ToUTF8(ExtractStringValue(args));
91 int index; 91 int index;
92 if (base::StringToInt(string_value, &index) && index >= 0) { 92 if (base::StringToInt(string_value, &index) && index >= 0) {
93 password_manager_presenter_.HandleRemoveSavedPassword( 93 password_manager_presenter_.RemoveSavedPassword(static_cast<size_t>(index));
94 static_cast<size_t>(index));
95 } 94 }
96 } 95 }
97 96
98 void PasswordManagerHandler::HandleRemovePasswordException( 97 void PasswordManagerHandler::HandleRemovePasswordException(
99 const ListValue* args) { 98 const ListValue* args) {
100 std::string string_value = UTF16ToUTF8(ExtractStringValue(args)); 99 std::string string_value = UTF16ToUTF8(ExtractStringValue(args));
101 int index; 100 int index;
102 if (base::StringToInt(string_value, &index) && index >= 0) { 101 if (base::StringToInt(string_value, &index) && index >= 0) {
103 password_manager_presenter_.HandleRemovePasswordException( 102 password_manager_presenter_.RemovePasswordException(
104 static_cast<size_t>(index)); 103 static_cast<size_t>(index));
105 } 104 }
106 } 105 }
107 106
108 void PasswordManagerHandler::HandleRequestShowPassword(const ListValue* args) { 107 void PasswordManagerHandler::HandleRequestShowPassword(const ListValue* args) {
109 int index; 108 int index;
110 if (!ExtractIntegerValue(args, &index)) 109 if (!ExtractIntegerValue(args, &index))
111 NOTREACHED(); 110 NOTREACHED();
112 111
113 password_manager_presenter_.HandleRequestShowPassword( 112 password_manager_presenter_.RequestShowPassword(static_cast<size_t>(index));
114 static_cast<size_t>(index));
115 } 113 }
116 114
117 void PasswordManagerHandler::ShowPassword(size_t index, 115 void PasswordManagerHandler::ShowPassword(size_t index,
118 const string16& password_value) { 116 const string16& password_value) {
119 // Call back the front end to reveal the password. 117 // Call back the front end to reveal the password.
120 web_ui()->CallJavascriptFunction( 118 web_ui()->CallJavascriptFunction(
121 "PasswordManager.showPassword", 119 "PasswordManager.showPassword",
122 base::FundamentalValue(static_cast<int>(index)), 120 base::FundamentalValue(static_cast<int>(index)),
123 StringValue(password_value)); 121 StringValue(password_value));
124 } 122 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 for (size_t i = 0; i < password_exception_list.size(); ++i) { 156 for (size_t i = 0; i < password_exception_list.size(); ++i) {
159 entries.Append(new StringValue( 157 entries.Append(new StringValue(
160 net::FormatUrl(password_exception_list[i]->origin, languages_))); 158 net::FormatUrl(password_exception_list[i]->origin, languages_)));
161 } 159 }
162 160
163 web_ui()->CallJavascriptFunction("PasswordManager.setPasswordExceptionsList", 161 web_ui()->CallJavascriptFunction("PasswordManager.setPasswordExceptionsList",
164 entries); 162 entries);
165 } 163 }
166 164
167 } // namespace options 165 } // namespace options
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698