| 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_H_ | 5 #ifndef CHROME_BROWSER_IMPORTER_H_ |
| 6 #define CHROME_BROWSER_IMPORTER_H_ | 6 #define CHROME_BROWSER_IMPORTER_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
| 13 #include "base/ref_counted.h" | 13 #include "base/ref_counted.h" |
| 14 #include "chrome/browser/bookmarks/bookmark_bar_model.h" | 14 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 15 #include "chrome/browser/history/history_types.h" | 15 #include "chrome/browser/history/history_types.h" |
| 16 #include "chrome/browser/ie7_password.h" | 16 #include "chrome/browser/ie7_password.h" |
| 17 #include "chrome/browser/profile.h" | 17 #include "chrome/browser/profile.h" |
| 18 #include "chrome/browser/template_url.h" | 18 #include "chrome/browser/template_url.h" |
| 19 #include "chrome/browser/views/importer_lock_view.h" | 19 #include "chrome/browser/views/importer_lock_view.h" |
| 20 #include "chrome/common/notification_service.h" | 20 #include "chrome/common/notification_service.h" |
| 21 #include "googleurl/src/gurl.h" | 21 #include "googleurl/src/gurl.h" |
| 22 #include "webkit/glue/password_form.h" | 22 #include "webkit/glue/password_form.h" |
| 23 | 23 |
| 24 // An enumeration of the type of browsers that we support to import | 24 // An enumeration of the type of browsers that we support to import |
| (...skipping 25 matching lines...) Expand all Loading... |
| 50 class FirefoxProfileLock; | 50 class FirefoxProfileLock; |
| 51 class Importer; | 51 class Importer; |
| 52 | 52 |
| 53 // ProfileWriter encapsulates profile for writing entries into it. | 53 // ProfileWriter encapsulates profile for writing entries into it. |
| 54 // This object must be invoked on UI thread. | 54 // This object must be invoked on UI thread. |
| 55 class ProfileWriter : public base::RefCounted<ProfileWriter> { | 55 class ProfileWriter : public base::RefCounted<ProfileWriter> { |
| 56 public: | 56 public: |
| 57 explicit ProfileWriter(Profile* profile) : profile_(profile) { } | 57 explicit ProfileWriter(Profile* profile) : profile_(profile) { } |
| 58 virtual ~ProfileWriter() { } | 58 virtual ~ProfileWriter() { } |
| 59 | 59 |
| 60 // Methods for monitoring BookmarkBarModel status. | 60 // Methods for monitoring BookmarkModel status. |
| 61 virtual bool BookmarkBarModelIsLoaded() const; | 61 virtual bool BookmarkModelIsLoaded() const; |
| 62 virtual void AddBookmarkBarModelObserver( | 62 virtual void AddBookmarkModelObserver( |
| 63 BookmarkBarModelObserver* observer); | 63 BookmarkModelObserver* observer); |
| 64 | 64 |
| 65 // Methods for monitoring TemplateURLModel status. | 65 // Methods for monitoring TemplateURLModel status. |
| 66 virtual bool TemplateURLModelIsLoaded() const; | 66 virtual bool TemplateURLModelIsLoaded() const; |
| 67 virtual void AddTemplateURLModelObserver( | 67 virtual void AddTemplateURLModelObserver( |
| 68 NotificationObserver* observer); | 68 NotificationObserver* observer); |
| 69 | 69 |
| 70 // A bookmark entry. | 70 // A bookmark entry. |
| 71 struct BookmarkEntry { | 71 struct BookmarkEntry { |
| 72 bool in_toolbar; | 72 bool in_toolbar; |
| 73 GURL url; | 73 GURL url; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 private: | 106 private: |
| 107 Profile* profile_; | 107 Profile* profile_; |
| 108 | 108 |
| 109 DISALLOW_EVIL_CONSTRUCTORS(ProfileWriter); | 109 DISALLOW_EVIL_CONSTRUCTORS(ProfileWriter); |
| 110 }; | 110 }; |
| 111 | 111 |
| 112 // This class hosts the importers. It enumerates profiles from other | 112 // This class hosts the importers. It enumerates profiles from other |
| 113 // browsers dynamically, and controls the process of importing. When | 113 // browsers dynamically, and controls the process of importing. When |
| 114 // the import process is done, ImporterHost deletes itself. | 114 // the import process is done, ImporterHost deletes itself. |
| 115 class ImporterHost : public base::RefCounted<ImporterHost>, | 115 class ImporterHost : public base::RefCounted<ImporterHost>, |
| 116 public BookmarkBarModelObserver, | 116 public BookmarkModelObserver, |
| 117 public NotificationObserver { | 117 public NotificationObserver { |
| 118 public: | 118 public: |
| 119 ImporterHost(); | 119 ImporterHost(); |
| 120 ~ImporterHost(); | 120 ~ImporterHost(); |
| 121 | 121 |
| 122 // This constructor only be used by unit-tests, where file thread does not | 122 // This constructor only be used by unit-tests, where file thread does not |
| 123 // exist. | 123 // exist. |
| 124 explicit ImporterHost(MessageLoop* file_loop); | 124 explicit ImporterHost(MessageLoop* file_loop); |
| 125 | 125 |
| 126 // BookmarkBarModelObserver methods. | 126 // BookmarkModelObserver methods. |
| 127 virtual void Loaded(BookmarkBarModel* model); | 127 virtual void Loaded(BookmarkModel* model); |
| 128 virtual void BookmarkNodeMoved(BookmarkBarModel* model, | 128 virtual void BookmarkNodeMoved(BookmarkModel* model, |
| 129 BookmarkBarNode* old_parent, | 129 BookmarkNode* old_parent, |
| 130 int old_index, | 130 int old_index, |
| 131 BookmarkBarNode* new_parent, | 131 BookmarkNode* new_parent, |
| 132 int new_index) {} | 132 int new_index) {} |
| 133 virtual void BookmarkNodeAdded(BookmarkBarModel* model, | 133 virtual void BookmarkNodeAdded(BookmarkModel* model, |
| 134 BookmarkBarNode* parent, | 134 BookmarkNode* parent, |
| 135 int index) {} | 135 int index) {} |
| 136 virtual void BookmarkNodeRemoved(BookmarkBarModel* model, | 136 virtual void BookmarkNodeRemoved(BookmarkModel* model, |
| 137 BookmarkBarNode* parent, | 137 BookmarkNode* parent, |
| 138 int index) {} | 138 int index) {} |
| 139 virtual void BookmarkNodeChanged(BookmarkBarModel* model, | 139 virtual void BookmarkNodeChanged(BookmarkModel* model, |
| 140 BookmarkBarNode* node) {} | 140 BookmarkNode* node) {} |
| 141 virtual void BookmarkNodeFavIconLoaded(BookmarkBarModel* model, | 141 virtual void BookmarkNodeFavIconLoaded(BookmarkModel* model, |
| 142 BookmarkBarNode* node) {} | 142 BookmarkNode* node) {} |
| 143 | 143 |
| 144 // NotificationObserver method. Called when TemplateURLModel has been loaded. | 144 // NotificationObserver method. Called when TemplateURLModel has been loaded. |
| 145 void Observe(NotificationType type, | 145 void Observe(NotificationType type, |
| 146 const NotificationSource& source, | 146 const NotificationSource& source, |
| 147 const NotificationDetails& details); | 147 const NotificationDetails& details); |
| 148 | 148 |
| 149 // ShowWarningDialog() asks user to close the application that is owning the | 149 // ShowWarningDialog() asks user to close the application that is owning the |
| 150 // lock. They can retry or skip the importing process. | 150 // lock. They can retry or skip the importing process. |
| 151 void ShowWarningDialog(); | 151 void ShowWarningDialog(); |
| 152 | 152 |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 void StartImportingWithUI(HWND parent_window, | 348 void StartImportingWithUI(HWND parent_window, |
| 349 int16 items, | 349 int16 items, |
| 350 ImporterHost* coordinator, | 350 ImporterHost* coordinator, |
| 351 const ProfileInfo& source_profile, | 351 const ProfileInfo& source_profile, |
| 352 Profile* target_profile, | 352 Profile* target_profile, |
| 353 ImportObserver* observer, | 353 ImportObserver* observer, |
| 354 bool first_run); | 354 bool first_run); |
| 355 | 355 |
| 356 #endif // CHROME_BROWSER_IMPORTER_H__ | 356 #endif // CHROME_BROWSER_IMPORTER_H__ |
| 357 | 357 |
| OLD | NEW |