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 1515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1970 const std::vector<std::string>& suggestions) { | 1968 const std::vector<std::string>& suggestions) { |
1971 if (delegate()) | 1969 if (delegate()) |
1972 delegate()->OnSetSuggestions(page_id, suggestions); | 1970 delegate()->OnSetSuggestions(page_id, suggestions); |
1973 } | 1971 } |
1974 | 1972 |
1975 void TabContents::OnInstantSupportDetermined(int32 page_id, bool result) { | 1973 void TabContents::OnInstantSupportDetermined(int32 page_id, bool result) { |
1976 if (delegate()) | 1974 if (delegate()) |
1977 delegate()->OnInstantSupportDetermined(page_id, result); | 1975 delegate()->OnInstantSupportDetermined(page_id, result); |
1978 } | 1976 } |
1979 | 1977 |
1980 void TabContents::OnRunFileChooser( | |
1981 const ViewHostMsg_RunFileChooser_Params& params) { | |
1982 if (file_select_helper_.get() == NULL) | |
1983 file_select_helper_.reset(new FileSelectHelper(profile())); | |
1984 file_select_helper_->RunFileChooser(render_view_host(), params); | |
1985 } | |
1986 | |
1987 | |
1988 void TabContents::OnContentSettingsAccessed(bool content_was_blocked) { | 1978 void TabContents::OnContentSettingsAccessed(bool content_was_blocked) { |
1989 if (delegate_) | 1979 if (delegate_) |
1990 delegate_->OnContentSettingsChange(this); | 1980 delegate_->OnContentSettingsChange(this); |
1991 } | 1981 } |
1992 | 1982 |
1993 RenderViewHostDelegate::View* TabContents::GetViewDelegate() { | 1983 RenderViewHostDelegate::View* TabContents::GetViewDelegate() { |
1994 return view_.get(); | 1984 return view_.get(); |
1995 } | 1985 } |
1996 | 1986 |
1997 RenderViewHostDelegate::RendererManagement* | 1987 RenderViewHostDelegate::RendererManagement* |
(...skipping 840 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2838 | 2828 |
2839 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { | 2829 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { |
2840 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); | 2830 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); |
2841 rwh_view->SetSize(view()->GetContainerSize()); | 2831 rwh_view->SetSize(view()->GetContainerSize()); |
2842 } | 2832 } |
2843 | 2833 |
2844 void TabContents::OnOnlineStateChanged(bool online) { | 2834 void TabContents::OnOnlineStateChanged(bool online) { |
2845 render_view_host()->Send(new ViewMsg_NetworkStateChanged( | 2835 render_view_host()->Send(new ViewMsg_NetworkStateChanged( |
2846 render_view_host()->routing_id(), online)); | 2836 render_view_host()->routing_id(), online)); |
2847 } | 2837 } |
OLD | NEW |