| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #ifndef CHROME_BROWSER_IMPORTER_IMPORTER_H_ | 5 #ifndef CHROME_BROWSER_IMPORTER_IMPORTER_H_ |
| 6 #define CHROME_BROWSER_IMPORTER_IMPORTER_H_ | 6 #define CHROME_BROWSER_IMPORTER_IMPORTER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
| 12 | 12 |
| 13 #include "app/gfx/native_widget_types.h" | 13 #include "app/gfx/native_widget_types.h" |
| 14 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
| 15 #include "base/ref_counted.h" | 15 #include "base/ref_counted.h" |
| 16 #include "chrome/browser/bookmarks/bookmark_model_observer.h" | 16 #include "chrome/browser/bookmarks/bookmark_model_observer.h" |
| 17 #include "chrome/browser/history/history_types.h" | 17 #include "chrome/browser/history/history_types.h" |
| 18 #include "chrome/browser/importer/importer_list.h" | 18 #include "chrome/browser/importer/importer_list.h" |
| 19 #include "chrome/browser/profile.h" | 19 #include "chrome/browser/profile.h" |
| 20 #include "chrome/common/notification_registrar.h" | 20 #include "chrome/common/notification_registrar.h" |
| 21 #include "googleurl/src/gurl.h" | 21 #include "googleurl/src/gurl.h" |
| 22 | 22 |
| 23 class ImporterBridge; | 23 class ImporterBridge; |
| 24 class MessageLoop; | |
| 25 class TemplateURL; | 24 class TemplateURL; |
| 26 | 25 |
| 27 struct IE7PasswordInfo; | 26 struct IE7PasswordInfo; |
| 28 | 27 |
| 29 namespace webkit_glue { | 28 namespace webkit_glue { |
| 30 struct PasswordForm; | 29 struct PasswordForm; |
| 31 } | 30 } |
| 32 | 31 |
| 33 // An enumeration of the type of data we want to import. | 32 // An enumeration of the type of data we want to import. |
| 34 enum ImportItem { | 33 enum ImportItem { |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 // This class hosts the importers. It enumerates profiles from other | 150 // This class hosts the importers. It enumerates profiles from other |
| 152 // browsers dynamically, and controls the process of importing. When | 151 // browsers dynamically, and controls the process of importing. When |
| 153 // the import process is done, ImporterHost deletes itself. | 152 // the import process is done, ImporterHost deletes itself. |
| 154 class ImporterHost : public base::RefCountedThreadSafe<ImporterHost>, | 153 class ImporterHost : public base::RefCountedThreadSafe<ImporterHost>, |
| 155 public BookmarkModelObserver, | 154 public BookmarkModelObserver, |
| 156 public NotificationObserver { | 155 public NotificationObserver { |
| 157 public: | 156 public: |
| 158 ImporterHost(); | 157 ImporterHost(); |
| 159 ~ImporterHost(); | 158 ~ImporterHost(); |
| 160 | 159 |
| 161 // This constructor only be used by unit-tests, where file thread does not | |
| 162 // exist. | |
| 163 explicit ImporterHost(MessageLoop* file_loop); | |
| 164 | |
| 165 // BookmarkModelObserver methods. | 160 // BookmarkModelObserver methods. |
| 166 virtual void Loaded(BookmarkModel* model); | 161 virtual void Loaded(BookmarkModel* model); |
| 167 virtual void BookmarkNodeMoved(BookmarkModel* model, | 162 virtual void BookmarkNodeMoved(BookmarkModel* model, |
| 168 const BookmarkNode* old_parent, | 163 const BookmarkNode* old_parent, |
| 169 int old_index, | 164 int old_index, |
| 170 const BookmarkNode* new_parent, | 165 const BookmarkNode* new_parent, |
| 171 int new_index) {} | 166 int new_index) {} |
| 172 virtual void BookmarkNodeAdded(BookmarkModel* model, | 167 virtual void BookmarkNodeAdded(BookmarkModel* model, |
| 173 const BookmarkNode* parent, | 168 const BookmarkNode* parent, |
| 174 int index) {} | 169 int index) {} |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 | 281 |
| 287 Observer* observer_; | 282 Observer* observer_; |
| 288 scoped_refptr<ProfileWriter> writer_; | 283 scoped_refptr<ProfileWriter> writer_; |
| 289 | 284 |
| 290 // The task is the process of importing settings from other browsers. | 285 // The task is the process of importing settings from other browsers. |
| 291 Task* task_; | 286 Task* task_; |
| 292 | 287 |
| 293 // The importer used in the task; | 288 // The importer used in the task; |
| 294 Importer* importer_; | 289 Importer* importer_; |
| 295 | 290 |
| 296 // The message loop for reading the source profiles. | |
| 297 MessageLoop* file_loop_; | |
| 298 | |
| 299 // True if we're waiting for the model to finish loading. | 291 // True if we're waiting for the model to finish loading. |
| 300 bool waiting_for_bookmarkbar_model_; | 292 bool waiting_for_bookmarkbar_model_; |
| 301 | 293 |
| 302 // Have we installed a listener on the bookmark model? | 294 // Have we installed a listener on the bookmark model? |
| 303 bool installed_bookmark_observer_; | 295 bool installed_bookmark_observer_; |
| 304 | 296 |
| 305 // True if source profile is readable. | 297 // True if source profile is readable. |
| 306 bool is_source_readable_; | 298 bool is_source_readable_; |
| 307 | 299 |
| 308 // True if UI is not to be shown. | 300 // True if UI is not to be shown. |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 // first run UI. | 375 // first run UI. |
| 384 void StartImportingWithUI(gfx::NativeWindow parent_window, | 376 void StartImportingWithUI(gfx::NativeWindow parent_window, |
| 385 int16 items, | 377 int16 items, |
| 386 ImporterHost* coordinator, | 378 ImporterHost* coordinator, |
| 387 const ProfileInfo& source_profile, | 379 const ProfileInfo& source_profile, |
| 388 Profile* target_profile, | 380 Profile* target_profile, |
| 389 ImportObserver* observer, | 381 ImportObserver* observer, |
| 390 bool first_run); | 382 bool first_run); |
| 391 | 383 |
| 392 #endif // CHROME_BROWSER_IMPORTER_IMPORTER_H_ | 384 #endif // CHROME_BROWSER_IMPORTER_IMPORTER_H_ |
| OLD | NEW |