| 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 #ifndef CHROME_BROWSER_ENHANCED_BOOKMARKS_ANDROID_BOOKMARK_IMAGE_SERVICE_ANDROID
_H_ | 5 #ifndef CHROME_BROWSER_ENHANCED_BOOKMARKS_ANDROID_BOOKMARK_IMAGE_SERVICE_ANDROID
_H_ |
| 6 #define CHROME_BROWSER_ENHANCED_BOOKMARKS_ANDROID_BOOKMARK_IMAGE_SERVICE_ANDROID
_H_ | 6 #define CHROME_BROWSER_ENHANCED_BOOKMARKS_ANDROID_BOOKMARK_IMAGE_SERVICE_ANDROID
_H_ |
| 7 | 7 |
| 8 #include "components/enhanced_bookmarks/bookmark_image_service.h" | 8 #include "components/enhanced_bookmarks/bookmark_image_service.h" |
| 9 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher.h" | 9 #include "chrome/browser/bitmap_fetcher/bitmap_batch_fetcher.h" |
| 10 | 10 |
| 11 namespace chrome { | 11 namespace chrome { |
| 12 class BitmapFetcher; | 12 class BitmapFetcher; |
| 13 } | 13 } |
| 14 | 14 |
| 15 namespace content { | 15 namespace content { |
| 16 class BrowserContext; | 16 class BrowserContext; |
| 17 class RenderFrameHost; | 17 class RenderFrameHost; |
| 18 class WebContents; | 18 class WebContents; |
| 19 } | 19 } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 45 | 45 |
| 46 private: | 46 private: |
| 47 void RetrieveSalientImageFromContextCallback(const GURL& page_url, | 47 void RetrieveSalientImageFromContextCallback(const GURL& page_url, |
| 48 bool update_bookmark, | 48 bool update_bookmark, |
| 49 const base::Value* result); | 49 const base::Value* result); |
| 50 | 50 |
| 51 content::BrowserContext* browser_context_; | 51 content::BrowserContext* browser_context_; |
| 52 // The script injected in a page to extract image urls. | 52 // The script injected in a page to extract image urls. |
| 53 base::string16 script_; | 53 base::string16 script_; |
| 54 | 54 |
| 55 chrome::BitmapBatchFetcher bitmap_batch_fetcher_; |
| 56 |
| 55 class BitmapFetcherHandler : private chrome::BitmapFetcherDelegate { | 57 class BitmapFetcherHandler : private chrome::BitmapFetcherDelegate { |
| 56 public: | 58 public: |
| 57 explicit BitmapFetcherHandler(BookmarkImageServiceAndroid* service, | 59 explicit BitmapFetcherHandler(BookmarkImageServiceAndroid* service) |
| 58 const GURL& image_url) | 60 : service_(service) {} |
| 59 : service_(service), bitmap_fetcher_(image_url, this) {} | |
| 60 void Start(content::BrowserContext* browser_context, | 61 void Start(content::BrowserContext* browser_context, |
| 61 const std::string& referrer, | 62 const std::string& referrer, |
| 62 net::URLRequest::ReferrerPolicy referrer_policy, | 63 net::URLRequest::ReferrerPolicy referrer_policy, |
| 63 int load_flags, | 64 int load_flags, |
| 64 bool update_bookmark, | 65 bool update_bookmark, |
| 65 const GURL& page_url); | 66 const GURL& page_url, |
| 67 chrome::BitmapBatchFetcher& bitmap_batch_fetcher, |
| 68 const GURL& image_url); |
| 66 void OnFetchComplete(const GURL url, const SkBitmap* bitmap) override; | 69 void OnFetchComplete(const GURL url, const SkBitmap* bitmap) override; |
| 67 | 70 |
| 68 protected: | 71 protected: |
| 69 ~BitmapFetcherHandler() override {} | 72 ~BitmapFetcherHandler() override {} |
| 70 | 73 |
| 71 private: | 74 private: |
| 72 BookmarkImageServiceAndroid* service_; | 75 BookmarkImageServiceAndroid* service_; |
| 73 chrome::BitmapFetcher bitmap_fetcher_; | |
| 74 bool update_bookmark_; | 76 bool update_bookmark_; |
| 75 GURL page_url_; | 77 GURL page_url_; |
| 76 | 78 |
| 77 DISALLOW_COPY_AND_ASSIGN(BitmapFetcherHandler); | 79 DISALLOW_COPY_AND_ASSIGN(BitmapFetcherHandler); |
| 78 }; | 80 }; |
| 79 | 81 |
| 80 DISALLOW_COPY_AND_ASSIGN(BookmarkImageServiceAndroid); | 82 DISALLOW_COPY_AND_ASSIGN(BookmarkImageServiceAndroid); |
| 81 }; | 83 }; |
| 82 | 84 |
| 83 } // namespace enhanced_bookmarks | 85 } // namespace enhanced_bookmarks |
| 84 | 86 |
| 85 #endif // CHROME_BROWSER_ENHANCED_BOOKMARKS_ANDROID_BOOKMARK_IMAGE_SERVICE_ANDR
OID_H_ | 87 #endif // CHROME_BROWSER_ENHANCED_BOOKMARKS_ANDROID_BOOKMARK_IMAGE_SERVICE_ANDR
OID_H_ |
| OLD | NEW |