| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_UI_WEBUI_LARGE_ICON_SOURCE_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_LARGE_ICON_SOURCE_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_LARGE_ICON_SOURCE_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_LARGE_ICON_SOURCE_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/task/cancelable_task_tracker.h" | 12 #include "base/task/cancelable_task_tracker.h" |
| 13 #include "components/favicon/core/fallback_icon_service.h" | |
| 14 #include "content/public/browser/url_data_source.h" | 13 #include "content/public/browser/url_data_source.h" |
| 15 | 14 |
| 16 namespace favicon { | 15 namespace favicon { |
| 17 class FallbackIconService; | |
| 18 class LargeIconService; | 16 class LargeIconService; |
| 19 } | 17 } |
| 20 | 18 |
| 21 namespace favicon_base { | 19 namespace favicon_base { |
| 22 struct LargeIconResult; | 20 struct LargeIconResult; |
| 23 } | 21 } |
| 24 | 22 |
| 25 // LargeIconSource services explicit chrome:// requests for large icons. | 23 // LargeIconSource services explicit chrome:// requests for large icons. |
| 26 // | 24 // |
| 27 // Format: | 25 // Format: |
| 28 // chrome://large-icon/size/url | 26 // chrome://large-icon/size/url |
| 29 // | 27 // |
| 30 // Parameter: | 28 // Parameter: |
| 31 // 'size' Required (including trailing '/') | 29 // 'size' Required (including trailing '/') |
| 32 // Positive integer to specify the large icon's size in pixels. | 30 // Positive integer to specify the large icon's size in pixels. |
| 33 // 'url' Optional | 31 // 'url' Optional |
| 34 // String to specify the page URL of the large icon. | 32 // String to specify the page URL of the large icon. |
| 35 // | 33 // |
| 36 // Example: chrome://large-icon/48/http://www.google.com/ | 34 // Example: chrome://large-icon/48/http://www.google.com/ |
| 37 // This requests a 48x48 large icon for http://www.google.com. | 35 // This requests a 48x48 large icon for http://www.google.com. |
| 38 class LargeIconSource : public content::URLDataSource { | 36 class LargeIconSource : public content::URLDataSource { |
| 39 public: | 37 public: |
| 40 // |fallback_icon_service| and |large_icon_service| are owned by caller and | 38 // |large_icon_service| is owned by caller and may be null. |
| 41 // may be null. | 39 explicit LargeIconSource(favicon::LargeIconService* large_icon_service); |
| 42 LargeIconSource(favicon::FallbackIconService* fallback_icon_service, | |
| 43 favicon::LargeIconService* large_icon_service); | |
| 44 | 40 |
| 45 ~LargeIconSource() override; | 41 ~LargeIconSource() override; |
| 46 | 42 |
| 47 // content::URLDataSource implementation. | 43 // content::URLDataSource implementation. |
| 48 std::string GetSource() const override; | 44 std::string GetSource() const override; |
| 49 void StartDataRequest( | 45 void StartDataRequest( |
| 50 const std::string& path, | 46 const std::string& path, |
| 51 const content::ResourceRequestInfo::WebContentsGetter& wc_getter, | 47 const content::ResourceRequestInfo::WebContentsGetter& wc_getter, |
| 52 const content::URLDataSource::GotDataCallback& callback) override; | 48 const content::URLDataSource::GotDataCallback& callback) override; |
| 53 std::string GetMimeType(const std::string&) const override; | 49 std::string GetMimeType(const std::string&) const override; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 65 int size, | 61 int size, |
| 66 const favicon_base::LargeIconResult& bitmap_result); | 62 const favicon_base::LargeIconResult& bitmap_result); |
| 67 | 63 |
| 68 // Returns null to trigger "Not Found" response. | 64 // Returns null to trigger "Not Found" response. |
| 69 void SendNotFoundResponse( | 65 void SendNotFoundResponse( |
| 70 const content::URLDataSource::GotDataCallback& callback); | 66 const content::URLDataSource::GotDataCallback& callback); |
| 71 | 67 |
| 72 base::CancelableTaskTracker cancelable_task_tracker_; | 68 base::CancelableTaskTracker cancelable_task_tracker_; |
| 73 | 69 |
| 74 // Owned by client. | 70 // Owned by client. |
| 75 favicon::FallbackIconService* fallback_icon_service_; | |
| 76 | |
| 77 // Owned by client. | |
| 78 favicon::LargeIconService* large_icon_service_; | 71 favicon::LargeIconService* large_icon_service_; |
| 79 | 72 |
| 80 DISALLOW_COPY_AND_ASSIGN(LargeIconSource); | 73 DISALLOW_COPY_AND_ASSIGN(LargeIconSource); |
| 81 }; | 74 }; |
| 82 | 75 |
| 83 #endif // CHROME_BROWSER_UI_WEBUI_LARGE_ICON_SOURCE_H_ | 76 #endif // CHROME_BROWSER_UI_WEBUI_LARGE_ICON_SOURCE_H_ |
| OLD | NEW |