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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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; |
| 134 favicon.variants.resize(1); // XXX |
134 favicon.known_icon = icon_data.get() != NULL && icon_data->size() > 0; | 135 favicon.known_icon = icon_data.get() != NULL && icon_data->size() > 0; |
135 favicon.bitmap_data = icon_data; | 136 favicon.variants[0].bitmap_data = icon_data; |
136 favicon.icon_type = history::FAVICON; | 137 favicon.icon_type = history::FAVICON; |
137 request_->ForwardResultAsync(request_->handle(), favicon); | 138 request_->ForwardResultAsync(request_->handle(), favicon); |
138 delete this; | 139 delete this; |
139 } | 140 } |
140 | 141 |
141 ImageLoadingTracker tracker_; | 142 ImageLoadingTracker tracker_; |
142 scoped_refptr<FaviconService::GetFaviconRequest> request_; | 143 scoped_refptr<FaviconService::GetFaviconRequest> request_; |
143 const Extension* extension_; | 144 const Extension* extension_; |
144 | 145 |
145 DISALLOW_COPY_AND_ASSIGN(ExtensionWebUIImageLoadingTracker); | 146 DISALLOW_COPY_AND_ASSIGN(ExtensionWebUIImageLoadingTracker); |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 } | 421 } |
421 | 422 |
422 // static | 423 // static |
423 void ExtensionWebUI::GetFaviconForURL(Profile* profile, | 424 void ExtensionWebUI::GetFaviconForURL(Profile* profile, |
424 FaviconService::GetFaviconRequest* request, const GURL& page_url) { | 425 FaviconService::GetFaviconRequest* request, const GURL& page_url) { |
425 // tracker deletes itself when done. | 426 // tracker deletes itself when done. |
426 ExtensionWebUIImageLoadingTracker* tracker = | 427 ExtensionWebUIImageLoadingTracker* tracker = |
427 new ExtensionWebUIImageLoadingTracker(profile, request, page_url); | 428 new ExtensionWebUIImageLoadingTracker(profile, request, page_url); |
428 tracker->Init(); | 429 tracker->Init(); |
429 } | 430 } |
OLD | NEW |