| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "components/enhanced_bookmarks/bookmark_image_service.h" | 5 #include "components/enhanced_bookmarks/bookmark_image_service.h" |
| 6 | 6 |
| 7 #include "base/single_thread_task_runner.h" | 7 #include "base/single_thread_task_runner.h" |
| 8 #include "base/task_runner_util.h" | 8 #include "base/task_runner_util.h" |
| 9 #include "base/thread_task_runner_handle.h" | 9 #include "base/thread_task_runner_handle.h" |
| 10 #include "base/threading/sequenced_worker_pool.h" | 10 #include "base/threading/sequenced_worker_pool.h" |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 RetrieveImageFromStore(page_url, | 183 RetrieveImageFromStore(page_url, |
| 184 base::Bind(&BookmarkImageService::FetchCallback, | 184 base::Bind(&BookmarkImageService::FetchCallback, |
| 185 base::Unretained(this), | 185 base::Unretained(this), |
| 186 page_url, | 186 page_url, |
| 187 callback)); | 187 callback)); |
| 188 } | 188 } |
| 189 } | 189 } |
| 190 | 190 |
| 191 void BookmarkImageService::ProcessNewImage(const GURL& page_url, | 191 void BookmarkImageService::ProcessNewImage(const GURL& page_url, |
| 192 bool update_bookmarks, | 192 bool update_bookmarks, |
| 193 const gfx::Image& image, | 193 const GURL& image_url, |
| 194 const GURL& image_url) { | 194 const gfx::Image& image) { |
| 195 DCHECK(CalledOnValidThread()); | 195 DCHECK(CalledOnValidThread()); |
| 196 PostTaskToStoreImage(image, image_url, page_url); | 196 PostTaskToStoreImage(image, image_url, page_url); |
| 197 if (update_bookmarks && image_url.is_valid()) { | 197 if (update_bookmarks && image_url.is_valid()) { |
| 198 const BookmarkNode* bookmark = | 198 const BookmarkNode* bookmark = |
| 199 enhanced_bookmark_model_->bookmark_model() | 199 enhanced_bookmark_model_->bookmark_model() |
| 200 ->GetMostRecentlyAddedUserNodeForURL(page_url); | 200 ->GetMostRecentlyAddedUserNodeForURL(page_url); |
| 201 if (bookmark) { | 201 if (bookmark) { |
| 202 const gfx::Size& size = image.Size(); | 202 const gfx::Size& size = image.Size(); |
| 203 bool result = enhanced_bookmark_model_->SetOriginalImage( | 203 bool result = enhanced_bookmark_model_->SetOriginalImage( |
| 204 bookmark, image_url, size.width(), size.height()); | 204 bookmark, image_url, size.width(), size.height()); |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 const BookmarkNode* node) { | 359 const BookmarkNode* node) { |
| 360 } | 360 } |
| 361 | 361 |
| 362 void BookmarkImageService::BookmarkAllUserNodesRemoved( | 362 void BookmarkImageService::BookmarkAllUserNodesRemoved( |
| 363 BookmarkModel* model, | 363 BookmarkModel* model, |
| 364 const std::set<GURL>& removed_urls) { | 364 const std::set<GURL>& removed_urls) { |
| 365 ClearAll(); | 365 ClearAll(); |
| 366 } | 366 } |
| 367 | 367 |
| 368 } // namespace enhanced_bookmarks | 368 } // namespace enhanced_bookmarks |
| OLD | NEW |