| OLD | NEW |
| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | |
| 10 #include <string> | 9 #include <string> |
| 10 #include <utility> |
| 11 | 11 |
| 12 #include "base/bind.h" | 12 #include "base/bind.h" |
| 13 #include "base/bind_helpers.h" | 13 #include "base/bind_helpers.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/strings/string16.h" | 15 #include "base/strings/string16.h" |
| 16 #include "base/strings/string_number_conversions.h" | 16 #include "base/strings/string_number_conversions.h" |
| 17 #include "base/strings/string_util.h" | 17 #include "base/strings/string_util.h" |
| 18 #include "base/strings/utf_string_conversions.h" | 18 #include "base/strings/utf_string_conversions.h" |
| 19 #include "base/threading/thread_restrictions.h" | 19 #include "base/threading/thread_restrictions.h" |
| 20 #include "base/values.h" | 20 #include "base/values.h" |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 | 171 |
| 172 void ImportDataHandler::InitializePage() { | 172 void ImportDataHandler::InitializePage() { |
| 173 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 173 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 174 | 174 |
| 175 base::ListValue browser_profiles; | 175 base::ListValue browser_profiles; |
| 176 for (size_t i = 0; i < importer_list_->count(); ++i) { | 176 for (size_t i = 0; i < importer_list_->count(); ++i) { |
| 177 const importer::SourceProfile& source_profile = | 177 const importer::SourceProfile& source_profile = |
| 178 importer_list_->GetSourceProfileAt(i); | 178 importer_list_->GetSourceProfileAt(i); |
| 179 uint16_t browser_services = source_profile.services_supported; | 179 uint16_t browser_services = source_profile.services_supported; |
| 180 | 180 |
| 181 base::DictionaryValue* browser_profile = new base::DictionaryValue(); | 181 std::unique_ptr<base::DictionaryValue> browser_profile( |
| 182 new base::DictionaryValue()); |
| 182 browser_profile->SetString("name", source_profile.importer_name); | 183 browser_profile->SetString("name", source_profile.importer_name); |
| 183 browser_profile->SetInteger("index", i); | 184 browser_profile->SetInteger("index", i); |
| 184 browser_profile->SetBoolean("history", | 185 browser_profile->SetBoolean("history", |
| 185 (browser_services & importer::HISTORY) != 0); | 186 (browser_services & importer::HISTORY) != 0); |
| 186 browser_profile->SetBoolean("favorites", | 187 browser_profile->SetBoolean("favorites", |
| 187 (browser_services & importer::FAVORITES) != 0); | 188 (browser_services & importer::FAVORITES) != 0); |
| 188 browser_profile->SetBoolean("passwords", | 189 browser_profile->SetBoolean("passwords", |
| 189 (browser_services & importer::PASSWORDS) != 0); | 190 (browser_services & importer::PASSWORDS) != 0); |
| 190 browser_profile->SetBoolean("search", | 191 browser_profile->SetBoolean("search", |
| 191 (browser_services & importer::SEARCH_ENGINES) != 0); | 192 (browser_services & importer::SEARCH_ENGINES) != 0); |
| 192 browser_profile->SetBoolean("autofill-form-data", | 193 browser_profile->SetBoolean("autofill-form-data", |
| 193 (browser_services & importer::AUTOFILL_FORM_DATA) != 0); | 194 (browser_services & importer::AUTOFILL_FORM_DATA) != 0); |
| 194 | 195 |
| 195 browser_profiles.Append(browser_profile); | 196 browser_profiles.Append(std::move(browser_profile)); |
| 196 } | 197 } |
| 197 | 198 |
| 198 web_ui()->CallJavascriptFunctionUnsafe( | 199 web_ui()->CallJavascriptFunctionUnsafe( |
| 199 "ImportDataOverlay.updateSupportedBrowsers", browser_profiles); | 200 "ImportDataOverlay.updateSupportedBrowsers", browser_profiles); |
| 200 } | 201 } |
| 201 | 202 |
| 202 void ImportDataHandler::ImportStarted() { | 203 void ImportDataHandler::ImportStarted() { |
| 203 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 204 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 204 } | 205 } |
| 205 | 206 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 base::string16(), | 263 base::string16(), |
| 263 base::FilePath(), | 264 base::FilePath(), |
| 264 &file_type_info, | 265 &file_type_info, |
| 265 0, | 266 0, |
| 266 base::FilePath::StringType(), | 267 base::FilePath::StringType(), |
| 267 browser->window()->GetNativeWindow(), | 268 browser->window()->GetNativeWindow(), |
| 268 NULL); | 269 NULL); |
| 269 } | 270 } |
| 270 | 271 |
| 271 } // namespace options | 272 } // namespace options |
| OLD | NEW |