| 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 13 matching lines...) Expand all Loading... |
| 24 #include "chrome/browser/debugger/devtools_manager.h" | 24 #include "chrome/browser/debugger/devtools_manager.h" |
| 25 #include "chrome/browser/defaults.h" | 25 #include "chrome/browser/defaults.h" |
| 26 #include "chrome/browser/desktop_notification_handler.h" | 26 #include "chrome/browser/desktop_notification_handler.h" |
| 27 #include "chrome/browser/dom_operation_notification_details.h" | 27 #include "chrome/browser/dom_operation_notification_details.h" |
| 28 #include "chrome/browser/download/download_item_model.h" | 28 #include "chrome/browser/download/download_item_model.h" |
| 29 #include "chrome/browser/download/download_manager.h" | 29 #include "chrome/browser/download/download_manager.h" |
| 30 #include "chrome/browser/download/download_request_limiter.h" | 30 #include "chrome/browser/download/download_request_limiter.h" |
| 31 #include "chrome/browser/extensions/extension_service.h" | 31 #include "chrome/browser/extensions/extension_service.h" |
| 32 #include "chrome/browser/external_protocol_handler.h" | 32 #include "chrome/browser/external_protocol_handler.h" |
| 33 #include "chrome/browser/favicon_service.h" | 33 #include "chrome/browser/favicon_service.h" |
| 34 #include "chrome/browser/file_select_helper.h" | |
| 35 #include "chrome/browser/google/google_util.h" | 34 #include "chrome/browser/google/google_util.h" |
| 36 #include "chrome/browser/history/history.h" | 35 #include "chrome/browser/history/history.h" |
| 37 #include "chrome/browser/history/history_types.h" | 36 #include "chrome/browser/history/history_types.h" |
| 38 #include "chrome/browser/history/top_sites.h" | 37 #include "chrome/browser/history/top_sites.h" |
| 39 #include "chrome/browser/load_from_memory_cache_details.h" | 38 #include "chrome/browser/load_from_memory_cache_details.h" |
| 40 #include "chrome/browser/load_notification_details.h" | 39 #include "chrome/browser/load_notification_details.h" |
| 41 #include "chrome/browser/metrics/metric_event_duration_details.h" | 40 #include "chrome/browser/metrics/metric_event_duration_details.h" |
| 42 #include "chrome/browser/metrics/user_metrics.h" | 41 #include "chrome/browser/metrics/user_metrics.h" |
| 43 #include "chrome/browser/omnibox_search_hint.h" | 42 #include "chrome/browser/omnibox_search_hint.h" |
| 44 #include "chrome/browser/pdf_unsupported_feature.h" | 43 #include "chrome/browser/pdf_unsupported_feature.h" |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 IPC_MESSAGE_HANDLER(ViewHostMsg_GoToEntryAtOffset, OnGoToEntryAtOffset) | 433 IPC_MESSAGE_HANDLER(ViewHostMsg_GoToEntryAtOffset, OnGoToEntryAtOffset) |
| 435 IPC_MESSAGE_HANDLER(ViewHostMsg_DidGetApplicationInfo, | 434 IPC_MESSAGE_HANDLER(ViewHostMsg_DidGetApplicationInfo, |
| 436 OnDidGetApplicationInfo) | 435 OnDidGetApplicationInfo) |
| 437 IPC_MESSAGE_HANDLER(ViewHostMsg_InstallApplication, | 436 IPC_MESSAGE_HANDLER(ViewHostMsg_InstallApplication, |
| 438 OnInstallApplication) | 437 OnInstallApplication) |
| 439 IPC_MESSAGE_HANDLER(ViewHostMsg_PageContents, OnPageContents) | 438 IPC_MESSAGE_HANDLER(ViewHostMsg_PageContents, OnPageContents) |
| 440 IPC_MESSAGE_HANDLER(ViewHostMsg_PageTranslated, OnPageTranslated) | 439 IPC_MESSAGE_HANDLER(ViewHostMsg_PageTranslated, OnPageTranslated) |
| 441 IPC_MESSAGE_HANDLER(ViewHostMsg_SetSuggestions, OnSetSuggestions) | 440 IPC_MESSAGE_HANDLER(ViewHostMsg_SetSuggestions, OnSetSuggestions) |
| 442 IPC_MESSAGE_HANDLER(ViewHostMsg_InstantSupportDetermined, | 441 IPC_MESSAGE_HANDLER(ViewHostMsg_InstantSupportDetermined, |
| 443 OnInstantSupportDetermined) | 442 OnInstantSupportDetermined) |
| 444 IPC_MESSAGE_HANDLER(ViewHostMsg_RunFileChooser, OnRunFileChooser) | |
| 445 IPC_MESSAGE_UNHANDLED(handled = false) | 443 IPC_MESSAGE_UNHANDLED(handled = false) |
| 446 IPC_END_MESSAGE_MAP_EX() | 444 IPC_END_MESSAGE_MAP_EX() |
| 447 | 445 |
| 448 if (!message_is_ok) { | 446 if (!message_is_ok) { |
| 449 UserMetrics::RecordAction(UserMetricsAction("BadMessageTerminate_RVD")); | 447 UserMetrics::RecordAction(UserMetricsAction("BadMessageTerminate_RVD")); |
| 450 GetRenderProcessHost()->ReceivedBadMessage(); | 448 GetRenderProcessHost()->ReceivedBadMessage(); |
| 451 } | 449 } |
| 452 | 450 |
| 453 return handled; | 451 return handled; |
| 454 } | 452 } |
| (...skipping 1516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1971 InstantCompleteBehavior behavior) { | 1969 InstantCompleteBehavior behavior) { |
| 1972 if (delegate()) | 1970 if (delegate()) |
| 1973 delegate()->OnSetSuggestions(page_id, suggestions, behavior); | 1971 delegate()->OnSetSuggestions(page_id, suggestions, behavior); |
| 1974 } | 1972 } |
| 1975 | 1973 |
| 1976 void TabContents::OnInstantSupportDetermined(int32 page_id, bool result) { | 1974 void TabContents::OnInstantSupportDetermined(int32 page_id, bool result) { |
| 1977 if (delegate()) | 1975 if (delegate()) |
| 1978 delegate()->OnInstantSupportDetermined(page_id, result); | 1976 delegate()->OnInstantSupportDetermined(page_id, result); |
| 1979 } | 1977 } |
| 1980 | 1978 |
| 1981 void TabContents::OnRunFileChooser( | |
| 1982 const ViewHostMsg_RunFileChooser_Params& params) { | |
| 1983 if (file_select_helper_.get() == NULL) | |
| 1984 file_select_helper_.reset(new FileSelectHelper(profile())); | |
| 1985 file_select_helper_->RunFileChooser(render_view_host(), params); | |
| 1986 } | |
| 1987 | |
| 1988 | |
| 1989 void TabContents::OnContentSettingsAccessed(bool content_was_blocked) { | 1979 void TabContents::OnContentSettingsAccessed(bool content_was_blocked) { |
| 1990 if (delegate_) | 1980 if (delegate_) |
| 1991 delegate_->OnContentSettingsChange(this); | 1981 delegate_->OnContentSettingsChange(this); |
| 1992 } | 1982 } |
| 1993 | 1983 |
| 1994 RenderViewHostDelegate::View* TabContents::GetViewDelegate() { | 1984 RenderViewHostDelegate::View* TabContents::GetViewDelegate() { |
| 1995 return view_.get(); | 1985 return view_.get(); |
| 1996 } | 1986 } |
| 1997 | 1987 |
| 1998 RenderViewHostDelegate::RendererManagement* | 1988 RenderViewHostDelegate::RendererManagement* |
| (...skipping 840 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2839 | 2829 |
| 2840 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { | 2830 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { |
| 2841 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); | 2831 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); |
| 2842 rwh_view->SetSize(view()->GetContainerSize()); | 2832 rwh_view->SetSize(view()->GetContainerSize()); |
| 2843 } | 2833 } |
| 2844 | 2834 |
| 2845 void TabContents::OnOnlineStateChanged(bool online) { | 2835 void TabContents::OnOnlineStateChanged(bool online) { |
| 2846 render_view_host()->Send(new ViewMsg_NetworkStateChanged( | 2836 render_view_host()->Send(new ViewMsg_NetworkStateChanged( |
| 2847 render_view_host()->routing_id(), online)); | 2837 render_view_host()->routing_id(), online)); |
| 2848 } | 2838 } |
| OLD | NEW |