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

Side by Side Diff: chrome/browser/ui/webui/settings/settings_import_data_handler.cc

Issue 2664753002: Remove base::StringValue (Closed)
Patch Set: Rebase Created 3 years, 9 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/settings/settings_import_data_handler.h" 5 #include "chrome/browser/ui/webui/settings/settings_import_data_handler.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 DCHECK_CURRENTLY_ON(BrowserThread::UI); 87 DCHECK_CURRENTLY_ON(BrowserThread::UI);
88 88
89 if (!imported_items) 89 if (!imported_items)
90 return; 90 return;
91 91
92 // If another import is already ongoing, let it finish silently. 92 // If another import is already ongoing, let it finish silently.
93 if (importer_host_) 93 if (importer_host_)
94 importer_host_->set_observer(NULL); 94 importer_host_->set_observer(NULL);
95 95
96 CallJavascriptFunction("cr.webUIListenerCallback", 96 CallJavascriptFunction("cr.webUIListenerCallback",
97 base::StringValue("import-data-status-changed"), 97 base::Value("import-data-status-changed"),
98 base::StringValue(kImportStatusInProgress)); 98 base::Value(kImportStatusInProgress));
99 import_did_succeed_ = false; 99 import_did_succeed_ = false;
100 100
101 importer_host_ = new ExternalProcessImporterHost(); 101 importer_host_ = new ExternalProcessImporterHost();
102 importer_host_->set_observer(this); 102 importer_host_->set_observer(this);
103 Profile* profile = Profile::FromWebUI(web_ui()); 103 Profile* profile = Profile::FromWebUI(web_ui());
104 importer_host_->StartImportSettings(source_profile, profile, 104 importer_host_->StartImportSettings(source_profile, profile,
105 imported_items, 105 imported_items,
106 new ProfileWriter(profile)); 106 new ProfileWriter(profile));
107 107
108 importer::LogImporterUseToMetrics("ImportDataHandler", 108 importer::LogImporterUseToMetrics("ImportDataHandler",
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 (browser_services & importer::PASSWORDS) != 0); 178 (browser_services & importer::PASSWORDS) != 0);
179 browser_profile->SetBoolean("search", 179 browser_profile->SetBoolean("search",
180 (browser_services & importer::SEARCH_ENGINES) != 0); 180 (browser_services & importer::SEARCH_ENGINES) != 0);
181 browser_profile->SetBoolean( 181 browser_profile->SetBoolean(
182 "autofillFormData", 182 "autofillFormData",
183 (browser_services & importer::AUTOFILL_FORM_DATA) != 0); 183 (browser_services & importer::AUTOFILL_FORM_DATA) != 0);
184 184
185 browser_profiles.Append(std::move(browser_profile)); 185 browser_profiles.Append(std::move(browser_profile));
186 } 186 }
187 187
188 ResolveJavascriptCallback(base::StringValue(callback_id), browser_profiles); 188 ResolveJavascriptCallback(base::Value(callback_id), browser_profiles);
189 } 189 }
190 190
191 void ImportDataHandler::ImportStarted() { 191 void ImportDataHandler::ImportStarted() {
192 DCHECK_CURRENTLY_ON(BrowserThread::UI); 192 DCHECK_CURRENTLY_ON(BrowserThread::UI);
193 } 193 }
194 194
195 void ImportDataHandler::ImportItemStarted(importer::ImportItem item) { 195 void ImportDataHandler::ImportItemStarted(importer::ImportItem item) {
196 DCHECK_CURRENTLY_ON(BrowserThread::UI); 196 DCHECK_CURRENTLY_ON(BrowserThread::UI);
197 197
198 // TODO(csilv): show progress detail in the web view. 198 // TODO(csilv): show progress detail in the web view.
199 } 199 }
200 200
201 void ImportDataHandler::ImportItemEnded(importer::ImportItem item) { 201 void ImportDataHandler::ImportItemEnded(importer::ImportItem item) {
202 DCHECK_CURRENTLY_ON(BrowserThread::UI); 202 DCHECK_CURRENTLY_ON(BrowserThread::UI);
203 203
204 // TODO(csilv): show progress detail in the web view. 204 // TODO(csilv): show progress detail in the web view.
205 import_did_succeed_ = true; 205 import_did_succeed_ = true;
206 } 206 }
207 207
208 void ImportDataHandler::ImportEnded() { 208 void ImportDataHandler::ImportEnded() {
209 DCHECK_CURRENTLY_ON(BrowserThread::UI); 209 DCHECK_CURRENTLY_ON(BrowserThread::UI);
210 210
211 importer_host_->set_observer(NULL); 211 importer_host_->set_observer(NULL);
212 importer_host_ = NULL; 212 importer_host_ = NULL;
213 213
214 CallJavascriptFunction( 214 CallJavascriptFunction(
215 "cr.webUIListenerCallback", 215 "cr.webUIListenerCallback", base::Value("import-data-status-changed"),
216 base::StringValue("import-data-status-changed"), 216 base::Value(import_did_succeed_ ? kImportStatusSucceeded
217 base::StringValue(import_did_succeed_ ? kImportStatusSucceeded 217 : kImportStatusFailed));
218 : kImportStatusFailed));
219 } 218 }
220 219
221 void ImportDataHandler::FileSelected(const base::FilePath& path, 220 void ImportDataHandler::FileSelected(const base::FilePath& path,
222 int /*index*/, 221 int /*index*/,
223 void* /*params*/) { 222 void* /*params*/) {
224 DCHECK_CURRENTLY_ON(BrowserThread::UI); 223 DCHECK_CURRENTLY_ON(BrowserThread::UI);
225 224
226 importer::SourceProfile source_profile; 225 importer::SourceProfile source_profile;
227 source_profile.importer_type = importer::TYPE_BOOKMARKS_FILE; 226 source_profile.importer_type = importer::TYPE_BOOKMARKS_FILE;
228 source_profile.source_path = path; 227 source_profile.source_path = path;
(...skipping 19 matching lines...) Expand all
248 base::string16(), 247 base::string16(),
249 base::FilePath(), 248 base::FilePath(),
250 &file_type_info, 249 &file_type_info,
251 0, 250 0,
252 base::FilePath::StringType(), 251 base::FilePath::StringType(),
253 browser->window()->GetNativeWindow(), 252 browser->window()->GetNativeWindow(),
254 NULL); 253 NULL);
255 } 254 }
256 255
257 } // namespace settings 256 } // namespace settings
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698