Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: content/browser/tab_contents/tab_contents.cc

Issue 6672065: Support touch icon in FaviconHelper (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix some style issues Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/tab_contents/tab_contents.h" 5 #include "content/browser/tab_contents/tab_contents.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 #include "content/browser/tab_contents/tab_contents_observer.h" 86 #include "content/browser/tab_contents/tab_contents_observer.h"
87 #include "content/browser/tab_contents/tab_contents_view.h" 87 #include "content/browser/tab_contents/tab_contents_view.h"
88 #include "content/browser/webui/web_ui.h" 88 #include "content/browser/webui/web_ui.h"
89 #include "content/common/navigation_types.h" 89 #include "content/common/navigation_types.h"
90 #include "content/common/notification_service.h" 90 #include "content/common/notification_service.h"
91 #include "net/base/net_util.h" 91 #include "net/base/net_util.h"
92 #include "net/base/registry_controlled_domain.h" 92 #include "net/base/registry_controlled_domain.h"
93 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" 93 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
94 #include "ui/base/resource/resource_bundle.h" 94 #include "ui/base/resource/resource_bundle.h"
95 #include "ui/gfx/codec/png_codec.h" 95 #include "ui/gfx/codec/png_codec.h"
96 #include "ui/gfx/favicon_size.h"
96 #include "webkit/glue/password_form.h" 97 #include "webkit/glue/password_form.h"
97 #include "webkit/glue/webpreferences.h" 98 #include "webkit/glue/webpreferences.h"
98 99
99 #if defined(OS_MACOSX) 100 #if defined(OS_MACOSX)
100 #include "app/surface/io_surface_support_mac.h" 101 #include "app/surface/io_surface_support_mac.h"
101 #endif // defined(OS_MACOSX) 102 #endif // defined(OS_MACOSX)
102 103
103 #if defined(OS_CHROMEOS) 104 #if defined(OS_CHROMEOS)
104 #include "chrome/browser/chromeos/locale_change_guard.h" 105 #include "chrome/browser/chromeos/locale_change_guard.h"
105 #endif // defined(OS_CHROMEOS) 106 #endif // defined(OS_CHROMEOS)
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 } 383 }
383 384
384 FOR_EACH_OBSERVER(TabContentsObserver, observers_, TabContentsDestroyed()); 385 FOR_EACH_OBSERVER(TabContentsObserver, observers_, TabContentsDestroyed());
385 386
386 net::NetworkChangeNotifier::RemoveOnlineStateObserver(this); 387 net::NetworkChangeNotifier::RemoveOnlineStateObserver(this);
387 } 388 }
388 389
389 void TabContents::AddObservers() { 390 void TabContents::AddObservers() {
390 printing_.reset(new printing::PrintViewManager(this)); 391 printing_.reset(new printing::PrintViewManager(this));
391 print_preview_.reset(new printing::PrintPreviewMessageHandler(this)); 392 print_preview_.reset(new printing::PrintPreviewMessageHandler(this));
392 favicon_helper_.reset(new FaviconHelper(this)); 393 favicon_helper_.reset(new FaviconHelper(this, history::FAVICON,
394 kFaviconSize));
395
396 if (browser_defaults::enable_touch_icon) {
397 touch_icon_helper_.reset(new FaviconHelper(this,
398 history::TOUCH_ICON | history::TOUCH_PRECOMPOSED_ICON, 0));
399 }
400
393 autofill_manager_.reset(new AutofillManager(this)); 401 autofill_manager_.reset(new AutofillManager(this));
394 autocomplete_history_manager_.reset(new AutocompleteHistoryManager(this)); 402 autocomplete_history_manager_.reset(new AutocompleteHistoryManager(this));
395 desktop_notification_handler_.reset( 403 desktop_notification_handler_.reset(
396 new DesktopNotificationHandlerForTC(this, GetRenderProcessHost())); 404 new DesktopNotificationHandlerForTC(this, GetRenderProcessHost()));
397 plugin_observer_.reset(new PluginObserver(this)); 405 plugin_observer_.reset(new PluginObserver(this));
398 safebrowsing_detection_host_.reset(new safe_browsing::ClientSideDetectionHost( 406 safebrowsing_detection_host_.reset(new safe_browsing::ClientSideDetectionHost(
399 this)); 407 this));
400 net::NetworkChangeNotifier::AddOnlineStateObserver(this); 408 net::NetworkChangeNotifier::AddOnlineStateObserver(this);
401 } 409 }
402 410
(...skipping 29 matching lines...) Expand all
432 IPC_MESSAGE_HANDLER(ViewHostMsg_GoToEntryAtOffset, OnGoToEntryAtOffset) 440 IPC_MESSAGE_HANDLER(ViewHostMsg_GoToEntryAtOffset, OnGoToEntryAtOffset)
433 IPC_MESSAGE_HANDLER(ViewHostMsg_DidGetApplicationInfo, 441 IPC_MESSAGE_HANDLER(ViewHostMsg_DidGetApplicationInfo,
434 OnDidGetApplicationInfo) 442 OnDidGetApplicationInfo)
435 IPC_MESSAGE_HANDLER(ViewHostMsg_InstallApplication, 443 IPC_MESSAGE_HANDLER(ViewHostMsg_InstallApplication,
436 OnInstallApplication) 444 OnInstallApplication)
437 IPC_MESSAGE_HANDLER(ViewHostMsg_PageContents, OnPageContents) 445 IPC_MESSAGE_HANDLER(ViewHostMsg_PageContents, OnPageContents)
438 IPC_MESSAGE_HANDLER(ViewHostMsg_PageTranslated, OnPageTranslated) 446 IPC_MESSAGE_HANDLER(ViewHostMsg_PageTranslated, OnPageTranslated)
439 IPC_MESSAGE_HANDLER(ViewHostMsg_SetSuggestions, OnSetSuggestions) 447 IPC_MESSAGE_HANDLER(ViewHostMsg_SetSuggestions, OnSetSuggestions)
440 IPC_MESSAGE_HANDLER(ViewHostMsg_InstantSupportDetermined, 448 IPC_MESSAGE_HANDLER(ViewHostMsg_InstantSupportDetermined,
441 OnInstantSupportDetermined) 449 OnInstantSupportDetermined)
450 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateFaviconURL, OnUpdateFaviconURL)
442 IPC_MESSAGE_UNHANDLED(handled = false) 451 IPC_MESSAGE_UNHANDLED(handled = false)
443 IPC_END_MESSAGE_MAP_EX() 452 IPC_END_MESSAGE_MAP_EX()
444 453
445 if (!message_is_ok) { 454 if (!message_is_ok) {
446 UserMetrics::RecordAction(UserMetricsAction("BadMessageTerminate_RVD")); 455 UserMetrics::RecordAction(UserMetricsAction("BadMessageTerminate_RVD"));
447 GetRenderProcessHost()->ReceivedBadMessage(); 456 GetRenderProcessHost()->ReceivedBadMessage();
448 } 457 }
449 458
450 return handled; 459 return handled;
451 } 460 }
(...skipping 1211 matching lines...) Expand 10 before | Expand all | Expand 10 after
1663 // page. 1672 // page.
1664 UpdateTargetURL(details.entry->page_id(), GURL()); 1673 UpdateTargetURL(details.entry->page_id(), GURL());
1665 } 1674 }
1666 1675
1667 // Allow the new page to set the title again. 1676 // Allow the new page to set the title again.
1668 received_page_title_ = false; 1677 received_page_title_ = false;
1669 1678
1670 // Get the favicon, either from history or request it from the net. 1679 // Get the favicon, either from history or request it from the net.
1671 favicon_helper_->FetchFavicon(details.entry->url()); 1680 favicon_helper_->FetchFavicon(details.entry->url());
1672 1681
1682 if (touch_icon_helper_.get())
1683 touch_icon_helper_->FetchFavicon(details.entry->url());
1684
1673 // Clear all page actions, blocked content notifications and browser actions 1685 // Clear all page actions, blocked content notifications and browser actions
1674 // for this tab, unless this is an in-page navigation. 1686 // for this tab, unless this is an in-page navigation.
1675 if (!details.is_in_page) { 1687 if (!details.is_in_page) {
1676 ExtensionService* service = profile()->GetExtensionService(); 1688 ExtensionService* service = profile()->GetExtensionService();
1677 if (service) { 1689 if (service) {
1678 for (size_t i = 0; i < service->extensions()->size(); ++i) { 1690 for (size_t i = 0; i < service->extensions()->size(); ++i) {
1679 ExtensionAction* browser_action = 1691 ExtensionAction* browser_action =
1680 service->extensions()->at(i)->browser_action(); 1692 service->extensions()->at(i)->browser_action();
1681 if (browser_action) { 1693 if (browser_action) {
1682 browser_action->ClearAllValuesForTab(controller().session_id().id()); 1694 browser_action->ClearAllValuesForTab(controller().session_id().id());
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
1969 InstantCompleteBehavior behavior) { 1981 InstantCompleteBehavior behavior) {
1970 if (delegate()) 1982 if (delegate())
1971 delegate()->OnSetSuggestions(page_id, suggestions, behavior); 1983 delegate()->OnSetSuggestions(page_id, suggestions, behavior);
1972 } 1984 }
1973 1985
1974 void TabContents::OnInstantSupportDetermined(int32 page_id, bool result) { 1986 void TabContents::OnInstantSupportDetermined(int32 page_id, bool result) {
1975 if (delegate()) 1987 if (delegate())
1976 delegate()->OnInstantSupportDetermined(page_id, result); 1988 delegate()->OnInstantSupportDetermined(page_id, result);
1977 } 1989 }
1978 1990
1991 void TabContents::OnUpdateFaviconURL(
1992 int32 page_id,
1993 std::vector<FaviconURL> candidates) {
1994 favicon_helper().OnUpdateFaviconURL(page_id, candidates);
1995 if (touch_icon_helper_.get()) {
sky 2011/03/22 19:48:48 no parens
michaelbai 2011/03/22 23:59:03 Done.
1996 touch_icon_helper_->OnUpdateFaviconURL(page_id, candidates);
1997 }
1998 }
1999
1979 void TabContents::OnContentSettingsAccessed(bool content_was_blocked) { 2000 void TabContents::OnContentSettingsAccessed(bool content_was_blocked) {
1980 if (delegate_) 2001 if (delegate_)
1981 delegate_->OnContentSettingsChange(this); 2002 delegate_->OnContentSettingsChange(this);
1982 } 2003 }
1983 2004
1984 RenderViewHostDelegate::View* TabContents::GetViewDelegate() { 2005 RenderViewHostDelegate::View* TabContents::GetViewDelegate() {
1985 return view_.get(); 2006 return view_.get();
1986 } 2007 }
1987 2008
1988 RenderViewHostDelegate::RendererManagement* 2009 RenderViewHostDelegate::RendererManagement*
(...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after
2818 2839
2819 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { 2840 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) {
2820 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); 2841 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh);
2821 rwh_view->SetSize(view()->GetContainerSize()); 2842 rwh_view->SetSize(view()->GetContainerSize());
2822 } 2843 }
2823 2844
2824 void TabContents::OnOnlineStateChanged(bool online) { 2845 void TabContents::OnOnlineStateChanged(bool online) {
2825 render_view_host()->Send(new ViewMsg_NetworkStateChanged( 2846 render_view_host()->Send(new ViewMsg_NetworkStateChanged(
2826 render_view_host()->routing_id(), online)); 2847 render_view_host()->routing_id(), online));
2827 } 2848 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698