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 #include "chrome/browser/extensions/extension_web_ui.h" | 5 #include "chrome/browser/extensions/extension_web_ui.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 } | 123 } |
124 } | 124 } |
125 | 125 |
126 private: | 126 private: |
127 ~ExtensionWebUIImageLoadingTracker() {} | 127 ~ExtensionWebUIImageLoadingTracker() {} |
128 | 128 |
129 // Forwards the result on the request. If no favicon was available then | 129 // Forwards the result on the request. If no favicon was available then |
130 // |icon_data| may be backed by NULL. Once the result has been forwarded the | 130 // |icon_data| may be backed by NULL. Once the result has been forwarded the |
131 // instance is deleted. | 131 // instance is deleted. |
132 void ForwardResult(scoped_refptr<base::RefCountedMemory> icon_data) { | 132 void ForwardResult(scoped_refptr<base::RefCountedMemory> icon_data) { |
133 history::FaviconData favicon; | 133 history::FaviconData favicon_data; |
134 favicon.known_icon = icon_data.get() != NULL && icon_data->size() > 0; | 134 favicon_data.known_icon = icon_data.get() != NULL && icon_data->size() > 0; |
135 favicon.image_data = icon_data; | 135 favicon_data.icon_type = history::FAVICON; |
136 favicon.icon_type = history::FAVICON; | 136 history::FaviconDataElement element; |
137 request_->ForwardResultAsync(request_->handle(), favicon); | 137 element.bitmap_data = icon_data; |
| 138 favicon_data.elements.push_back(element); |
| 139 request_->ForwardResultAsync(request_->handle(), favicon_data); |
138 delete this; | 140 delete this; |
139 } | 141 } |
140 | 142 |
141 ImageLoadingTracker tracker_; | 143 ImageLoadingTracker tracker_; |
142 scoped_refptr<FaviconService::GetFaviconRequest> request_; | 144 scoped_refptr<FaviconService::GetFaviconRequest> request_; |
143 const Extension* extension_; | 145 const Extension* extension_; |
144 | 146 |
145 DISALLOW_COPY_AND_ASSIGN(ExtensionWebUIImageLoadingTracker); | 147 DISALLOW_COPY_AND_ASSIGN(ExtensionWebUIImageLoadingTracker); |
146 }; | 148 }; |
147 | 149 |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 } | 423 } |
422 | 424 |
423 // static | 425 // static |
424 void ExtensionWebUI::GetFaviconForURL(Profile* profile, | 426 void ExtensionWebUI::GetFaviconForURL(Profile* profile, |
425 FaviconService::GetFaviconRequest* request, const GURL& page_url) { | 427 FaviconService::GetFaviconRequest* request, const GURL& page_url) { |
426 // tracker deletes itself when done. | 428 // tracker deletes itself when done. |
427 ExtensionWebUIImageLoadingTracker* tracker = | 429 ExtensionWebUIImageLoadingTracker* tracker = |
428 new ExtensionWebUIImageLoadingTracker(profile, request, page_url); | 430 new ExtensionWebUIImageLoadingTracker(profile, request, page_url); |
429 tracker->Init(); | 431 tracker->Init(); |
430 } | 432 } |
OLD | NEW |