OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/dom_ui/dom_ui_factory.h" | 5 #include "chrome/browser/dom_ui/dom_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/browser_thread.h" | 9 #include "chrome/browser/browser_thread.h" |
10 #include "chrome/browser/dom_ui/bookmarks_ui.h" | 10 #include "chrome/browser/dom_ui/bookmarks_ui.h" |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 // static | 235 // static |
236 void DOMUIFactory::GetFaviconForURL(Profile* profile, | 236 void DOMUIFactory::GetFaviconForURL(Profile* profile, |
237 FaviconService::GetFaviconRequest* request, | 237 FaviconService::GetFaviconRequest* request, |
238 const GURL& page_url) { | 238 const GURL& page_url) { |
239 // All extensions but the bookmark manager get their favicon from the icons | 239 // All extensions but the bookmark manager get their favicon from the icons |
240 // part of the manifest. | 240 // part of the manifest. |
241 if (page_url.SchemeIs(chrome::kExtensionScheme) && | 241 if (page_url.SchemeIs(chrome::kExtensionScheme) && |
242 page_url.host() != extension_misc::kBookmarkManagerId) { | 242 page_url.host() != extension_misc::kBookmarkManagerId) { |
243 ExtensionDOMUI::GetFaviconForURL(profile, request, page_url); | 243 ExtensionDOMUI::GetFaviconForURL(profile, request, page_url); |
244 } else { | 244 } else { |
245 scoped_refptr<RefCountedMemory> icon_data = | 245 scoped_refptr<RefCountedMemory> icon_data( |
246 DOMUIFactory::GetFaviconResourceBytes(profile, page_url); | 246 DOMUIFactory::GetFaviconResourceBytes(profile, page_url)); |
247 bool know_icon = icon_data.get() != NULL && icon_data->size() > 0; | 247 bool know_icon = icon_data.get() != NULL && icon_data->size() > 0; |
248 request->ForwardResultAsync( | 248 request->ForwardResultAsync( |
249 FaviconService::FaviconDataCallback::TupleType(request->handle(), | 249 FaviconService::FaviconDataCallback::TupleType(request->handle(), |
250 know_icon, icon_data, false, GURL())); | 250 know_icon, icon_data, false, GURL())); |
251 } | 251 } |
252 } | 252 } |
253 | 253 |
254 // static | 254 // static |
255 RefCountedMemory* DOMUIFactory::GetFaviconResourceBytes(Profile* profile, | 255 RefCountedMemory* DOMUIFactory::GetFaviconResourceBytes(Profile* profile, |
256 const GURL& page_url) { | 256 const GURL& page_url) { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 if (page_url.host() == chrome::kChromeUIPluginsHost) | 289 if (page_url.host() == chrome::kChromeUIPluginsHost) |
290 return PluginsUI::GetFaviconResourceBytes(); | 290 return PluginsUI::GetFaviconResourceBytes(); |
291 | 291 |
292 #if defined(ENABLE_REMOTING) | 292 #if defined(ENABLE_REMOTING) |
293 if (page_url.host() == chrome::kChromeUIRemotingHost) | 293 if (page_url.host() == chrome::kChromeUIRemotingHost) |
294 return RemotingUI::GetFaviconResourceBytes(); | 294 return RemotingUI::GetFaviconResourceBytes(); |
295 #endif | 295 #endif |
296 | 296 |
297 return NULL; | 297 return NULL; |
298 } | 298 } |
OLD | NEW |