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 "chrome/browser/tab_contents/tab_contents.h" | 5 #include "chrome/browser/tab_contents/tab_contents.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 #include "chrome/browser/history/top_sites.h" | 42 #include "chrome/browser/history/top_sites.h" |
43 #include "chrome/browser/host_zoom_map.h" | 43 #include "chrome/browser/host_zoom_map.h" |
44 #include "chrome/browser/hung_renderer_dialog.h" | 44 #include "chrome/browser/hung_renderer_dialog.h" |
45 #include "chrome/browser/in_process_webkit/session_storage_namespace.h" | 45 #include "chrome/browser/in_process_webkit/session_storage_namespace.h" |
46 #include "chrome/browser/load_from_memory_cache_details.h" | 46 #include "chrome/browser/load_from_memory_cache_details.h" |
47 #include "chrome/browser/load_notification_details.h" | 47 #include "chrome/browser/load_notification_details.h" |
48 #include "chrome/browser/metrics/metric_event_duration_details.h" | 48 #include "chrome/browser/metrics/metric_event_duration_details.h" |
49 #include "chrome/browser/metrics/user_metrics.h" | 49 #include "chrome/browser/metrics/user_metrics.h" |
50 #include "chrome/browser/modal_html_dialog_delegate.h" | 50 #include "chrome/browser/modal_html_dialog_delegate.h" |
51 #include "chrome/browser/omnibox_search_hint.h" | 51 #include "chrome/browser/omnibox_search_hint.h" |
| 52 #include "chrome/browser/pdf_unsupported_feature.h" |
52 #include "chrome/browser/platform_util.h" | 53 #include "chrome/browser/platform_util.h" |
53 #include "chrome/browser/plugin_installer.h" | 54 #include "chrome/browser/plugin_installer.h" |
54 #include "chrome/browser/prefs/pref_service.h" | 55 #include "chrome/browser/prefs/pref_service.h" |
55 #include "chrome/browser/prerender/prerender_manager.h" | 56 #include "chrome/browser/prerender/prerender_manager.h" |
56 #include "chrome/browser/printing/print_preview_tab_controller.h" | 57 #include "chrome/browser/printing/print_preview_tab_controller.h" |
57 #include "chrome/browser/printing/print_view_manager.h" | 58 #include "chrome/browser/printing/print_view_manager.h" |
58 #include "chrome/browser/profiles/profile.h" | 59 #include "chrome/browser/profiles/profile.h" |
59 #include "chrome/browser/renderer_host/render_process_host.h" | 60 #include "chrome/browser/renderer_host/render_process_host.h" |
60 #include "chrome/browser/renderer_host/render_view_host.h" | 61 #include "chrome/browser/renderer_host/render_view_host.h" |
61 #include "chrome/browser/renderer_host/render_widget_host_view.h" | 62 #include "chrome/browser/renderer_host/render_widget_host_view.h" |
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
586 OnDidFailProvisionalLoadWithError) | 587 OnDidFailProvisionalLoadWithError) |
587 IPC_MESSAGE_HANDLER(ViewHostMsg_DidLoadResourceFromMemoryCache, | 588 IPC_MESSAGE_HANDLER(ViewHostMsg_DidLoadResourceFromMemoryCache, |
588 OnDidLoadResourceFromMemoryCache) | 589 OnDidLoadResourceFromMemoryCache) |
589 IPC_MESSAGE_HANDLER(ViewHostMsg_DidDisplayInsecureContent, | 590 IPC_MESSAGE_HANDLER(ViewHostMsg_DidDisplayInsecureContent, |
590 OnDidDisplayInsecureContent) | 591 OnDidDisplayInsecureContent) |
591 IPC_MESSAGE_HANDLER(ViewHostMsg_DidRunInsecureContent, | 592 IPC_MESSAGE_HANDLER(ViewHostMsg_DidRunInsecureContent, |
592 OnDidRunInsecureContent) | 593 OnDidRunInsecureContent) |
593 IPC_MESSAGE_HANDLER(ViewHostMsg_DocumentLoadedInFrame, | 594 IPC_MESSAGE_HANDLER(ViewHostMsg_DocumentLoadedInFrame, |
594 OnDocumentLoadedInFrame) | 595 OnDocumentLoadedInFrame) |
595 IPC_MESSAGE_HANDLER(ViewHostMsg_DidFinishLoad, OnDidFinishLoad) | 596 IPC_MESSAGE_HANDLER(ViewHostMsg_DidFinishLoad, OnDidFinishLoad) |
| 597 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateContentRestrictions, |
| 598 OnUpdateContentRestrictions) |
| 599 IPC_MESSAGE_HANDLER(ViewHostMsg_PDFHasUnsupportedFeature, |
| 600 OnPDFHasUnsupportedFeature) |
596 IPC_MESSAGE_UNHANDLED(handled = false) | 601 IPC_MESSAGE_UNHANDLED(handled = false) |
597 IPC_END_MESSAGE_MAP_EX() | 602 IPC_END_MESSAGE_MAP_EX() |
598 | 603 |
599 if (!message_is_ok) { | 604 if (!message_is_ok) { |
600 UserMetrics::RecordAction(UserMetricsAction("BadMessageTerminate_RVD")); | 605 UserMetrics::RecordAction(UserMetricsAction("BadMessageTerminate_RVD")); |
601 GetRenderProcessHost()->ReceivedBadMessage(); | 606 GetRenderProcessHost()->ReceivedBadMessage(); |
602 } | 607 } |
603 | 608 |
604 return handled; | 609 return handled; |
605 } | 610 } |
(...skipping 1160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1766 Details<int64>(&frame_id)); | 1771 Details<int64>(&frame_id)); |
1767 } | 1772 } |
1768 | 1773 |
1769 void TabContents::OnDidFinishLoad(int64 frame_id) { | 1774 void TabContents::OnDidFinishLoad(int64 frame_id) { |
1770 NotificationService::current()->Notify( | 1775 NotificationService::current()->Notify( |
1771 NotificationType::FRAME_DID_FINISH_LOAD, | 1776 NotificationType::FRAME_DID_FINISH_LOAD, |
1772 Source<NavigationController>(&controller_), | 1777 Source<NavigationController>(&controller_), |
1773 Details<int64>(&frame_id)); | 1778 Details<int64>(&frame_id)); |
1774 } | 1779 } |
1775 | 1780 |
| 1781 void TabContents::OnUpdateContentRestrictions(int restrictions) { |
| 1782 content_restrictions_ = restrictions; |
| 1783 delegate()->ContentRestrictionsChanged(this); |
| 1784 } |
| 1785 |
| 1786 void TabContents::OnPDFHasUnsupportedFeature() { |
| 1787 PDFHasUnsupportedFeature(this); |
| 1788 } |
| 1789 |
1776 // Notifies the RenderWidgetHost instance about the fact that the page is | 1790 // Notifies the RenderWidgetHost instance about the fact that the page is |
1777 // loading, or done loading and calls the base implementation. | 1791 // loading, or done loading and calls the base implementation. |
1778 void TabContents::SetIsLoading(bool is_loading, | 1792 void TabContents::SetIsLoading(bool is_loading, |
1779 LoadNotificationDetails* details) { | 1793 LoadNotificationDetails* details) { |
1780 if (is_loading == is_loading_) | 1794 if (is_loading == is_loading_) |
1781 return; | 1795 return; |
1782 | 1796 |
1783 if (!is_loading) { | 1797 if (!is_loading) { |
1784 load_state_ = net::LOAD_STATE_IDLE; | 1798 load_state_ = net::LOAD_STATE_IDLE; |
1785 load_state_host_.clear(); | 1799 load_state_host_.clear(); |
(...skipping 1351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3137 } | 3151 } |
3138 | 3152 |
3139 void TabContents::UpdateZoomLimits(int minimum_percent, | 3153 void TabContents::UpdateZoomLimits(int minimum_percent, |
3140 int maximum_percent, | 3154 int maximum_percent, |
3141 bool remember) { | 3155 bool remember) { |
3142 minimum_zoom_percent_ = minimum_percent; | 3156 minimum_zoom_percent_ = minimum_percent; |
3143 maximum_zoom_percent_ = maximum_percent; | 3157 maximum_zoom_percent_ = maximum_percent; |
3144 temporary_zoom_settings_ = !remember; | 3158 temporary_zoom_settings_ = !remember; |
3145 } | 3159 } |
3146 | 3160 |
3147 void TabContents::UpdateContentRestrictions(int restrictions) { | |
3148 content_restrictions_ = restrictions; | |
3149 delegate()->ContentRestrictionsChanged(this); | |
3150 } | |
3151 | |
3152 void TabContents::BeforeUnloadFiredFromRenderManager( | 3161 void TabContents::BeforeUnloadFiredFromRenderManager( |
3153 bool proceed, | 3162 bool proceed, |
3154 bool* proceed_to_fire_unload) { | 3163 bool* proceed_to_fire_unload) { |
3155 if (delegate()) | 3164 if (delegate()) |
3156 delegate()->BeforeUnloadFired(this, proceed, proceed_to_fire_unload); | 3165 delegate()->BeforeUnloadFired(this, proceed, proceed_to_fire_unload); |
3157 } | 3166 } |
3158 | 3167 |
3159 void TabContents::DidStartLoadingFromRenderManager( | 3168 void TabContents::DidStartLoadingFromRenderManager( |
3160 RenderViewHost* render_view_host) { | 3169 RenderViewHost* render_view_host) { |
3161 DidStartLoading(); | 3170 DidStartLoading(); |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3386 if (pm != NULL) { | 3395 if (pm != NULL) { |
3387 if (pm->MaybeUsePreloadedPage(this, url)) { | 3396 if (pm->MaybeUsePreloadedPage(this, url)) { |
3388 // TODO(tburkard): If the preloaded page has not finished preloading | 3397 // TODO(tburkard): If the preloaded page has not finished preloading |
3389 // yet, we should not do this. | 3398 // yet, we should not do this. |
3390 DidStopLoading(); | 3399 DidStopLoading(); |
3391 return true; | 3400 return true; |
3392 } | 3401 } |
3393 } | 3402 } |
3394 return false; | 3403 return false; |
3395 } | 3404 } |
OLD | NEW |