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/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 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 } | 382 } |
383 | 383 |
384 FOR_EACH_OBSERVER(TabContentsObserver, observers_, TabContentsDestroyed()); | 384 FOR_EACH_OBSERVER(TabContentsObserver, observers_, TabContentsDestroyed()); |
385 | 385 |
386 net::NetworkChangeNotifier::RemoveOnlineStateObserver(this); | 386 net::NetworkChangeNotifier::RemoveOnlineStateObserver(this); |
387 } | 387 } |
388 | 388 |
389 void TabContents::AddObservers() { | 389 void TabContents::AddObservers() { |
390 printing_.reset(new printing::PrintViewManager(this)); | 390 printing_.reset(new printing::PrintViewManager(this)); |
391 print_preview_.reset(new printing::PrintPreviewMessageHandler(this)); | 391 print_preview_.reset(new printing::PrintPreviewMessageHandler(this)); |
392 favicon_helper_.reset(new FaviconHelper(this)); | 392 favicon_helper_.reset(new FaviconHelper(this, FaviconHelper::FAVICON)); |
| 393 |
| 394 if (browser_defaults::kEnableTouchIcon) |
| 395 touch_icon_helper_.reset(new FaviconHelper(this, FaviconHelper::TOUCH)); |
| 396 |
393 autofill_manager_.reset(new AutofillManager(this)); | 397 autofill_manager_.reset(new AutofillManager(this)); |
394 autocomplete_history_manager_.reset(new AutocompleteHistoryManager(this)); | 398 autocomplete_history_manager_.reset(new AutocompleteHistoryManager(this)); |
395 desktop_notification_handler_.reset( | 399 desktop_notification_handler_.reset( |
396 new DesktopNotificationHandlerForTC(this, GetRenderProcessHost())); | 400 new DesktopNotificationHandlerForTC(this, GetRenderProcessHost())); |
397 plugin_observer_.reset(new PluginObserver(this)); | 401 plugin_observer_.reset(new PluginObserver(this)); |
398 safebrowsing_detection_host_.reset(new safe_browsing::ClientSideDetectionHost( | 402 safebrowsing_detection_host_.reset(new safe_browsing::ClientSideDetectionHost( |
399 this)); | 403 this)); |
400 net::NetworkChangeNotifier::AddOnlineStateObserver(this); | 404 net::NetworkChangeNotifier::AddOnlineStateObserver(this); |
401 } | 405 } |
402 | 406 |
(...skipping 29 matching lines...) Expand all Loading... |
432 IPC_MESSAGE_HANDLER(ViewHostMsg_GoToEntryAtOffset, OnGoToEntryAtOffset) | 436 IPC_MESSAGE_HANDLER(ViewHostMsg_GoToEntryAtOffset, OnGoToEntryAtOffset) |
433 IPC_MESSAGE_HANDLER(ViewHostMsg_DidGetApplicationInfo, | 437 IPC_MESSAGE_HANDLER(ViewHostMsg_DidGetApplicationInfo, |
434 OnDidGetApplicationInfo) | 438 OnDidGetApplicationInfo) |
435 IPC_MESSAGE_HANDLER(ViewHostMsg_InstallApplication, | 439 IPC_MESSAGE_HANDLER(ViewHostMsg_InstallApplication, |
436 OnInstallApplication) | 440 OnInstallApplication) |
437 IPC_MESSAGE_HANDLER(ViewHostMsg_PageContents, OnPageContents) | 441 IPC_MESSAGE_HANDLER(ViewHostMsg_PageContents, OnPageContents) |
438 IPC_MESSAGE_HANDLER(ViewHostMsg_PageTranslated, OnPageTranslated) | 442 IPC_MESSAGE_HANDLER(ViewHostMsg_PageTranslated, OnPageTranslated) |
439 IPC_MESSAGE_HANDLER(ViewHostMsg_SetSuggestions, OnSetSuggestions) | 443 IPC_MESSAGE_HANDLER(ViewHostMsg_SetSuggestions, OnSetSuggestions) |
440 IPC_MESSAGE_HANDLER(ViewHostMsg_InstantSupportDetermined, | 444 IPC_MESSAGE_HANDLER(ViewHostMsg_InstantSupportDetermined, |
441 OnInstantSupportDetermined) | 445 OnInstantSupportDetermined) |
| 446 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateFaviconURL, OnUpdateFaviconURL) |
442 IPC_MESSAGE_UNHANDLED(handled = false) | 447 IPC_MESSAGE_UNHANDLED(handled = false) |
443 IPC_END_MESSAGE_MAP_EX() | 448 IPC_END_MESSAGE_MAP_EX() |
444 | 449 |
445 if (!message_is_ok) { | 450 if (!message_is_ok) { |
446 UserMetrics::RecordAction(UserMetricsAction("BadMessageTerminate_RVD")); | 451 UserMetrics::RecordAction(UserMetricsAction("BadMessageTerminate_RVD")); |
447 GetRenderProcessHost()->ReceivedBadMessage(); | 452 GetRenderProcessHost()->ReceivedBadMessage(); |
448 } | 453 } |
449 | 454 |
450 return handled; | 455 return handled; |
451 } | 456 } |
(...skipping 1211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1663 // page. | 1668 // page. |
1664 UpdateTargetURL(details.entry->page_id(), GURL()); | 1669 UpdateTargetURL(details.entry->page_id(), GURL()); |
1665 } | 1670 } |
1666 | 1671 |
1667 // Allow the new page to set the title again. | 1672 // Allow the new page to set the title again. |
1668 received_page_title_ = false; | 1673 received_page_title_ = false; |
1669 | 1674 |
1670 // Get the favicon, either from history or request it from the net. | 1675 // Get the favicon, either from history or request it from the net. |
1671 favicon_helper_->FetchFavicon(details.entry->url()); | 1676 favicon_helper_->FetchFavicon(details.entry->url()); |
1672 | 1677 |
| 1678 if (touch_icon_helper_.get()) |
| 1679 touch_icon_helper_->FetchFavicon(details.entry->url()); |
| 1680 |
1673 // Clear all page actions, blocked content notifications and browser actions | 1681 // Clear all page actions, blocked content notifications and browser actions |
1674 // for this tab, unless this is an in-page navigation. | 1682 // for this tab, unless this is an in-page navigation. |
1675 if (!details.is_in_page) { | 1683 if (!details.is_in_page) { |
1676 ExtensionService* service = profile()->GetExtensionService(); | 1684 ExtensionService* service = profile()->GetExtensionService(); |
1677 if (service) { | 1685 if (service) { |
1678 for (size_t i = 0; i < service->extensions()->size(); ++i) { | 1686 for (size_t i = 0; i < service->extensions()->size(); ++i) { |
1679 ExtensionAction* browser_action = | 1687 ExtensionAction* browser_action = |
1680 service->extensions()->at(i)->browser_action(); | 1688 service->extensions()->at(i)->browser_action(); |
1681 if (browser_action) { | 1689 if (browser_action) { |
1682 browser_action->ClearAllValuesForTab(controller().session_id().id()); | 1690 browser_action->ClearAllValuesForTab(controller().session_id().id()); |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1969 InstantCompleteBehavior behavior) { | 1977 InstantCompleteBehavior behavior) { |
1970 if (delegate()) | 1978 if (delegate()) |
1971 delegate()->OnSetSuggestions(page_id, suggestions, behavior); | 1979 delegate()->OnSetSuggestions(page_id, suggestions, behavior); |
1972 } | 1980 } |
1973 | 1981 |
1974 void TabContents::OnInstantSupportDetermined(int32 page_id, bool result) { | 1982 void TabContents::OnInstantSupportDetermined(int32 page_id, bool result) { |
1975 if (delegate()) | 1983 if (delegate()) |
1976 delegate()->OnInstantSupportDetermined(page_id, result); | 1984 delegate()->OnInstantSupportDetermined(page_id, result); |
1977 } | 1985 } |
1978 | 1986 |
| 1987 void TabContents::OnUpdateFaviconURL( |
| 1988 int32 page_id, |
| 1989 const std::vector<FaviconURL>& candidates) { |
| 1990 favicon_helper().OnUpdateFaviconURL(page_id, candidates); |
| 1991 if (touch_icon_helper_.get()) |
| 1992 touch_icon_helper_->OnUpdateFaviconURL(page_id, candidates); |
| 1993 } |
| 1994 |
1979 void TabContents::OnContentSettingsAccessed(bool content_was_blocked) { | 1995 void TabContents::OnContentSettingsAccessed(bool content_was_blocked) { |
1980 if (delegate_) | 1996 if (delegate_) |
1981 delegate_->OnContentSettingsChange(this); | 1997 delegate_->OnContentSettingsChange(this); |
1982 } | 1998 } |
1983 | 1999 |
1984 RenderViewHostDelegate::View* TabContents::GetViewDelegate() { | 2000 RenderViewHostDelegate::View* TabContents::GetViewDelegate() { |
1985 return view_.get(); | 2001 return view_.get(); |
1986 } | 2002 } |
1987 | 2003 |
1988 RenderViewHostDelegate::RendererManagement* | 2004 RenderViewHostDelegate::RendererManagement* |
(...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2818 | 2834 |
2819 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { | 2835 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { |
2820 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); | 2836 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); |
2821 rwh_view->SetSize(view()->GetContainerSize()); | 2837 rwh_view->SetSize(view()->GetContainerSize()); |
2822 } | 2838 } |
2823 | 2839 |
2824 void TabContents::OnOnlineStateChanged(bool online) { | 2840 void TabContents::OnOnlineStateChanged(bool online) { |
2825 render_view_host()->Send(new ViewMsg_NetworkStateChanged( | 2841 render_view_host()->Send(new ViewMsg_NetworkStateChanged( |
2826 render_view_host()->routing_id(), online)); | 2842 render_view_host()->routing_id(), online)); |
2827 } | 2843 } |
OLD | NEW |