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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 ForwardResult(NULL); | 102 ForwardResult(NULL); |
103 } | 103 } |
104 } | 104 } |
105 | 105 |
106 private: | 106 private: |
107 ~ExtensionWebUIImageLoadingTracker() {} | 107 ~ExtensionWebUIImageLoadingTracker() {} |
108 | 108 |
109 // Forwards the result on the request. If no favicon was available then | 109 // Forwards the result on the request. If no favicon was available then |
110 // |icon_data| may be backed by NULL. Once the result has been forwarded the | 110 // |icon_data| may be backed by NULL. Once the result has been forwarded the |
111 // instance is deleted. | 111 // instance is deleted. |
112 void ForwardResult(scoped_refptr<RefCountedMemory> icon_data) { | 112 void ForwardResult(scoped_refptr<base::RefCountedMemory> icon_data) { |
113 history::FaviconData favicon; | 113 history::FaviconData favicon; |
114 favicon.known_icon = icon_data.get() != NULL && icon_data->size() > 0; | 114 favicon.known_icon = icon_data.get() != NULL && icon_data->size() > 0; |
115 favicon.image_data = icon_data; | 115 favicon.image_data = icon_data; |
116 favicon.icon_type = history::FAVICON; | 116 favicon.icon_type = history::FAVICON; |
117 request_->ForwardResultAsync(request_->handle(), favicon); | 117 request_->ForwardResultAsync(request_->handle(), favicon); |
118 delete this; | 118 delete this; |
119 } | 119 } |
120 | 120 |
121 ImageLoadingTracker tracker_; | 121 ImageLoadingTracker tracker_; |
122 scoped_refptr<FaviconService::GetFaviconRequest> request_; | 122 scoped_refptr<FaviconService::GetFaviconRequest> request_; |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 } | 415 } |
416 | 416 |
417 // static | 417 // static |
418 void ExtensionWebUI::GetFaviconForURL(Profile* profile, | 418 void ExtensionWebUI::GetFaviconForURL(Profile* profile, |
419 FaviconService::GetFaviconRequest* request, const GURL& page_url) { | 419 FaviconService::GetFaviconRequest* request, const GURL& page_url) { |
420 // tracker deletes itself when done. | 420 // tracker deletes itself when done. |
421 ExtensionWebUIImageLoadingTracker* tracker = | 421 ExtensionWebUIImageLoadingTracker* tracker = |
422 new ExtensionWebUIImageLoadingTracker(profile, request, page_url); | 422 new ExtensionWebUIImageLoadingTracker(profile, request, page_url); |
423 tracker->Init(); | 423 tracker->Init(); |
424 } | 424 } |
OLD | NEW |