OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_FAVICON_SOURCE_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_FAVICON_SOURCE_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_FAVICON_SOURCE_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_FAVICON_SOURCE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 | 98 |
99 // Called when the favicon data is missing to perform additional checks to | 99 // Called when the favicon data is missing to perform additional checks to |
100 // locate the resource. | 100 // locate the resource. |
101 // |request| contains information for the failed request. | 101 // |request| contains information for the failed request. |
102 // Returns true if the missing resource is found. | 102 // Returns true if the missing resource is found. |
103 virtual bool HandleMissingResource(const IconRequest& request); | 103 virtual bool HandleMissingResource(const IconRequest& request); |
104 | 104 |
105 Profile* profile_; | 105 Profile* profile_; |
106 | 106 |
107 private: | 107 private: |
108 // Defines the allowed pixel sizes for requested favicons. | |
109 enum IconSize { | |
110 SIZE_16, | |
111 SIZE_32, | |
112 SIZE_64, | |
113 NUM_SIZES | |
114 }; | |
115 | |
116 // Called when favicon data is available from the history backend. | 108 // Called when favicon data is available from the history backend. |
117 void OnFaviconDataAvailable( | 109 void OnFaviconDataAvailable( |
118 const IconRequest& request, | 110 const IconRequest& request, |
119 const favicon_base::FaviconRawBitmapResult& bitmap_result); | 111 const favicon_base::FaviconRawBitmapResult& bitmap_result); |
120 | 112 |
121 // Sends the 16x16 DIP 1x default favicon. | 113 // Sends the 16x16 DIP 1x default favicon. |
122 void SendDefaultResponse( | 114 void SendDefaultResponse( |
123 const content::URLDataSource::GotDataCallback& callback); | 115 const content::URLDataSource::GotDataCallback& callback); |
124 | 116 |
125 // Sends the default favicon. | 117 // Sends the default favicon. |
126 void SendDefaultResponse(const IconRequest& request); | 118 void SendDefaultResponse(const IconRequest& request); |
127 | 119 |
128 base::CancelableTaskTracker cancelable_task_tracker_; | 120 base::CancelableTaskTracker cancelable_task_tracker_; |
129 | 121 |
130 // Raw PNG representations of favicons of each size to show when the favicon | |
131 // database doesn't have a favicon for a webpage. Indexed by IconSize values. | |
132 scoped_refptr<base::RefCountedMemory> default_favicons_[NUM_SIZES]; | |
133 | |
134 // The favicon_base::IconTypes of icon that this FaviconSource handles. | 122 // The favicon_base::IconTypes of icon that this FaviconSource handles. |
135 int icon_types_; | 123 int icon_types_; |
136 | 124 |
137 DISALLOW_COPY_AND_ASSIGN(FaviconSource); | 125 DISALLOW_COPY_AND_ASSIGN(FaviconSource); |
138 }; | 126 }; |
139 | 127 |
140 #endif // CHROME_BROWSER_UI_WEBUI_FAVICON_SOURCE_H_ | 128 #endif // CHROME_BROWSER_UI_WEBUI_FAVICON_SOURCE_H_ |
OLD | NEW |