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 <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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 importer_list_->GetSourceProfileAt(browser_index); | 102 importer_list_->GetSourceProfileAt(browser_index); |
103 uint16 supported_items = source_profile.services_supported; | 103 uint16 supported_items = source_profile.services_supported; |
104 | 104 |
105 uint16 import_services = (selected_items & supported_items); | 105 uint16 import_services = (selected_items & supported_items); |
106 if (import_services) { | 106 if (import_services) { |
107 base::FundamentalValue state(true); | 107 base::FundamentalValue state(true); |
108 web_ui()->CallJavascriptFunction("ImportDataOverlay.setImportingState", | 108 web_ui()->CallJavascriptFunction("ImportDataOverlay.setImportingState", |
109 state); | 109 state); |
110 import_did_succeed_ = false; | 110 import_did_succeed_ = false; |
111 | 111 |
112 // TODO(csilv): Out-of-process import has only been qualified on MacOS X, | 112 // TODO(gab): Make Linux use OOP import as well (http://crbug.com/56816) and |
113 // so we will only use it on that platform since it is required. Remove this | 113 // get rid of these ugly ifdefs. |
114 // conditional logic once oop import is qualified for Linux/Windows. | 114 #if defined(OS_MACOSX) || defined(OS_WIN) |
115 // http://crbug.com/22142 | 115 // The Google Toolbar importer doesn't work for the out-of-process import. |
116 #if defined(OS_MACOSX) | 116 // This is the only entry point for this importer (it is never used on first |
117 importer_host_ = new ExternalProcessImporterHost; | 117 // run). See discussion on http://crbug.com/219419 for details. |
| 118 if (source_profile.importer_type == importer::TYPE_GOOGLE_TOOLBAR5) |
| 119 importer_host_ = new ImporterHost; |
| 120 else |
| 121 importer_host_ = new ExternalProcessImporterHost; |
118 #else | 122 #else |
119 importer_host_ = new ImporterHost; | 123 importer_host_ = new ImporterHost; |
120 #endif | 124 #endif |
121 importer_host_->SetObserver(this); | 125 importer_host_->SetObserver(this); |
122 importer_host_->set_browser( | 126 importer_host_->set_browser( |
123 chrome::FindBrowserWithWebContents(web_ui()->GetWebContents())); | 127 chrome::FindBrowserWithWebContents(web_ui()->GetWebContents())); |
124 Profile* profile = Profile::FromWebUI(web_ui()); | 128 Profile* profile = Profile::FromWebUI(web_ui()); |
125 importer_host_->StartImportSettings(source_profile, profile, | 129 importer_host_->StartImportSettings(source_profile, profile, |
126 import_services, | 130 import_services, |
127 new ProfileWriter(profile)); | 131 new ProfileWriter(profile)); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 web_ui()->CallJavascriptFunction("ImportDataOverlay.confirmSuccess"); | 191 web_ui()->CallJavascriptFunction("ImportDataOverlay.confirmSuccess"); |
188 } else { | 192 } else { |
189 base::FundamentalValue state(false); | 193 base::FundamentalValue state(false); |
190 web_ui()->CallJavascriptFunction("ImportDataOverlay.setImportingState", | 194 web_ui()->CallJavascriptFunction("ImportDataOverlay.setImportingState", |
191 state); | 195 state); |
192 web_ui()->CallJavascriptFunction("ImportDataOverlay.dismiss"); | 196 web_ui()->CallJavascriptFunction("ImportDataOverlay.dismiss"); |
193 } | 197 } |
194 } | 198 } |
195 | 199 |
196 } // namespace options | 200 } // namespace options |
OLD | NEW |