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 "content/browser/webui/web_ui_factory.h" | 5 #include "content/browser/webui/web_ui_factory.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "chrome/browser/about_flags.h" | 8 #include "chrome/browser/about_flags.h" |
9 #include "chrome/browser/extensions/extension_service.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
10 #include "chrome/browser/extensions/extension_web_ui.h" | 10 #include "chrome/browser/extensions/extension_web_ui.h" |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 // static | 283 // static |
284 void WebUIFactory::GetFaviconForURL(Profile* profile, | 284 void WebUIFactory::GetFaviconForURL(Profile* profile, |
285 FaviconService::GetFaviconRequest* request, | 285 FaviconService::GetFaviconRequest* request, |
286 const GURL& page_url) { | 286 const GURL& page_url) { |
287 // All extensions but the bookmark manager get their favicon from the icons | 287 // All extensions but the bookmark manager get their favicon from the icons |
288 // part of the manifest. | 288 // part of the manifest. |
289 if (page_url.SchemeIs(chrome::kExtensionScheme) && | 289 if (page_url.SchemeIs(chrome::kExtensionScheme) && |
290 page_url.host() != extension_misc::kBookmarkManagerId) { | 290 page_url.host() != extension_misc::kBookmarkManagerId) { |
291 ExtensionWebUI::GetFaviconForURL(profile, request, page_url); | 291 ExtensionWebUI::GetFaviconForURL(profile, request, page_url); |
292 } else { | 292 } else { |
293 scoped_refptr<RefCountedMemory> icon_data( | 293 history::FaviconData favicon; |
| 294 favicon.image_data = scoped_refptr<RefCountedMemory>( |
294 WebUIFactory::GetFaviconResourceBytes(profile, page_url)); | 295 WebUIFactory::GetFaviconResourceBytes(profile, page_url)); |
295 bool know_icon = icon_data.get() != NULL && icon_data->size() > 0; | 296 favicon.known_icon = favicon.image_data.get() != NULL && |
| 297 favicon.image_data->size() > 0; |
296 request->ForwardResultAsync( | 298 request->ForwardResultAsync( |
297 FaviconService::FaviconDataCallback::TupleType(request->handle(), | 299 FaviconService::FaviconDataCallback::TupleType(request->handle(), |
298 know_icon, icon_data, false, GURL())); | 300 favicon)); |
299 } | 301 } |
300 } | 302 } |
301 | 303 |
302 // static | 304 // static |
303 RefCountedMemory* WebUIFactory::GetFaviconResourceBytes(Profile* profile, | 305 RefCountedMemory* WebUIFactory::GetFaviconResourceBytes(Profile* profile, |
304 const GURL& page_url) { | 306 const GURL& page_url) { |
305 // The bookmark manager is a chrome extension, so we have to check for it | 307 // The bookmark manager is a chrome extension, so we have to check for it |
306 // before we check for extension scheme. | 308 // before we check for extension scheme. |
307 if (page_url.host() == extension_misc::kBookmarkManagerId) | 309 if (page_url.host() == extension_misc::kBookmarkManagerId) |
308 return BookmarksUI::GetFaviconResourceBytes(); | 310 return BookmarksUI::GetFaviconResourceBytes(); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 if (page_url.host() == chrome::kChromeUIPluginsHost) | 347 if (page_url.host() == chrome::kChromeUIPluginsHost) |
346 return PluginsUI::GetFaviconResourceBytes(); | 348 return PluginsUI::GetFaviconResourceBytes(); |
347 | 349 |
348 #if defined(ENABLE_REMOTING) | 350 #if defined(ENABLE_REMOTING) |
349 if (page_url.host() == chrome::kChromeUIRemotingHost) | 351 if (page_url.host() == chrome::kChromeUIRemotingHost) |
350 return RemotingUI::GetFaviconResourceBytes(); | 352 return RemotingUI::GetFaviconResourceBytes(); |
351 #endif | 353 #endif |
352 | 354 |
353 return NULL; | 355 return NULL; |
354 } | 356 } |
OLD | NEW |