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

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

Issue 480953002: Implement "Autofill form data" import for Firefox (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added test case Created 6 years, 4 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/import_data_handler.h" 5 #include "chrome/browser/ui/webui/options/import_data_handler.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 if (select_file_dialog_) 48 if (select_file_dialog_)
49 select_file_dialog_->ListenerDestroyed(); 49 select_file_dialog_->ListenerDestroyed();
50 } 50 }
51 51
52 void ImportDataHandler::GetLocalizedValues( 52 void ImportDataHandler::GetLocalizedValues(
53 base::DictionaryValue* localized_strings) { 53 base::DictionaryValue* localized_strings) {
54 DCHECK_CURRENTLY_ON(BrowserThread::UI); 54 DCHECK_CURRENTLY_ON(BrowserThread::UI);
55 DCHECK(localized_strings); 55 DCHECK(localized_strings);
56 56
57 static OptionsStringResource resources[] = { 57 static OptionsStringResource resources[] = {
58 { "importFromLabel", IDS_IMPORT_FROM_LABEL }, 58 {"importFromLabel", IDS_IMPORT_FROM_LABEL},
Ilya Sherman 2014/08/20 05:47:41 nit: Are the diffs in these lines a result of runn
Nikhil 2014/08/20 11:29:17 Yep, this is a result of running "git cl format".
59 { "importLoading", IDS_IMPORT_LOADING_PROFILES }, 59 {"importLoading", IDS_IMPORT_LOADING_PROFILES},
60 { "importDescription", IDS_IMPORT_ITEMS_LABEL }, 60 {"importDescription", IDS_IMPORT_ITEMS_LABEL},
61 { "importHistory", IDS_IMPORT_HISTORY_CHKBOX }, 61 {"importHistory", IDS_IMPORT_HISTORY_CHKBOX},
62 { "importFavorites", IDS_IMPORT_FAVORITES_CHKBOX }, 62 {"importFavorites", IDS_IMPORT_FAVORITES_CHKBOX},
63 { "importSearch", IDS_IMPORT_SEARCH_ENGINES_CHKBOX }, 63 {"importSearch", IDS_IMPORT_SEARCH_ENGINES_CHKBOX},
64 { "importPasswords", IDS_IMPORT_PASSWORDS_CHKBOX }, 64 {"importPasswords", IDS_IMPORT_PASSWORDS_CHKBOX},
65 { "importChooseFile", IDS_IMPORT_CHOOSE_FILE }, 65 {"importAutofillFormData", IDS_IMPORT_AUTOFILL_FORM_DATA_CHKBOX},
66 { "importCommit", IDS_IMPORT_COMMIT }, 66 {"importChooseFile", IDS_IMPORT_CHOOSE_FILE},
67 { "noProfileFound", IDS_IMPORT_NO_PROFILE_FOUND }, 67 {"importCommit", IDS_IMPORT_COMMIT},
68 { "importSucceeded", IDS_IMPORT_SUCCEEDED }, 68 {"noProfileFound", IDS_IMPORT_NO_PROFILE_FOUND},
69 { "findYourImportedBookmarks", IDS_IMPORT_FIND_YOUR_BOOKMARKS }, 69 {"importSucceeded", IDS_IMPORT_SUCCEEDED},
70 {"findYourImportedBookmarks", IDS_IMPORT_FIND_YOUR_BOOKMARKS},
70 #if defined(OS_MACOSX) 71 #if defined(OS_MACOSX)
71 { "macPasswordKeychain", IDS_IMPORT_PASSWORD_KEYCHAIN_WARNING }, 72 {"macPasswordKeychain", IDS_IMPORT_PASSWORD_KEYCHAIN_WARNING},
72 #endif 73 #endif
73 }; 74 };
74 75
75 RegisterStrings(localized_strings, resources, arraysize(resources)); 76 RegisterStrings(localized_strings, resources, arraysize(resources));
76 RegisterTitle(localized_strings, "importDataOverlay", 77 RegisterTitle(localized_strings, "importDataOverlay",
77 IDS_IMPORT_SETTINGS_TITLE); 78 IDS_IMPORT_SETTINGS_TITLE);
78 } 79 }
79 80
80 void ImportDataHandler::InitializeHandler() { 81 void ImportDataHandler::InitializeHandler() {
81 DCHECK_CURRENTLY_ON(BrowserThread::UI); 82 DCHECK_CURRENTLY_ON(BrowserThread::UI);
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 } 146 }
146 if (args->GetString(2, &string_value) && string_value == "true") { 147 if (args->GetString(2, &string_value) && string_value == "true") {
147 selected_items |= importer::FAVORITES; 148 selected_items |= importer::FAVORITES;
148 } 149 }
149 if (args->GetString(3, &string_value) && string_value == "true") { 150 if (args->GetString(3, &string_value) && string_value == "true") {
150 selected_items |= importer::PASSWORDS; 151 selected_items |= importer::PASSWORDS;
151 } 152 }
152 if (args->GetString(4, &string_value) && string_value == "true") { 153 if (args->GetString(4, &string_value) && string_value == "true") {
153 selected_items |= importer::SEARCH_ENGINES; 154 selected_items |= importer::SEARCH_ENGINES;
154 } 155 }
156 if (args->GetString(5, &string_value) && string_value == "true") {
157 selected_items |= importer::AUTOFILL_FORM_DATA;
158 }
155 159
156 const importer::SourceProfile& source_profile = 160 const importer::SourceProfile& source_profile =
157 importer_list_->GetSourceProfileAt(browser_index); 161 importer_list_->GetSourceProfileAt(browser_index);
158 uint16 supported_items = source_profile.services_supported; 162 uint16 supported_items = source_profile.services_supported;
159 163
160 uint16 imported_items = (selected_items & supported_items); 164 uint16 imported_items = (selected_items & supported_items);
161 if (imported_items) { 165 if (imported_items) {
162 StartImport(source_profile, imported_items); 166 StartImport(source_profile, imported_items);
163 } else { 167 } else {
164 LOG(WARNING) << "There were no settings to import from '" 168 LOG(WARNING) << "There were no settings to import from '"
(...skipping 14 matching lines...) Expand all
179 browser_profile->SetString("name", source_profile.importer_name); 183 browser_profile->SetString("name", source_profile.importer_name);
180 browser_profile->SetInteger("index", i); 184 browser_profile->SetInteger("index", i);
181 browser_profile->SetBoolean("history", 185 browser_profile->SetBoolean("history",
182 (browser_services & importer::HISTORY) != 0); 186 (browser_services & importer::HISTORY) != 0);
183 browser_profile->SetBoolean("favorites", 187 browser_profile->SetBoolean("favorites",
184 (browser_services & importer::FAVORITES) != 0); 188 (browser_services & importer::FAVORITES) != 0);
185 browser_profile->SetBoolean("passwords", 189 browser_profile->SetBoolean("passwords",
186 (browser_services & importer::PASSWORDS) != 0); 190 (browser_services & importer::PASSWORDS) != 0);
187 browser_profile->SetBoolean("search", 191 browser_profile->SetBoolean("search",
188 (browser_services & importer::SEARCH_ENGINES) != 0); 192 (browser_services & importer::SEARCH_ENGINES) != 0);
193 browser_profile->SetBoolean(
194 "autofillformdata",
Ilya Sherman 2014/08/20 05:47:41 nit: Even though the style above is wrong, please
Nikhil 2014/08/20 11:29:16 This was result of "git cl format". I've matched i
Ilya Sherman 2014/08/20 20:47:22 Yep, I think "git cl format" did the right thing f
Nikhil 2014/08/21 07:35:36 Acknowledged.
195 (browser_services & importer::AUTOFILL_FORM_DATA) != 0);
189 196
190 browser_profile->SetBoolean("show_bottom_bar", 197 browser_profile->SetBoolean("show_bottom_bar",
191 #if defined(OS_MACOSX) 198 #if defined(OS_MACOSX)
192 source_profile.importer_type == importer::TYPE_SAFARI); 199 source_profile.importer_type == importer::TYPE_SAFARI);
193 #else 200 #else
194 false); 201 false);
195 #endif 202 #endif
196 203
197 browser_profiles.Append(browser_profile); 204 browser_profiles.Append(browser_profile);
198 } 205 }
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 base::string16(), 271 base::string16(),
265 base::FilePath(), 272 base::FilePath(),
266 &file_type_info, 273 &file_type_info,
267 0, 274 0,
268 base::FilePath::StringType(), 275 base::FilePath::StringType(),
269 browser->window()->GetNativeWindow(), 276 browser->window()->GetNativeWindow(),
270 NULL); 277 NULL);
271 } 278 }
272 279
273 } // namespace options 280 } // namespace options
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698