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