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/options2/import_data_handler2.h" | 5 #include "chrome/browser/ui/webui/options2/import_data_handler2.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" |
11 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/string16.h" | 13 #include "base/string16.h" |
14 #include "base/string_number_conversions.h" | 14 #include "base/string_number_conversions.h" |
15 #include "base/string_util.h" | 15 #include "base/string_util.h" |
16 #include "base/threading/thread_restrictions.h" | 16 #include "base/threading/thread_restrictions.h" |
17 #include "base/utf_string_conversions.h" | 17 #include "base/utf_string_conversions.h" |
18 #include "base/values.h" | 18 #include "base/values.h" |
19 #include "chrome/browser/importer/external_process_importer_host.h" | 19 #include "chrome/browser/importer/external_process_importer_host.h" |
20 #include "chrome/browser/importer/importer_host.h" | 20 #include "chrome/browser/importer/importer_host.h" |
21 #include "chrome/browser/importer/importer_list.h" | 21 #include "chrome/browser/importer/importer_list.h" |
22 #include "chrome/browser/profiles/profile.h" | 22 #include "chrome/browser/profiles/profile.h" |
| 23 #include "chrome/browser/ui/browser_finder.h" |
23 #include "content/public/browser/web_ui.h" | 24 #include "content/public/browser/web_ui.h" |
24 #include "grit/chromium_strings.h" | 25 #include "grit/chromium_strings.h" |
25 #include "grit/generated_resources.h" | 26 #include "grit/generated_resources.h" |
26 #include "ui/base/l10n/l10n_util.h" | 27 #include "ui/base/l10n/l10n_util.h" |
27 | 28 |
28 namespace options2 { | 29 namespace options2 { |
29 | 30 |
30 ImportDataHandler::ImportDataHandler() : importer_host_(NULL), | 31 ImportDataHandler::ImportDataHandler() : importer_host_(NULL), |
31 import_did_succeed_(false) { | 32 import_did_succeed_(false) { |
32 } | 33 } |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 // TODO(csilv): Out-of-process import has only been qualified on MacOS X, | 111 // TODO(csilv): Out-of-process import has only been qualified on MacOS X, |
111 // so we will only use it on that platform since it is required. Remove this | 112 // so we will only use it on that platform since it is required. Remove this |
112 // conditional logic once oop import is qualified for Linux/Windows. | 113 // conditional logic once oop import is qualified for Linux/Windows. |
113 // http://crbug.com/22142 | 114 // http://crbug.com/22142 |
114 #if defined(OS_MACOSX) | 115 #if defined(OS_MACOSX) |
115 importer_host_ = new ExternalProcessImporterHost; | 116 importer_host_ = new ExternalProcessImporterHost; |
116 #else | 117 #else |
117 importer_host_ = new ImporterHost; | 118 importer_host_ = new ImporterHost; |
118 #endif | 119 #endif |
119 importer_host_->SetObserver(this); | 120 importer_host_->SetObserver(this); |
| 121 importer_host_->set_browser( |
| 122 browser::FindBrowserWithWebContents(web_ui()->GetWebContents())); |
120 Profile* profile = Profile::FromWebUI(web_ui()); | 123 Profile* profile = Profile::FromWebUI(web_ui()); |
121 importer_host_->StartImportSettings(source_profile, profile, | 124 importer_host_->StartImportSettings(source_profile, profile, |
122 import_services, | 125 import_services, |
123 new ProfileWriter(profile), false); | 126 new ProfileWriter(profile), false); |
124 } else { | 127 } else { |
125 LOG(WARNING) << "There were no settings to import from '" | 128 LOG(WARNING) << "There were no settings to import from '" |
126 << source_profile.importer_name << "'."; | 129 << source_profile.importer_name << "'."; |
127 } | 130 } |
128 } | 131 } |
129 | 132 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 web_ui()->CallJavascriptFunction("ImportDataOverlay.confirmSuccess"); | 183 web_ui()->CallJavascriptFunction("ImportDataOverlay.confirmSuccess"); |
181 } else { | 184 } else { |
182 base::FundamentalValue state(false); | 185 base::FundamentalValue state(false); |
183 web_ui()->CallJavascriptFunction("ImportDataOverlay.setImportingState", | 186 web_ui()->CallJavascriptFunction("ImportDataOverlay.setImportingState", |
184 state); | 187 state); |
185 web_ui()->CallJavascriptFunction("ImportDataOverlay.dismiss"); | 188 web_ui()->CallJavascriptFunction("ImportDataOverlay.dismiss"); |
186 } | 189 } |
187 } | 190 } |
188 | 191 |
189 } // namespace options2 | 192 } // namespace options2 |
OLD | NEW |