| 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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 // static | 277 // static |
| 278 void WebUIFactory::GetFaviconForURL(Profile* profile, | 278 void WebUIFactory::GetFaviconForURL(Profile* profile, |
| 279 FaviconService::GetFaviconRequest* request, | 279 FaviconService::GetFaviconRequest* request, |
| 280 const GURL& page_url) { | 280 const GURL& page_url) { |
| 281 // All extensions but the bookmark manager get their favicon from the icons | 281 // All extensions but the bookmark manager get their favicon from the icons |
| 282 // part of the manifest. | 282 // part of the manifest. |
| 283 if (page_url.SchemeIs(chrome::kExtensionScheme) && | 283 if (page_url.SchemeIs(chrome::kExtensionScheme) && |
| 284 page_url.host() != extension_misc::kBookmarkManagerId) { | 284 page_url.host() != extension_misc::kBookmarkManagerId) { |
| 285 ExtensionWebUI::GetFaviconForURL(profile, request, page_url); | 285 ExtensionWebUI::GetFaviconForURL(profile, request, page_url); |
| 286 } else { | 286 } else { |
| 287 scoped_refptr<RefCountedMemory> icon_data( | 287 history::FaviconData favicon; |
| 288 favicon.image_data = scoped_refptr<RefCountedMemory>( |
| 288 WebUIFactory::GetFaviconResourceBytes(profile, page_url)); | 289 WebUIFactory::GetFaviconResourceBytes(profile, page_url)); |
| 289 bool know_icon = icon_data.get() != NULL && icon_data->size() > 0; | 290 favicon.known_icon = favicon.image_data.get() != NULL && |
| 291 favicon.image_data->size() > 0; |
| 290 request->ForwardResultAsync( | 292 request->ForwardResultAsync( |
| 291 FaviconService::FaviconDataCallback::TupleType(request->handle(), | 293 FaviconService::FaviconDataCallback::TupleType(request->handle(), |
| 292 know_icon, icon_data, false, GURL())); | 294 favicon)); |
| 293 } | 295 } |
| 294 } | 296 } |
| 295 | 297 |
| 296 // static | 298 // static |
| 297 RefCountedMemory* WebUIFactory::GetFaviconResourceBytes(Profile* profile, | 299 RefCountedMemory* WebUIFactory::GetFaviconResourceBytes(Profile* profile, |
| 298 const GURL& page_url) { | 300 const GURL& page_url) { |
| 299 // The bookmark manager is a chrome extension, so we have to check for it | 301 // The bookmark manager is a chrome extension, so we have to check for it |
| 300 // before we check for extension scheme. | 302 // before we check for extension scheme. |
| 301 if (page_url.host() == extension_misc::kBookmarkManagerId) | 303 if (page_url.host() == extension_misc::kBookmarkManagerId) |
| 302 return BookmarksUI::GetFaviconResourceBytes(); | 304 return BookmarksUI::GetFaviconResourceBytes(); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 if (page_url.host() == chrome::kChromeUIPluginsHost) | 341 if (page_url.host() == chrome::kChromeUIPluginsHost) |
| 340 return PluginsUI::GetFaviconResourceBytes(); | 342 return PluginsUI::GetFaviconResourceBytes(); |
| 341 | 343 |
| 342 #if defined(ENABLE_REMOTING) | 344 #if defined(ENABLE_REMOTING) |
| 343 if (page_url.host() == chrome::kChromeUIRemotingHost) | 345 if (page_url.host() == chrome::kChromeUIRemotingHost) |
| 344 return RemotingUI::GetFaviconResourceBytes(); | 346 return RemotingUI::GetFaviconResourceBytes(); |
| 345 #endif | 347 #endif |
| 346 | 348 |
| 347 return NULL; | 349 return NULL; |
| 348 } | 350 } |
| OLD | NEW |