| 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 768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1088 temporary_zoom_settings_ = !remember; | 1093 temporary_zoom_settings_ = !remember; |
| 1089 } | 1094 } |
| 1090 | 1095 |
| 1091 void TabContents::OnFocusedNodeChanged(bool is_editable_node) { | 1096 void TabContents::OnFocusedNodeChanged(bool is_editable_node) { |
| 1092 NotificationService::current()->Notify( | 1097 NotificationService::current()->Notify( |
| 1093 content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE, | 1098 content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE, |
| 1094 Source<TabContents>(this), | 1099 Source<TabContents>(this), |
| 1095 Details<const bool>(&is_editable_node)); | 1100 Details<const bool>(&is_editable_node)); |
| 1096 } | 1101 } |
| 1097 | 1102 |
| 1098 void TabContents::OnRunFileChooser( | |
| 1099 const ViewHostMsg_RunFileChooser_Params& params) { | |
| 1100 delegate()->RunFileChooser(this, params); | |
| 1101 } | |
| 1102 | |
| 1103 void TabContents::OnEnumerateDirectory(int request_id, | 1103 void TabContents::OnEnumerateDirectory(int request_id, |
| 1104 const FilePath& path) { | 1104 const FilePath& path) { |
| 1105 delegate()->EnumerateDirectory(this, request_id, path); | 1105 delegate()->EnumerateDirectory(this, request_id, path); |
| 1106 } | 1106 } |
| 1107 | 1107 |
| 1108 // Notifies the RenderWidgetHost instance about the fact that the page is | 1108 // Notifies the RenderWidgetHost instance about the fact that the page is |
| 1109 // loading, or done loading and calls the base implementation. | 1109 // loading, or done loading and calls the base implementation. |
| 1110 void TabContents::SetIsLoading(bool is_loading, | 1110 void TabContents::SetIsLoading(bool is_loading, |
| 1111 LoadNotificationDetails* details) { | 1111 LoadNotificationDetails* details) { |
| 1112 if (is_loading == is_loading_) | 1112 if (is_loading == is_loading_) |
| (...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1949 } | 1949 } |
| 1950 | 1950 |
| 1951 void TabContents::SwapInRenderViewHost(RenderViewHost* rvh) { | 1951 void TabContents::SwapInRenderViewHost(RenderViewHost* rvh) { |
| 1952 render_manager_.SwapInRenderViewHost(rvh); | 1952 render_manager_.SwapInRenderViewHost(rvh); |
| 1953 } | 1953 } |
| 1954 | 1954 |
| 1955 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { | 1955 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { |
| 1956 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); | 1956 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); |
| 1957 rwh_view->SetSize(view()->GetContainerSize()); | 1957 rwh_view->SetSize(view()->GetContainerSize()); |
| 1958 } | 1958 } |
| OLD | NEW |