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