diff options
Diffstat (limited to 'components/enhanced_bookmarks')
9 files changed, 55 insertions, 32 deletions
diff --git a/components/enhanced_bookmarks/bookmark_image_service.cc b/components/enhanced_bookmarks/bookmark_image_service.cc index 066d9f9..0831e38 100644 --- a/components/enhanced_bookmarks/bookmark_image_service.cc +++ b/components/enhanced_bookmarks/bookmark_image_service.cc @@ -1,6 +1,7 @@ // Copyright 2014 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. + #include "components/enhanced_bookmarks/bookmark_image_service.h" #include "base/single_thread_task_runner.h" @@ -12,6 +13,8 @@ #include "components/enhanced_bookmarks/enhanced_bookmark_utils.h" #include "components/enhanced_bookmarks/persistent_image_store.h" +using bookmarks::BookmarkModel; + namespace { const char kSequenceToken[] = "BookmarkImagesSequenceToken"; diff --git a/components/enhanced_bookmarks/bookmark_image_service.h b/components/enhanced_bookmarks/bookmark_image_service.h index 02a61b4..2ee8d61 100644 --- a/components/enhanced_bookmarks/bookmark_image_service.h +++ b/components/enhanced_bookmarks/bookmark_image_service.h @@ -49,29 +49,30 @@ class BookmarkImageService : public KeyedService, void SalientImageForUrl(const GURL& page_url, Callback callback); // bookmarks::BookmarkModelObserver: - void BookmarkNodeRemoved(BookmarkModel* model, + void BookmarkNodeRemoved(bookmarks::BookmarkModel* model, const BookmarkNode* parent, int old_index, const BookmarkNode* node, const std::set<GURL>& removed_urls) override; - void BookmarkModelLoaded(BookmarkModel* model, bool ids_reassigned) override; - void BookmarkNodeMoved(BookmarkModel* model, + void BookmarkModelLoaded(bookmarks::BookmarkModel* model, + bool ids_reassigned) override; + void BookmarkNodeMoved(bookmarks::BookmarkModel* model, const BookmarkNode* old_parent, int old_index, const BookmarkNode* new_parent, int new_index) override; - void BookmarkNodeAdded(BookmarkModel* model, + void BookmarkNodeAdded(bookmarks::BookmarkModel* model, const BookmarkNode* parent, int index) override; - void OnWillChangeBookmarkNode(BookmarkModel* model, + void OnWillChangeBookmarkNode(bookmarks::BookmarkModel* model, const BookmarkNode* node) override; - void BookmarkNodeChanged(BookmarkModel* model, + void BookmarkNodeChanged(bookmarks::BookmarkModel* model, const BookmarkNode* node) override; - void BookmarkNodeFaviconChanged(BookmarkModel* model, + void BookmarkNodeFaviconChanged(bookmarks::BookmarkModel* model, const BookmarkNode* node) override; - void BookmarkNodeChildrenReordered(BookmarkModel* model, + void BookmarkNodeChildrenReordered(bookmarks::BookmarkModel* model, const BookmarkNode* node) override; - void BookmarkAllUserNodesRemoved(BookmarkModel* model, + void BookmarkAllUserNodesRemoved(bookmarks::BookmarkModel* model, const std::set<GURL>& removed_urls) override; protected: diff --git a/components/enhanced_bookmarks/enhanced_bookmark_model.cc b/components/enhanced_bookmarks/enhanced_bookmark_model.cc index 4b4b590..f9d3478 100644 --- a/components/enhanced_bookmarks/enhanced_bookmark_model.cc +++ b/components/enhanced_bookmarks/enhanced_bookmark_model.cc @@ -19,6 +19,8 @@ #include "ui/base/models/tree_node_iterator.h" #include "url/gurl.h" +using bookmarks::BookmarkModel; + namespace { const char* kBookmarkBarId = "f_bookmarks_bar"; diff --git a/components/enhanced_bookmarks/enhanced_bookmark_model.h b/components/enhanced_bookmarks/enhanced_bookmark_model.h index 9ba68e0..7eab266 100644 --- a/components/enhanced_bookmarks/enhanced_bookmark_model.h +++ b/components/enhanced_bookmarks/enhanced_bookmark_model.h @@ -17,13 +17,16 @@ #include "components/bookmarks/browser/bookmark_node.h" #include "components/keyed_service/core/keyed_service.h" +class BookmarkNode; +class GURL; + namespace base { class Time; -} // namespace base +} +namespace bookmarks { class BookmarkModel; -class BookmarkNode; -class GURL; +} FORWARD_DECLARE_TEST(EnhancedBookmarkModelTest, SetMultipleMetaInfo); @@ -36,7 +39,7 @@ class EnhancedBookmarkModelObserver; class EnhancedBookmarkModel : public KeyedService, public bookmarks::BaseBookmarkModelObserver { public: - EnhancedBookmarkModel(BookmarkModel* bookmark_model, + EnhancedBookmarkModel(bookmarks::BookmarkModel* bookmark_model, const std::string& version); ~EnhancedBookmarkModel() override; @@ -124,7 +127,7 @@ class EnhancedBookmarkModel : public KeyedService, // TODO(rfevang): Ideally nothing should need the underlying bookmark model. // Remove when that is actually the case. - BookmarkModel* bookmark_model() { return bookmark_model_; } + bookmarks::BookmarkModel* bookmark_model() { return bookmark_model_; } // Returns true if the enhanced bookmark model is done loading. bool loaded() { return loaded_; } @@ -140,22 +143,23 @@ class EnhancedBookmarkModel : public KeyedService, // bookmarks::BaseBookmarkModelObserver: void BookmarkModelChanged() override; - void BookmarkModelLoaded(BookmarkModel* model, bool ids_reassigned) override; - void BookmarkNodeAdded(BookmarkModel* model, + void BookmarkModelLoaded(bookmarks::BookmarkModel* model, + bool ids_reassigned) override; + void BookmarkNodeAdded(bookmarks::BookmarkModel* model, const BookmarkNode* parent, int index) override; - void BookmarkNodeRemoved(BookmarkModel* model, + void BookmarkNodeRemoved(bookmarks::BookmarkModel* model, const BookmarkNode* parent, int old_index, const BookmarkNode* node, const std::set<GURL>& removed_urls) override; - void BookmarkNodeChanged(BookmarkModel* model, + void BookmarkNodeChanged(bookmarks::BookmarkModel* model, const BookmarkNode* node) override; - void OnWillChangeBookmarkMetaInfo(BookmarkModel* model, + void OnWillChangeBookmarkMetaInfo(bookmarks::BookmarkModel* model, const BookmarkNode* node) override; - void BookmarkMetaInfoChanged(BookmarkModel* model, + void BookmarkMetaInfoChanged(bookmarks::BookmarkModel* model, const BookmarkNode* node) override; - void BookmarkAllUserNodesRemoved(BookmarkModel* model, + void BookmarkAllUserNodesRemoved(bookmarks::BookmarkModel* model, const std::set<GURL>& removed_urls) override; // Initialize the mapping from remote ids to nodes. @@ -190,7 +194,7 @@ class EnhancedBookmarkModel : public KeyedService, void SetMultipleMetaInfo(const BookmarkNode* node, BookmarkNode::MetaInfoMap meta_info); - BookmarkModel* bookmark_model_; + bookmarks::BookmarkModel* bookmark_model_; bool loaded_; ObserverList<EnhancedBookmarkModelObserver> observers_; diff --git a/components/enhanced_bookmarks/enhanced_bookmark_model_unittest.cc b/components/enhanced_bookmarks/enhanced_bookmark_model_unittest.cc index df55b8f..db2c54f 100644 --- a/components/enhanced_bookmarks/enhanced_bookmark_model_unittest.cc +++ b/components/enhanced_bookmarks/enhanced_bookmark_model_unittest.cc @@ -20,6 +20,7 @@ #include "testing/gtest/include/gtest/gtest.h" #include "url/gurl.h" +using bookmarks::BookmarkModel; using enhanced_bookmarks::EnhancedBookmarkModel; namespace { diff --git a/components/enhanced_bookmarks/enhanced_bookmark_utils.cc b/components/enhanced_bookmarks/enhanced_bookmark_utils.cc index cf93760..13622ae 100644 --- a/components/enhanced_bookmarks/enhanced_bookmark_utils.cc +++ b/components/enhanced_bookmarks/enhanced_bookmark_utils.cc @@ -7,6 +7,8 @@ #include "base/i18n/string_compare.h" #include "components/bookmarks/browser/bookmark_model.h" +using bookmarks::BookmarkModel; + namespace enhanced_bookmarks { // Comparator used to sort bookmarks. No folders are allowed. diff --git a/components/enhanced_bookmarks/enhanced_bookmark_utils.h b/components/enhanced_bookmarks/enhanced_bookmark_utils.h index 23d7004..413ef03 100644 --- a/components/enhanced_bookmarks/enhanced_bookmark_utils.h +++ b/components/enhanced_bookmarks/enhanced_bookmark_utils.h @@ -9,9 +9,12 @@ #include <string> #include <vector> -class BookmarkModel; class BookmarkNode; +namespace bookmarks { +class BookmarkModel; +} + namespace enhanced_bookmarks { // The vector is sorted in place. @@ -21,22 +24,25 @@ void SortBookmarksByName(std::vector<const BookmarkNode*>& nodes); // Returns the permanent nodes whose url children are considered uncategorized // and whose folder children should be shown in the bookmark menu. // |model| must be loaded. -std::vector<const BookmarkNode*> PrimaryPermanentNodes(BookmarkModel* model); +std::vector<const BookmarkNode*> PrimaryPermanentNodes( + bookmarks::BookmarkModel* model); // Returns an unsorted vector of folders that are considered to be at the "root" // level of the bookmark hierarchy. Functionally, this means all direct // descendants of PrimaryPermanentNodes, and possibly a node for the bookmarks // bar. -std::vector<const BookmarkNode*> RootLevelFolders(BookmarkModel* model); +std::vector<const BookmarkNode*> RootLevelFolders( + bookmarks::BookmarkModel* model); // Returns whether |node| is a primary permanent node in the sense of // |PrimaryPermanentNodes|. -bool IsPrimaryPermanentNode(const BookmarkNode* node, BookmarkModel* model); +bool IsPrimaryPermanentNode(const BookmarkNode* node, + bookmarks::BookmarkModel* model); // Returns the root level folder in which this node is directly, or indirectly // via subfolders, located. const BookmarkNode* RootLevelFolderForNode(const BookmarkNode* node, - BookmarkModel* model); + bookmarks::BookmarkModel* model); } // namespace enhanced_bookmarks diff --git a/components/enhanced_bookmarks/metadata_accessor.cc b/components/enhanced_bookmarks/metadata_accessor.cc index fc74885..d259832 100644 --- a/components/enhanced_bookmarks/metadata_accessor.cc +++ b/components/enhanced_bookmarks/metadata_accessor.cc @@ -13,6 +13,7 @@ #include "ui/base/models/tree_node_iterator.h" using namespace image::collections; +using bookmarks::BookmarkModel; namespace { diff --git a/components/enhanced_bookmarks/metadata_accessor.h b/components/enhanced_bookmarks/metadata_accessor.h index 313705b..884a0e7 100644 --- a/components/enhanced_bookmarks/metadata_accessor.h +++ b/components/enhanced_bookmarks/metadata_accessor.h @@ -9,10 +9,13 @@ #include <string> #include <vector> -class BookmarkModel; class BookmarkNode; class GURL; +namespace bookmarks { +class BookmarkModel; +} + // TODO(rfevang): Remove this file once the remaining caller // is converted (enhanced_bookmarks_bridge.cc) @@ -32,11 +35,11 @@ extern const char* kNoteKey; // Returns the remoteId for a bookmark. If the bookmark doesn't have one already // this function will create and set one. -std::string RemoteIdFromBookmark(BookmarkModel* bookmark_model, +std::string RemoteIdFromBookmark(bookmarks::BookmarkModel* bookmark_model, const BookmarkNode* node); // Sets the description of a bookmark. -void SetDescriptionForBookmark(BookmarkModel* bookmark_model, +void SetDescriptionForBookmark(bookmarks::BookmarkModel* bookmark_model, const BookmarkNode* node, const std::string& description); @@ -46,7 +49,7 @@ std::string DescriptionFromBookmark(const BookmarkNode* node); // Sets the URL of an image representative of the page. // Expects the URL to be valid and not empty. // Returns true if the metainfo is successfully populated. -bool SetOriginalImageForBookmark(BookmarkModel* bookmark_model, +bool SetOriginalImageForBookmark(bookmarks::BookmarkModel* bookmark_model, const BookmarkNode* node, const GURL& url, int width, @@ -74,7 +77,7 @@ std::string SnippetFromBookmark(const BookmarkNode* node); // remove existing entries for empty urls or set them if the url is not empty. // expects valid or empty urls. Returns true if the metainfo is successfully // populated. -bool SetAllImagesForBookmark(BookmarkModel* bookmark_model, +bool SetAllImagesForBookmark(bookmarks::BookmarkModel* bookmark_model, const BookmarkNode* node, const GURL& image_url, int image_width, |