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/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 OnDidRunInsecureContent) | 287 OnDidRunInsecureContent) |
288 IPC_MESSAGE_HANDLER(ViewHostMsg_DocumentLoadedInFrame, | 288 IPC_MESSAGE_HANDLER(ViewHostMsg_DocumentLoadedInFrame, |
289 OnDocumentLoadedInFrame) | 289 OnDocumentLoadedInFrame) |
290 IPC_MESSAGE_HANDLER(ViewHostMsg_DidFinishLoad, OnDidFinishLoad) | 290 IPC_MESSAGE_HANDLER(ViewHostMsg_DidFinishLoad, OnDidFinishLoad) |
291 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateContentRestrictions, | 291 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateContentRestrictions, |
292 OnUpdateContentRestrictions) | 292 OnUpdateContentRestrictions) |
293 IPC_MESSAGE_HANDLER(ViewHostMsg_GoToEntryAtOffset, OnGoToEntryAtOffset) | 293 IPC_MESSAGE_HANDLER(ViewHostMsg_GoToEntryAtOffset, OnGoToEntryAtOffset) |
294 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateZoomLimits, OnUpdateZoomLimits) | 294 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateZoomLimits, OnUpdateZoomLimits) |
295 IPC_MESSAGE_HANDLER(ViewHostMsg_FocusedNodeChanged, OnFocusedNodeChanged) | 295 IPC_MESSAGE_HANDLER(ViewHostMsg_FocusedNodeChanged, OnFocusedNodeChanged) |
296 IPC_MESSAGE_HANDLER(ViewHostMsg_SaveURLAs, OnSaveURL) | 296 IPC_MESSAGE_HANDLER(ViewHostMsg_SaveURLAs, OnSaveURL) |
297 IPC_MESSAGE_HANDLER(ViewHostMsg_RunFileChooser, OnRunFileChooser) | |
298 IPC_MESSAGE_HANDLER(ViewHostMsg_EnumerateDirectory, OnEnumerateDirectory) | 297 IPC_MESSAGE_HANDLER(ViewHostMsg_EnumerateDirectory, OnEnumerateDirectory) |
299 IPC_MESSAGE_UNHANDLED(handled = false) | 298 IPC_MESSAGE_UNHANDLED(handled = false) |
300 IPC_END_MESSAGE_MAP_EX() | 299 IPC_END_MESSAGE_MAP_EX() |
301 | 300 |
302 if (!message_is_ok) { | 301 if (!message_is_ok) { |
303 UserMetrics::RecordAction(UserMetricsAction("BadMessageTerminate_RVD")); | 302 UserMetrics::RecordAction(UserMetricsAction("BadMessageTerminate_RVD")); |
304 GetRenderProcessHost()->ReceivedBadMessage(); | 303 GetRenderProcessHost()->ReceivedBadMessage(); |
305 } | 304 } |
306 | 305 |
307 return handled; | 306 return handled; |
308 } | 307 } |
309 | 308 |
| 309 void TabContents::RunFileChooser( |
| 310 RenderViewHost* render_view_host, |
| 311 const ViewHostMsg_RunFileChooser_Params& params) { |
| 312 delegate()->RunFileChooser(this, params); |
| 313 } |
| 314 |
310 RenderProcessHost* TabContents::GetRenderProcessHost() const { | 315 RenderProcessHost* TabContents::GetRenderProcessHost() const { |
311 return render_manager_.current_host()->process(); | 316 return render_manager_.current_host()->process(); |
312 } | 317 } |
313 | 318 |
314 const GURL& TabContents::GetURL() const { | 319 const GURL& TabContents::GetURL() const { |
315 // We may not have a navigation entry yet | 320 // We may not have a navigation entry yet |
316 NavigationEntry* entry = controller_.GetActiveEntry(); | 321 NavigationEntry* entry = controller_.GetActiveEntry(); |
317 return entry ? entry->virtual_url() : GURL::EmptyGURL(); | 322 return entry ? entry->virtual_url() : GURL::EmptyGURL(); |
318 } | 323 } |
319 | 324 |
(...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1080 temporary_zoom_settings_ = !remember; | 1085 temporary_zoom_settings_ = !remember; |
1081 } | 1086 } |
1082 | 1087 |
1083 void TabContents::OnFocusedNodeChanged(bool is_editable_node) { | 1088 void TabContents::OnFocusedNodeChanged(bool is_editable_node) { |
1084 NotificationService::current()->Notify( | 1089 NotificationService::current()->Notify( |
1085 content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE, | 1090 content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE, |
1086 Source<TabContents>(this), | 1091 Source<TabContents>(this), |
1087 Details<const bool>(&is_editable_node)); | 1092 Details<const bool>(&is_editable_node)); |
1088 } | 1093 } |
1089 | 1094 |
1090 void TabContents::OnRunFileChooser( | |
1091 const ViewHostMsg_RunFileChooser_Params& params) { | |
1092 delegate()->RunFileChooser(this, params); | |
1093 } | |
1094 | |
1095 void TabContents::OnEnumerateDirectory(int request_id, | 1095 void TabContents::OnEnumerateDirectory(int request_id, |
1096 const FilePath& path) { | 1096 const FilePath& path) { |
1097 delegate()->EnumerateDirectory(this, request_id, path); | 1097 delegate()->EnumerateDirectory(this, request_id, path); |
1098 } | 1098 } |
1099 | 1099 |
1100 // Notifies the RenderWidgetHost instance about the fact that the page is | 1100 // Notifies the RenderWidgetHost instance about the fact that the page is |
1101 // loading, or done loading and calls the base implementation. | 1101 // loading, or done loading and calls the base implementation. |
1102 void TabContents::SetIsLoading(bool is_loading, | 1102 void TabContents::SetIsLoading(bool is_loading, |
1103 LoadNotificationDetails* details) { | 1103 LoadNotificationDetails* details) { |
1104 if (is_loading == is_loading_) | 1104 if (is_loading == is_loading_) |
(...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1941 } | 1941 } |
1942 | 1942 |
1943 void TabContents::SwapInRenderViewHost(RenderViewHost* rvh) { | 1943 void TabContents::SwapInRenderViewHost(RenderViewHost* rvh) { |
1944 render_manager_.SwapInRenderViewHost(rvh); | 1944 render_manager_.SwapInRenderViewHost(rvh); |
1945 } | 1945 } |
1946 | 1946 |
1947 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { | 1947 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { |
1948 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); | 1948 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); |
1949 rwh_view->SetSize(view()->GetContainerSize()); | 1949 rwh_view->SetSize(view()->GetContainerSize()); |
1950 } | 1950 } |
OLD | NEW |