| 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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 ALLOW_THIS_IN_INITIALIZER_LIST(controller_( | 171 ALLOW_THIS_IN_INITIALIZER_LIST(controller_( |
| 172 this, browser_context, session_storage_namespace)), | 172 this, browser_context, session_storage_namespace)), |
| 173 ALLOW_THIS_IN_INITIALIZER_LIST(view_( | 173 ALLOW_THIS_IN_INITIALIZER_LIST(view_( |
| 174 TabContentsView::Create(this))), | 174 TabContentsView::Create(this))), |
| 175 ALLOW_THIS_IN_INITIALIZER_LIST(render_manager_(this, this)), | 175 ALLOW_THIS_IN_INITIALIZER_LIST(render_manager_(this, this)), |
| 176 is_loading_(false), | 176 is_loading_(false), |
| 177 crashed_status_(base::TERMINATION_STATUS_STILL_RUNNING), | 177 crashed_status_(base::TERMINATION_STATUS_STILL_RUNNING), |
| 178 crashed_error_code_(0), | 178 crashed_error_code_(0), |
| 179 waiting_for_response_(false), | 179 waiting_for_response_(false), |
| 180 max_page_id_(-1), | 180 max_page_id_(-1), |
| 181 load_state_(net::LOAD_STATE_IDLE), | 181 load_state_(net::LOAD_STATE_IDLE, string16()), |
| 182 upload_size_(0), | 182 upload_size_(0), |
| 183 upload_position_(0), | 183 upload_position_(0), |
| 184 displayed_insecure_content_(false), | 184 displayed_insecure_content_(false), |
| 185 capturing_contents_(false), | 185 capturing_contents_(false), |
| 186 is_being_destroyed_(false), | 186 is_being_destroyed_(false), |
| 187 notify_disconnection_(false), | 187 notify_disconnection_(false), |
| 188 #if defined(OS_WIN) | 188 #if defined(OS_WIN) |
| 189 message_box_active_(CreateEvent(NULL, TRUE, FALSE, NULL)), | 189 message_box_active_(CreateEvent(NULL, TRUE, FALSE, NULL)), |
| 190 #endif | 190 #endif |
| 191 is_showing_before_unload_dialog_(false), | 191 is_showing_before_unload_dialog_(false), |
| (...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1071 } | 1071 } |
| 1072 | 1072 |
| 1073 // Notifies the RenderWidgetHost instance about the fact that the page is | 1073 // Notifies the RenderWidgetHost instance about the fact that the page is |
| 1074 // loading, or done loading and calls the base implementation. | 1074 // loading, or done loading and calls the base implementation. |
| 1075 void TabContents::SetIsLoading(bool is_loading, | 1075 void TabContents::SetIsLoading(bool is_loading, |
| 1076 LoadNotificationDetails* details) { | 1076 LoadNotificationDetails* details) { |
| 1077 if (is_loading == is_loading_) | 1077 if (is_loading == is_loading_) |
| 1078 return; | 1078 return; |
| 1079 | 1079 |
| 1080 if (!is_loading) { | 1080 if (!is_loading) { |
| 1081 load_state_ = net::LOAD_STATE_IDLE; | 1081 load_state_ = net::LoadStateWithParam(net::LOAD_STATE_IDLE, string16()); |
| 1082 load_state_host_.clear(); | 1082 load_state_host_.clear(); |
| 1083 upload_size_ = 0; | 1083 upload_size_ = 0; |
| 1084 upload_position_ = 0; | 1084 upload_position_ = 0; |
| 1085 } | 1085 } |
| 1086 | 1086 |
| 1087 render_manager_.SetIsLoading(is_loading); | 1087 render_manager_.SetIsLoading(is_loading); |
| 1088 | 1088 |
| 1089 is_loading_ = is_loading; | 1089 is_loading_ = is_loading; |
| 1090 waiting_for_response_ = is_loading; | 1090 waiting_for_response_ = is_loading; |
| 1091 | 1091 |
| (...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1788 if (delegate()) | 1788 if (delegate()) |
| 1789 delegate()->RendererUnresponsive(this); | 1789 delegate()->RendererUnresponsive(this); |
| 1790 } | 1790 } |
| 1791 | 1791 |
| 1792 void TabContents::RendererResponsive(RenderViewHost* render_view_host) { | 1792 void TabContents::RendererResponsive(RenderViewHost* render_view_host) { |
| 1793 if (delegate()) | 1793 if (delegate()) |
| 1794 delegate()->RendererResponsive(this); | 1794 delegate()->RendererResponsive(this); |
| 1795 } | 1795 } |
| 1796 | 1796 |
| 1797 void TabContents::LoadStateChanged(const GURL& url, | 1797 void TabContents::LoadStateChanged(const GURL& url, |
| 1798 net::LoadState load_state, | 1798 const net::LoadStateWithParam& load_state, |
| 1799 uint64 upload_position, | 1799 uint64 upload_position, |
| 1800 uint64 upload_size) { | 1800 uint64 upload_size) { |
| 1801 load_state_ = load_state; | 1801 load_state_ = load_state; |
| 1802 upload_position_ = upload_position; | 1802 upload_position_ = upload_position; |
| 1803 upload_size_ = upload_size; | 1803 upload_size_ = upload_size; |
| 1804 load_state_host_ = net::IDNToUnicode(url.host(), | 1804 load_state_host_ = net::IDNToUnicode(url.host(), |
| 1805 content::GetContentClient()->browser()->GetAcceptLangs(this)); | 1805 content::GetContentClient()->browser()->GetAcceptLangs(this)); |
| 1806 if (load_state_ == net::LOAD_STATE_READING_RESPONSE) | 1806 if (load_state_.state == net::LOAD_STATE_READING_RESPONSE) |
| 1807 SetNotWaitingForResponse(); | 1807 SetNotWaitingForResponse(); |
| 1808 if (IsLoading()) | 1808 if (IsLoading()) |
| 1809 NotifyNavigationStateChanged(INVALIDATE_LOAD | INVALIDATE_TAB); | 1809 NotifyNavigationStateChanged(INVALIDATE_LOAD | INVALIDATE_TAB); |
| 1810 } | 1810 } |
| 1811 | 1811 |
| 1812 void TabContents::WorkerCrashed() { | 1812 void TabContents::WorkerCrashed() { |
| 1813 if (delegate()) | 1813 if (delegate()) |
| 1814 delegate()->WorkerCrashed(this); | 1814 delegate()->WorkerCrashed(this); |
| 1815 } | 1815 } |
| 1816 | 1816 |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1912 } | 1912 } |
| 1913 | 1913 |
| 1914 void TabContents::SwapInRenderViewHost(RenderViewHost* rvh) { | 1914 void TabContents::SwapInRenderViewHost(RenderViewHost* rvh) { |
| 1915 render_manager_.SwapInRenderViewHost(rvh); | 1915 render_manager_.SwapInRenderViewHost(rvh); |
| 1916 } | 1916 } |
| 1917 | 1917 |
| 1918 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { | 1918 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { |
| 1919 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); | 1919 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); |
| 1920 rwh_view->SetSize(view()->GetContainerSize()); | 1920 rwh_view->SetSize(view()->GetContainerSize()); |
| 1921 } | 1921 } |
| OLD | NEW |