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/first_run/first_run.h" | 5 #include "chrome/browser/first_run/first_run.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 should_quit_message_loop_(false) {} | 81 should_quit_message_loop_(false) {} |
82 virtual ~ImportEndedObserver() {} | 82 virtual ~ImportEndedObserver() {} |
83 | 83 |
84 // importer::ImporterProgressObserver: | 84 // importer::ImporterProgressObserver: |
85 virtual void ImportStarted() OVERRIDE {} | 85 virtual void ImportStarted() OVERRIDE {} |
86 virtual void ImportItemStarted(importer::ImportItem item) OVERRIDE {} | 86 virtual void ImportItemStarted(importer::ImportItem item) OVERRIDE {} |
87 virtual void ImportItemEnded(importer::ImportItem item) OVERRIDE {} | 87 virtual void ImportItemEnded(importer::ImportItem item) OVERRIDE {} |
88 virtual void ImportEnded() OVERRIDE { | 88 virtual void ImportEnded() OVERRIDE { |
89 ended_ = true; | 89 ended_ = true; |
90 if (should_quit_message_loop_) | 90 if (should_quit_message_loop_) |
91 MessageLoop::current()->Quit(); | 91 base::MessageLoop::current()->Quit(); |
92 } | 92 } |
93 | 93 |
94 void set_should_quit_message_loop() { | 94 void set_should_quit_message_loop() { |
95 should_quit_message_loop_ = true; | 95 should_quit_message_loop_ = true; |
96 } | 96 } |
97 | 97 |
98 bool ended() const { | 98 bool ended() const { |
99 return ended_; | 99 return ended_; |
100 } | 100 } |
101 | 101 |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 uint16 items_to_import) { | 237 uint16 items_to_import) { |
238 ImportEndedObserver observer; | 238 ImportEndedObserver observer; |
239 importer_host->SetObserver(&observer); | 239 importer_host->SetObserver(&observer); |
240 importer_host->StartImportSettings(source_profile, | 240 importer_host->StartImportSettings(source_profile, |
241 target_profile, | 241 target_profile, |
242 items_to_import, | 242 items_to_import, |
243 new ProfileWriter(target_profile)); | 243 new ProfileWriter(target_profile)); |
244 // If the import process has not errored out, block on it. | 244 // If the import process has not errored out, block on it. |
245 if (!observer.ended()) { | 245 if (!observer.ended()) { |
246 observer.set_should_quit_message_loop(); | 246 observer.set_should_quit_message_loop(); |
247 MessageLoop::current()->Run(); | 247 base::MessageLoop::current()->Run(); |
248 } | 248 } |
249 } | 249 } |
250 | 250 |
251 // Imports bookmarks from an html file whose path is provided by | 251 // Imports bookmarks from an html file whose path is provided by |
252 // |import_bookmarks_path|. | 252 // |import_bookmarks_path|. |
253 void ImportFromFile(Profile* profile, | 253 void ImportFromFile(Profile* profile, |
254 ImporterHost* file_importer_host, | 254 ImporterHost* file_importer_host, |
255 const std::string& import_bookmarks_path) { | 255 const std::string& import_bookmarks_path) { |
256 importer::SourceProfile source_profile; | 256 importer::SourceProfile source_profile; |
257 source_profile.importer_type = importer::TYPE_BOOKMARKS_FILE; | 257 source_profile.importer_type = importer::TYPE_BOOKMARKS_FILE; |
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
793 SetShouldDoPersonalDataManagerFirstRun(); | 793 SetShouldDoPersonalDataManagerFirstRun(); |
794 | 794 |
795 internal::DoPostImportPlatformSpecificTasks(profile); | 795 internal::DoPostImportPlatformSpecificTasks(profile); |
796 } | 796 } |
797 | 797 |
798 uint16 auto_import_state() { | 798 uint16 auto_import_state() { |
799 return g_auto_import_state; | 799 return g_auto_import_state; |
800 } | 800 } |
801 | 801 |
802 } // namespace first_run | 802 } // namespace first_run |
OLD | NEW |