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 <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 uint16_t imported_items) { | 104 uint16_t imported_items) { |
105 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 105 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
106 | 106 |
107 if (!imported_items) | 107 if (!imported_items) |
108 return; | 108 return; |
109 | 109 |
110 // If another import is already ongoing, let it finish silently. | 110 // If another import is already ongoing, let it finish silently. |
111 if (importer_host_) | 111 if (importer_host_) |
112 importer_host_->set_observer(NULL); | 112 importer_host_->set_observer(NULL); |
113 | 113 |
114 base::FundamentalValue importing(true); | 114 base::Value importing(true); |
115 web_ui()->CallJavascriptFunctionUnsafe("ImportDataOverlay.setImportingState", | 115 web_ui()->CallJavascriptFunctionUnsafe("ImportDataOverlay.setImportingState", |
116 importing); | 116 importing); |
117 import_did_succeed_ = false; | 117 import_did_succeed_ = false; |
118 | 118 |
119 importer_host_ = new ExternalProcessImporterHost(); | 119 importer_host_ = new ExternalProcessImporterHost(); |
120 importer_host_->set_observer(this); | 120 importer_host_->set_observer(this); |
121 Profile* profile = Profile::FromWebUI(web_ui()); | 121 Profile* profile = Profile::FromWebUI(web_ui()); |
122 importer_host_->StartImportSettings(source_profile, profile, | 122 importer_host_->StartImportSettings(source_profile, profile, |
123 imported_items, | 123 imported_items, |
124 new ProfileWriter(profile)); | 124 new ProfileWriter(profile)); |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 | 219 |
220 void ImportDataHandler::ImportEnded() { | 220 void ImportDataHandler::ImportEnded() { |
221 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 221 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
222 | 222 |
223 importer_host_->set_observer(NULL); | 223 importer_host_->set_observer(NULL); |
224 importer_host_ = NULL; | 224 importer_host_ = NULL; |
225 | 225 |
226 if (import_did_succeed_) { | 226 if (import_did_succeed_) { |
227 web_ui()->CallJavascriptFunctionUnsafe("ImportDataOverlay.confirmSuccess"); | 227 web_ui()->CallJavascriptFunctionUnsafe("ImportDataOverlay.confirmSuccess"); |
228 } else { | 228 } else { |
229 base::FundamentalValue state(false); | 229 base::Value state(false); |
230 web_ui()->CallJavascriptFunctionUnsafe( | 230 web_ui()->CallJavascriptFunctionUnsafe( |
231 "ImportDataOverlay.setImportingState", state); | 231 "ImportDataOverlay.setImportingState", state); |
232 web_ui()->CallJavascriptFunctionUnsafe("ImportDataOverlay.dismiss"); | 232 web_ui()->CallJavascriptFunctionUnsafe("ImportDataOverlay.dismiss"); |
233 } | 233 } |
234 } | 234 } |
235 | 235 |
236 void ImportDataHandler::FileSelected(const base::FilePath& path, | 236 void ImportDataHandler::FileSelected(const base::FilePath& path, |
237 int /*index*/, | 237 int /*index*/, |
238 void* /*params*/) { | 238 void* /*params*/) { |
239 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 239 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
(...skipping 23 matching lines...) Expand all Loading... |
263 base::string16(), | 263 base::string16(), |
264 base::FilePath(), | 264 base::FilePath(), |
265 &file_type_info, | 265 &file_type_info, |
266 0, | 266 0, |
267 base::FilePath::StringType(), | 267 base::FilePath::StringType(), |
268 browser->window()->GetNativeWindow(), | 268 browser->window()->GetNativeWindow(), |
269 NULL); | 269 NULL); |
270 } | 270 } |
271 | 271 |
272 } // namespace options | 272 } // namespace options |
OLD | NEW |