Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(388)

Unified Diff: components/enhanced_bookmarks/bookmark_image_service.cc

Issue 476573004: Set version field when changes are made to enhanced bookmarks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/enhanced_bookmarks/bookmark_image_service.cc
diff --git a/components/enhanced_bookmarks/bookmark_image_service.cc b/components/enhanced_bookmarks/bookmark_image_service.cc
index 5f515a9fbfd56e46d30323b27fd49f2dfd317b91..e481bce8c0873c2ee4f03ec044df4ba4611bba3f 100644
--- a/components/enhanced_bookmarks/bookmark_image_service.cc
+++ b/components/enhanced_bookmarks/bookmark_image_service.cc
@@ -8,8 +8,8 @@
#include "base/threading/sequenced_worker_pool.h"
#include "components/bookmarks/browser/bookmark_model.h"
#include "components/bookmarks/browser/bookmark_model_observer.h"
+#include "components/enhanced_bookmarks/enhanced_bookmark_model.h"
#include "components/enhanced_bookmarks/enhanced_bookmark_utils.h"
-#include "components/enhanced_bookmarks/metadata_accessor.h"
#include "components/enhanced_bookmarks/persistent_image_store.h"
namespace {
@@ -42,18 +42,20 @@ void RetrieveImageFromStoreRelay(
namespace enhanced_bookmarks {
BookmarkImageService::BookmarkImageService(
scoped_ptr<ImageStore> store,
- BookmarkModel* bookmark_model,
+ EnhancedBookmarkModel* enhanced_bookmark_model,
scoped_refptr<base::SequencedWorkerPool> pool)
- : bookmark_model_(bookmark_model), store_(store.Pass()), pool_(pool) {
+ : enhanced_bookmark_model_(enhanced_bookmark_model),
+ store_(store.Pass()),
+ pool_(pool) {
DCHECK(CalledOnValidThread());
- bookmark_model_->AddObserver(this);
+ enhanced_bookmark_model_->bookmark_model()->AddObserver(this);
}
BookmarkImageService::BookmarkImageService(
const base::FilePath& path,
- BookmarkModel* bookmark_model,
+ EnhancedBookmarkModel* enhanced_bookmark_model,
scoped_refptr<base::SequencedWorkerPool> pool)
- : bookmark_model_(bookmark_model), pool_(pool) {
+ : enhanced_bookmark_model_(enhanced_bookmark_model), pool_(pool) {
DCHECK(CalledOnValidThread());
// PersistentImageStore has to be constructed in the thread it will be used,
// so we are posting the construction to the thread. However, we first
@@ -81,7 +83,7 @@ BookmarkImageService::BookmarkImageService(
BookmarkImageService::~BookmarkImageService() {
DCHECK(CalledOnValidThread());
- bookmark_model_->RemoveObserver(this);
+ enhanced_bookmark_model_->bookmark_model()->RemoveObserver(this);
pool_->PostNamedSequencedWorkerTask(
kSequenceToken,
FROM_HERE,
@@ -118,12 +120,13 @@ void BookmarkImageService::RetrieveSalientImageForPageUrl(
in_progress_page_urls_.insert(page_url);
const BookmarkNode* bookmark =
- bookmark_model_->GetMostRecentlyAddedUserNodeForURL(page_url);
+ enhanced_bookmark_model_->bookmark_model()
+ ->GetMostRecentlyAddedUserNodeForURL(page_url);
GURL image_url;
if (bookmark) {
int width;
int height;
- enhanced_bookmarks::ThumbnailImageFromBookmark(
+ enhanced_bookmark_model_->GetThumbnailImage(
bookmark, &image_url, &width, &height);
}
@@ -188,11 +191,12 @@ void BookmarkImageService::ProcessNewImage(const GURL& page_url,
ProcessRequests(page_url, image, image_url);
if (update_bookmarks && image_url.is_valid()) {
const BookmarkNode* bookmark =
- bookmark_model_->GetMostRecentlyAddedUserNodeForURL(page_url);
+ enhanced_bookmark_model_->bookmark_model()
+ ->GetMostRecentlyAddedUserNodeForURL(page_url);
if (bookmark) {
const gfx::Size& size = image.Size();
- bool result = enhanced_bookmarks::SetOriginalImageForBookmark(
- bookmark_model_, bookmark, image_url, size.width(), size.height());
+ bool result = enhanced_bookmark_model_->SetOriginalImage(
+ bookmark, image_url, size.width(), size.height());
DCHECK(result);
}
}
« no previous file with comments | « components/enhanced_bookmarks/bookmark_image_service.h ('k') | components/enhanced_bookmarks/enhanced_bookmark_model.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698