OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/callback.h" | 10 #include "base/callback.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 | 92 |
93 const importer::SourceProfile& source_profile = | 93 const importer::SourceProfile& source_profile = |
94 importer_list_->GetSourceProfileAt(browser_index); | 94 importer_list_->GetSourceProfileAt(browser_index); |
95 uint16 supported_items = source_profile.services_supported; | 95 uint16 supported_items = source_profile.services_supported; |
96 | 96 |
97 uint16 import_services = (selected_items & supported_items); | 97 uint16 import_services = (selected_items & supported_items); |
98 if (import_services) { | 98 if (import_services) { |
99 base::FundamentalValue state(true); | 99 base::FundamentalValue state(true); |
100 web_ui_->CallJavascriptFunction("ImportDataOverlay.setImportingState", | 100 web_ui_->CallJavascriptFunction("ImportDataOverlay.setImportingState", |
101 state); | 101 state); |
| 102 import_did_succeed_ = false; |
102 | 103 |
103 // TODO(csilv): Out-of-process import has only been qualified on MacOS X, | 104 // TODO(csilv): Out-of-process import has only been qualified on MacOS X, |
104 // so we will only use it on that platform since it is required. Remove this | 105 // so we will only use it on that platform since it is required. Remove this |
105 // conditional logic once oop import is qualified for Linux/Windows. | 106 // conditional logic once oop import is qualified for Linux/Windows. |
106 // http://crbug.com/22142 | 107 // http://crbug.com/22142 |
107 #if defined(OS_MACOSX) | 108 #if defined(OS_MACOSX) |
108 importer_host_ = new ExternalProcessImporterHost; | 109 importer_host_ = new ExternalProcessImporterHost; |
109 #else | 110 #else |
110 importer_host_ = new ImporterHost; | 111 importer_host_ = new ImporterHost; |
111 #endif | 112 #endif |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 | 149 |
149 void ImportDataHandler::ImportStarted() { | 150 void ImportDataHandler::ImportStarted() { |
150 } | 151 } |
151 | 152 |
152 void ImportDataHandler::ImportItemStarted(importer::ImportItem item) { | 153 void ImportDataHandler::ImportItemStarted(importer::ImportItem item) { |
153 // TODO(csilv): show progress detail in the web view. | 154 // TODO(csilv): show progress detail in the web view. |
154 } | 155 } |
155 | 156 |
156 void ImportDataHandler::ImportItemEnded(importer::ImportItem item) { | 157 void ImportDataHandler::ImportItemEnded(importer::ImportItem item) { |
157 // TODO(csilv): show progress detail in the web view. | 158 // TODO(csilv): show progress detail in the web view. |
| 159 import_did_succeed_ = true; |
158 } | 160 } |
159 | 161 |
160 void ImportDataHandler::ImportEnded() { | 162 void ImportDataHandler::ImportEnded() { |
161 importer_host_->SetObserver(NULL); | 163 importer_host_->SetObserver(NULL); |
162 importer_host_ = NULL; | 164 importer_host_ = NULL; |
163 | 165 |
164 web_ui_->CallJavascriptFunction("ImportDataOverlay.confirmSuccess"); | 166 if (import_did_succeed_) { |
| 167 web_ui_->CallJavascriptFunction("ImportDataOverlay.confirmSuccess"); |
| 168 } else { |
| 169 base::FundamentalValue state(false); |
| 170 web_ui_->CallJavascriptFunction("ImportDataOverlay.setImportingState", |
| 171 state); |
| 172 web_ui_->CallJavascriptFunction("ImportDataOverlay.dismiss"); |
| 173 } |
165 } | 174 } |
OLD | NEW |