diff options
author | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-20 22:18:42 +0000 |
---|---|---|
committer | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-20 22:18:42 +0000 |
commit | e74b81de4f2785b5cff5cb0cc85e76b3d434248e (patch) | |
tree | 14716cb1d95f70183af2662267e0d91894a347b3 /chrome | |
parent | c0880ac6162b177d08a11c6f0f16759d23be2e09 (diff) | |
download | chromium_src-e74b81de4f2785b5cff5cb0cc85e76b3d434248e.zip chromium_src-e74b81de4f2785b5cff5cb0cc85e76b3d434248e.tar.gz chromium_src-e74b81de4f2785b5cff5cb0cc85e76b3d434248e.tar.bz2 |
Header cleanup in browser/importer
- forward declare more things
- move bits from header to implementation files to cut includes
- extract bookmark_model_observer.h out of bookmark_model.h to reduce includes
Review URL: http://codereview.chromium.org/159097
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21116 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/bookmarks/bookmark_model.h | 49 | ||||
-rw-r--r-- | chrome/browser/bookmarks/bookmark_model_observer.h | 56 | ||||
-rw-r--r-- | chrome/browser/importer/firefox2_importer.cc | 3 | ||||
-rw-r--r-- | chrome/browser/importer/firefox3_importer.cc | 5 | ||||
-rw-r--r-- | chrome/browser/importer/firefox3_importer.h | 3 | ||||
-rw-r--r-- | chrome/browser/importer/firefox_importer_utils.cc | 3 | ||||
-rw-r--r-- | chrome/browser/importer/firefox_importer_utils.h | 11 | ||||
-rw-r--r-- | chrome/browser/importer/firefox_importer_utils_linux.cc | 2 | ||||
-rw-r--r-- | chrome/browser/importer/firefox_importer_utils_mac.cc | 1 | ||||
-rw-r--r-- | chrome/browser/importer/firefox_importer_utils_win.cc | 1 | ||||
-rw-r--r-- | chrome/browser/importer/ie_importer.cc | 1 | ||||
-rw-r--r-- | chrome/browser/importer/importer.cc | 33 | ||||
-rw-r--r-- | chrome/browser/importer/importer.h | 47 | ||||
-rw-r--r-- | chrome/browser/importer/mork_reader.cc | 2 | ||||
-rw-r--r-- | chrome/browser/importer/mork_reader.h | 9 | ||||
-rw-r--r-- | chrome/browser/views/importer_lock_view.cc | 1 |
16 files changed, 141 insertions, 86 deletions
diff --git a/chrome/browser/bookmarks/bookmark_model.h b/chrome/browser/bookmarks/bookmark_model.h index 4157089..760c7b6 100644 --- a/chrome/browser/bookmarks/bookmark_model.h +++ b/chrome/browser/bookmarks/bookmark_model.h @@ -14,6 +14,7 @@ #include "base/lock.h" #include "base/observer_list.h" #include "base/waitable_event.h" +#include "chrome/browser/bookmarks/bookmark_model_observer.h" #include "chrome/browser/bookmarks/bookmark_service.h" #include "chrome/browser/bookmarks/bookmark_storage.h" #include "chrome/browser/bookmarks/bookmark_utils.h" @@ -156,54 +157,6 @@ class BookmarkNode : public TreeNode<BookmarkNode> { DISALLOW_COPY_AND_ASSIGN(BookmarkNode); }; -// BookmarkModelObserver ------------------------------------------------------ - -// Observer for the BookmarkModel. -// -class BookmarkModelObserver { - public: - // Invoked when the model has finished loading. - virtual void Loaded(BookmarkModel* model) = 0; - - // Invoked from the destructor of the BookmarkModel. - virtual void BookmarkModelBeingDeleted(BookmarkModel* model) { } - - // Invoked when a node has moved. - virtual void BookmarkNodeMoved(BookmarkModel* model, - const BookmarkNode* old_parent, - int old_index, - const BookmarkNode* new_parent, - int new_index) = 0; - - // Invoked when a node has been added. - virtual void BookmarkNodeAdded(BookmarkModel* model, - const BookmarkNode* parent, - int index) = 0; - - // Invoked when a node has been removed, the item may still be starred though. - // |parent| the parent of the node that was removed. - // |old_index| the index of the removed node in |parent| before it was - // removed. - // |node| is the node that was removed. - virtual void BookmarkNodeRemoved(BookmarkModel* model, - const BookmarkNode* parent, - int old_index, - const BookmarkNode* node) = 0; - - // Invoked when the title or favicon of a node has changed. - virtual void BookmarkNodeChanged(BookmarkModel* model, - const BookmarkNode* node) = 0; - - // Invoked when a favicon has finished loading. - virtual void BookmarkNodeFavIconLoaded(BookmarkModel* model, - const BookmarkNode* node) = 0; - - // Invoked when the children (just direct children, not descendants) of - // |node| have been reordered in some way, such as sorted. - virtual void BookmarkNodeChildrenReordered(BookmarkModel* model, - const BookmarkNode* node) = 0; -}; - // BookmarkModel -------------------------------------------------------------- // BookmarkModel provides a directed acyclic graph of the starred entries diff --git a/chrome/browser/bookmarks/bookmark_model_observer.h b/chrome/browser/bookmarks/bookmark_model_observer.h new file mode 100644 index 0000000..1b85fe3 --- /dev/null +++ b/chrome/browser/bookmarks/bookmark_model_observer.h @@ -0,0 +1,56 @@ +// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_BOOKMARKS_BOOKMARK_MODEL_OBSERVER_H_ +#define CHROME_BROWSER_BOOKMARKS_BOOKMARK_MODEL_OBSERVER_H_ + +class BookmarkModel; +class BookmarkNode; + +// Observer for the BookmarkModel. +class BookmarkModelObserver { + public: + // Invoked when the model has finished loading. + virtual void Loaded(BookmarkModel* model) = 0; + + // Invoked from the destructor of the BookmarkModel. + virtual void BookmarkModelBeingDeleted(BookmarkModel* model) { } + + // Invoked when a node has moved. + virtual void BookmarkNodeMoved(BookmarkModel* model, + const BookmarkNode* old_parent, + int old_index, + const BookmarkNode* new_parent, + int new_index) = 0; + + // Invoked when a node has been added. + virtual void BookmarkNodeAdded(BookmarkModel* model, + const BookmarkNode* parent, + int index) = 0; + + // Invoked when a node has been removed, the item may still be starred though. + // |parent| the parent of the node that was removed. + // |old_index| the index of the removed node in |parent| before it was + // removed. + // |node| is the node that was removed. + virtual void BookmarkNodeRemoved(BookmarkModel* model, + const BookmarkNode* parent, + int old_index, + const BookmarkNode* node) = 0; + + // Invoked when the title or favicon of a node has changed. + virtual void BookmarkNodeChanged(BookmarkModel* model, + const BookmarkNode* node) = 0; + + // Invoked when a favicon has finished loading. + virtual void BookmarkNodeFavIconLoaded(BookmarkModel* model, + const BookmarkNode* node) = 0; + + // Invoked when the children (just direct children, not descendants) of + // |node| have been reordered in some way, such as sorted. + virtual void BookmarkNodeChildrenReordered(BookmarkModel* model, + const BookmarkNode* node) = 0; +}; + +#endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_MODEL_OBSERVER_H_ diff --git a/chrome/browser/importer/firefox2_importer.cc b/chrome/browser/importer/firefox2_importer.cc index 7e680fb..83e391e 100644 --- a/chrome/browser/importer/firefox2_importer.cc +++ b/chrome/browser/importer/firefox2_importer.cc @@ -7,7 +7,9 @@ #include "app/l10n_util.h" #include "base/file_path.h" #include "base/file_util.h" +#include "base/message_loop.h" #include "base/path_service.h" +#include "base/stl_util-inl.h" #include "base/string_util.h" #include "base/values.h" #include "chrome/browser/importer/firefox_importer_utils.h" @@ -18,6 +20,7 @@ #include "chrome/common/url_constants.h" #include "grit/generated_resources.h" #include "net/base/data_url.h" +#include "webkit/glue/password_form.h" using base::Time; using webkit_glue::PasswordForm; diff --git a/chrome/browser/importer/firefox3_importer.cc b/chrome/browser/importer/firefox3_importer.cc index 8e739982..cad7044 100644 --- a/chrome/browser/importer/firefox3_importer.cc +++ b/chrome/browser/importer/firefox3_importer.cc @@ -8,12 +8,17 @@ #include "app/l10n_util.h" #include "base/file_util.h" +#include "base/message_loop.h" #include "base/scoped_ptr.h" +#include "base/stl_util-inl.h" #include "base/string_util.h" #include "chrome/browser/importer/firefox2_importer.h" #include "chrome/browser/importer/firefox_importer_utils.h" +#include "chrome/browser/search_engines/template_url.h" #include "chrome/common/time_format.h" +#include "chrome/common/sqlite_utils.h" #include "grit/generated_resources.h" +#include "webkit/glue/password_form.h" using base::Time; using webkit_glue::PasswordForm; diff --git a/chrome/browser/importer/firefox3_importer.h b/chrome/browser/importer/firefox3_importer.h index a8b54ff..12a678f 100644 --- a/chrome/browser/importer/firefox3_importer.h +++ b/chrome/browser/importer/firefox3_importer.h @@ -11,9 +11,10 @@ #include "base/basictypes.h" #include "chrome/browser/importer/importer.h" -#include "chrome/common/sqlite_utils.h" #include "googleurl/src/gurl.h" +struct sqlite3; + // Importer for Mozilla Firefox 3. // Firefox 3 stores its persistent information in a new system called places. // http://wiki.mozilla.org/Places diff --git a/chrome/browser/importer/firefox_importer_utils.cc b/chrome/browser/importer/firefox_importer_utils.cc index df0e5aa..0b2b89f 100644 --- a/chrome/browser/importer/firefox_importer_utils.cc +++ b/chrome/browser/importer/firefox_importer_utils.cc @@ -6,14 +6,17 @@ #include <algorithm> +#include "base/file_util.h" #include "base/logging.h" #include "base/string_util.h" #include "base/sys_string_conversions.h" +#include "base/values.h" #include "chrome/browser/search_engines/template_url.h" #include "chrome/browser/search_engines/template_url_model.h" #include "chrome/browser/search_engines/template_url_parser.h" #include "googleurl/src/gurl.h" #include "net/base/base64.h" +#include "webkit/glue/password_form.h" using webkit_glue::PasswordForm; diff --git a/chrome/browser/importer/firefox_importer_utils.h b/chrome/browser/importer/firefox_importer_utils.h index 47deecf..21fb43d 100644 --- a/chrome/browser/importer/firefox_importer_utils.h +++ b/chrome/browser/importer/firefox_importer_utils.h @@ -5,16 +5,21 @@ #ifndef CHROME_BROWSER_IMPORTER_FIREFOX_IMPORTER_UTILS_H_ #define CHROME_BROWSER_IMPORTER_FIREFOX_IMPORTER_UTILS_H_ +#include <vector> + #include "base/basictypes.h" -#include "base/file_util.h" +#include "base/file_path.h" #include "base/native_library.h" -#include "base/values.h" #include "build/build_config.h" -#include "webkit/glue/password_form.h" +class DictionaryValue; class GURL; class TemplateURL; +namespace webkit_glue { +struct PasswordForm; +} + #if defined(OS_WIN) // Detects which version of Firefox is installed from registry. Returns its // major version, and drops the minor version. Returns 0 if diff --git a/chrome/browser/importer/firefox_importer_utils_linux.cc b/chrome/browser/importer/firefox_importer_utils_linux.cc index 66f39a1..3dff06c 100644 --- a/chrome/browser/importer/firefox_importer_utils_linux.cc +++ b/chrome/browser/importer/firefox_importer_utils_linux.cc @@ -4,6 +4,8 @@ #include "chrome/browser/importer/firefox_importer_utils.h" +#include "base/file_util.h" + FilePath GetProfilesINI() { FilePath ini_file; // The default location of the profile folder containing user data is diff --git a/chrome/browser/importer/firefox_importer_utils_mac.cc b/chrome/browser/importer/firefox_importer_utils_mac.cc index 9fb3cf5..7b510ac 100644 --- a/chrome/browser/importer/firefox_importer_utils_mac.cc +++ b/chrome/browser/importer/firefox_importer_utils_mac.cc @@ -4,6 +4,7 @@ #include "chrome/browser/importer/firefox_importer_utils.h" +#include "base/file_util.h" #include "base/logging.h" FilePath GetProfilesINI() { diff --git a/chrome/browser/importer/firefox_importer_utils_win.cc b/chrome/browser/importer/firefox_importer_utils_win.cc index 96ca096..cb09aa1 100644 --- a/chrome/browser/importer/firefox_importer_utils_win.cc +++ b/chrome/browser/importer/firefox_importer_utils_win.cc @@ -6,6 +6,7 @@ #include <shlobj.h> +#include "base/file_util.h" #include "base/registry.h" namespace { diff --git a/chrome/browser/importer/ie_importer.cc b/chrome/browser/importer/ie_importer.cc index 9db6396..ac345a7 100644 --- a/chrome/browser/importer/ie_importer.cc +++ b/chrome/browser/importer/ie_importer.cc @@ -27,6 +27,7 @@ #include "chrome/common/url_constants.h" #include "googleurl/src/gurl.h" #include "grit/generated_resources.h" +#include "webkit/glue/password_form.h" using base::Time; using webkit_glue::PasswordForm; diff --git a/chrome/browser/importer/importer.cc b/chrome/browser/importer/importer.cc index b9f4600..f311540 100644 --- a/chrome/browser/importer/importer.cc +++ b/chrome/browser/importer/importer.cc @@ -14,6 +14,7 @@ #endif #include "base/file_util.h" #include "base/gfx/png_encoder.h" +#include "base/message_loop.h" #include "base/string_util.h" #include "chrome/browser/bookmarks/bookmark_model.h" #include "chrome/browser/browser.h" @@ -28,6 +29,9 @@ #include "chrome/browser/importer/ie_importer.h" #endif #include "chrome/browser/importer/toolbar_importer.h" +#if defined(OS_WIN) +#include "chrome/browser/password_manager/ie7_password.h" +#endif #include "chrome/browser/renderer_host/site_instance.h" #include "chrome/browser/search_engines/template_url_model.h" #include "chrome/browser/shell_integration.h" @@ -38,6 +42,7 @@ #include "grit/generated_resources.h" #include "skia/ext/image_operations.h" #include "webkit/glue/image_decoder.h" +#include "webkit/glue/password_form.h" // TODO(port): Port these files. #if defined(OS_WIN) @@ -371,6 +376,34 @@ bool ProfileWriter::DoesBookmarkExist( // Importer. +Importer::Importer() + : main_loop_(MessageLoop::current()), + delagate_loop_(NULL), + importer_host_(NULL), + cancelled_(false), + import_to_bookmark_bar_(false) { +} + +void Importer::NotifyItemStarted(ImportItem item) { + main_loop_->PostTask(FROM_HERE, NewRunnableMethod(importer_host_, + &ImporterHost::ImportItemStarted, item)); +} + +void Importer::NotifyItemEnded(ImportItem item) { + main_loop_->PostTask(FROM_HERE, NewRunnableMethod(importer_host_, + &ImporterHost::ImportItemEnded, item)); +} + +void Importer::NotifyStarted() { + main_loop_->PostTask(FROM_HERE, NewRunnableMethod(importer_host_, + &ImporterHost::ImportStarted)); +} + +void Importer::NotifyEnded() { + main_loop_->PostTask(FROM_HERE, + NewRunnableMethod(importer_host_, &ImporterHost::ImportEnded)); +} + // static bool Importer::ReencodeFavicon(const unsigned char* src_data, size_t src_len, std::vector<unsigned char>* png_data) { diff --git a/chrome/browser/importer/importer.h b/chrome/browser/importer/importer.h index 67f7cc4..839725a 100644 --- a/chrome/browser/importer/importer.h +++ b/chrome/browser/importer/importer.h @@ -5,24 +5,28 @@ #ifndef CHROME_BROWSER_IMPORTER_IMPORTER_H_ #define CHROME_BROWSER_IMPORTER_IMPORTER_H_ -#include <set> +#include <string> #include <vector> #include "build/build_config.h" #include "base/basictypes.h" -#include "base/message_loop.h" +#include "base/gfx/native_widget_types.h" #include "base/ref_counted.h" -#include "chrome/browser/bookmarks/bookmark_model.h" +#include "chrome/browser/bookmarks/bookmark_model_observer.h" #include "chrome/browser/history/history_types.h" -#if defined(OS_WIN) -#include "chrome/browser/password_manager/ie7_password.h" -#endif #include "chrome/browser/profile.h" -#include "chrome/browser/search_engines/template_url.h" #include "chrome/common/notification_registrar.h" #include "googleurl/src/gurl.h" -#include "webkit/glue/password_form.h" + +class MessageLoop; +class TemplateURL; + +struct IE7PasswordInfo; + +namespace webkit_glue { +struct PasswordForm; +} // An enumeration of the type of browsers that we support to import // settings and data from them. @@ -351,38 +355,21 @@ class Importer : public base::RefCounted<Importer> { bool cancelled() const { return cancelled_; } protected: - Importer() - : main_loop_(MessageLoop::current()), - delagate_loop_(NULL), - importer_host_(NULL), - cancelled_(false), - import_to_bookmark_bar_(false) {} + Importer(); // Notifies the coordinator that the collection of data for the specified // item has begun. - void NotifyItemStarted(ImportItem item) { - main_loop_->PostTask(FROM_HERE, NewRunnableMethod(importer_host_, - &ImporterHost::ImportItemStarted, item)); - } + void NotifyItemStarted(ImportItem item); // Notifies the coordinator that the collection of data for the specified // item has completed. - void NotifyItemEnded(ImportItem item) { - main_loop_->PostTask(FROM_HERE, NewRunnableMethod(importer_host_, - &ImporterHost::ImportItemEnded, item)); - } + void NotifyItemEnded(ImportItem item); // Notifies the coordinator that the import operation has begun. - void NotifyStarted() { - main_loop_->PostTask(FROM_HERE, NewRunnableMethod(importer_host_, - &ImporterHost::ImportStarted)); - } + void NotifyStarted(); // Notifies the coordinator that the entire import operation has completed. - void NotifyEnded() { - main_loop_->PostTask(FROM_HERE, - NewRunnableMethod(importer_host_, &ImporterHost::ImportEnded)); - } + void NotifyEnded(); // Given raw image data, decodes the icon, re-sampling to the correct size as // necessary, and re-encodes as PNG data in the given output vector. Returns diff --git a/chrome/browser/importer/mork_reader.cc b/chrome/browser/importer/mork_reader.cc index 7f5e5c6..5352902 100644 --- a/chrome/browser/importer/mork_reader.cc +++ b/chrome/browser/importer/mork_reader.cc @@ -46,9 +46,11 @@ #include "base/file_path.h" #include "base/logging.h" +#include "base/message_loop.h" #include "base/string_util.h" #include "chrome/browser/history/history_types.h" #include "chrome/browser/importer/firefox_importer_utils.h" +#include "chrome/browser/importer/importer.h" using base::Time; diff --git a/chrome/browser/importer/mork_reader.h b/chrome/browser/importer/mork_reader.h index 1e54b93..d4844a0 100644 --- a/chrome/browser/importer/mork_reader.h +++ b/chrome/browser/importer/mork_reader.h @@ -42,15 +42,16 @@ #ifndef CHROME_BROWSER_IMPORTER_MORK_READER_H__ #define CHROME_BROWSER_IMPORTER_MORK_READER_H__ -#include <map> -#include <iostream> +#include <iosfwd> #include <fstream> +#include <map> #include <string> #include <vector> #include "base/basictypes.h" -#include "base/stack_container.h" -#include "chrome/browser/importer/importer.h" + +class MessageLoop; +class ProfileWriter; // The nsMorkReader object allows a consumer to read in a mork-format // file and enumerate the rows that it contains. It does not provide diff --git a/chrome/browser/views/importer_lock_view.cc b/chrome/browser/views/importer_lock_view.cc index 3d58b33..7eca14f 100644 --- a/chrome/browser/views/importer_lock_view.cc +++ b/chrome/browser/views/importer_lock_view.cc @@ -5,6 +5,7 @@ #include "chrome/browser/views/importer_lock_view.h" #include "app/l10n_util.h" +#include "base/message_loop.h" #include "chrome/browser/importer/importer.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" |