OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "net/base/file_stream.h" | 10 #include "net/base/file_stream.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 } | 96 } |
97 } | 97 } |
98 | 98 |
99 private: | 99 private: |
100 ~ExtensionWebUIImageLoadingTracker() {} | 100 ~ExtensionWebUIImageLoadingTracker() {} |
101 | 101 |
102 // Forwards the result on the request. If no favicon was available then | 102 // Forwards the result on the request. If no favicon was available then |
103 // |icon_data| may be backed by NULL. Once the result has been forwarded the | 103 // |icon_data| may be backed by NULL. Once the result has been forwarded the |
104 // instance is deleted. | 104 // instance is deleted. |
105 void ForwardResult(scoped_refptr<RefCountedMemory> icon_data) { | 105 void ForwardResult(scoped_refptr<RefCountedMemory> icon_data) { |
106 bool know_icon = icon_data.get() != NULL && icon_data->size() > 0; | 106 history::FaviconData favicon; |
| 107 favicon.known_icon = icon_data.get() != NULL && icon_data->size() > 0; |
| 108 favicon.image_data = icon_data; |
| 109 favicon.icon_type = history::FAVICON; |
107 request_->ForwardResultAsync( | 110 request_->ForwardResultAsync( |
108 FaviconService::FaviconDataCallback::TupleType(request_->handle(), | 111 FaviconService::FaviconDataCallback::TupleType(request_->handle(), |
109 know_icon, icon_data, false, GURL())); | 112 favicon)); |
110 delete this; | 113 delete this; |
111 } | 114 } |
112 | 115 |
113 ImageLoadingTracker tracker_; | 116 ImageLoadingTracker tracker_; |
114 scoped_refptr<FaviconService::GetFaviconRequest> request_; | 117 scoped_refptr<FaviconService::GetFaviconRequest> request_; |
115 const Extension* extension_; | 118 const Extension* extension_; |
116 | 119 |
117 DISALLOW_COPY_AND_ASSIGN(ExtensionWebUIImageLoadingTracker); | 120 DISALLOW_COPY_AND_ASSIGN(ExtensionWebUIImageLoadingTracker); |
118 }; | 121 }; |
119 | 122 |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 } | 404 } |
402 | 405 |
403 // static | 406 // static |
404 void ExtensionWebUI::GetFaviconForURL(Profile* profile, | 407 void ExtensionWebUI::GetFaviconForURL(Profile* profile, |
405 FaviconService::GetFaviconRequest* request, const GURL& page_url) { | 408 FaviconService::GetFaviconRequest* request, const GURL& page_url) { |
406 // tracker deletes itself when done. | 409 // tracker deletes itself when done. |
407 ExtensionWebUIImageLoadingTracker* tracker = | 410 ExtensionWebUIImageLoadingTracker* tracker = |
408 new ExtensionWebUIImageLoadingTracker(profile, request, page_url); | 411 new ExtensionWebUIImageLoadingTracker(profile, request, page_url); |
409 tracker->Init(); | 412 tracker->Init(); |
410 } | 413 } |
OLD | NEW |