Chromium Code Reviews| 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, ""), |
| 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 868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1060 } | 1060 } |
| 1061 | 1061 |
| 1062 // Notifies the RenderWidgetHost instance about the fact that the page is | 1062 // Notifies the RenderWidgetHost instance about the fact that the page is |
| 1063 // loading, or done loading and calls the base implementation. | 1063 // loading, or done loading and calls the base implementation. |
| 1064 void TabContents::SetIsLoading(bool is_loading, | 1064 void TabContents::SetIsLoading(bool is_loading, |
| 1065 LoadNotificationDetails* details) { | 1065 LoadNotificationDetails* details) { |
| 1066 if (is_loading == is_loading_) | 1066 if (is_loading == is_loading_) |
| 1067 return; | 1067 return; |
| 1068 | 1068 |
| 1069 if (!is_loading) { | 1069 if (!is_loading) { |
| 1070 load_state_ = net::LOAD_STATE_IDLE; | 1070 load_state_.state = net::LOAD_STATE_IDLE; |
|
eroman
2011/08/05 01:54:22
nit: how about load_state_ = LoadStateWithParams(I
Matt Perry
2011/08/08 22:14:33
Done.
| |
| 1071 load_state_.param.clear(); | |
| 1071 load_state_host_.clear(); | 1072 load_state_host_.clear(); |
| 1072 upload_size_ = 0; | 1073 upload_size_ = 0; |
| 1073 upload_position_ = 0; | 1074 upload_position_ = 0; |
| 1074 } | 1075 } |
| 1075 | 1076 |
| 1076 render_manager_.SetIsLoading(is_loading); | 1077 render_manager_.SetIsLoading(is_loading); |
| 1077 | 1078 |
| 1078 is_loading_ = is_loading; | 1079 is_loading_ = is_loading; |
| 1079 waiting_for_response_ = is_loading; | 1080 waiting_for_response_ = is_loading; |
| 1080 | 1081 |
| (...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1765 if (delegate()) | 1766 if (delegate()) |
| 1766 delegate()->RendererUnresponsive(this); | 1767 delegate()->RendererUnresponsive(this); |
| 1767 } | 1768 } |
| 1768 | 1769 |
| 1769 void TabContents::RendererResponsive(RenderViewHost* render_view_host) { | 1770 void TabContents::RendererResponsive(RenderViewHost* render_view_host) { |
| 1770 if (delegate()) | 1771 if (delegate()) |
| 1771 delegate()->RendererResponsive(this); | 1772 delegate()->RendererResponsive(this); |
| 1772 } | 1773 } |
| 1773 | 1774 |
| 1774 void TabContents::LoadStateChanged(const GURL& url, | 1775 void TabContents::LoadStateChanged(const GURL& url, |
| 1775 net::LoadState load_state, | 1776 const net::LoadStateWithParam& load_state, |
| 1776 uint64 upload_position, | 1777 uint64 upload_position, |
| 1777 uint64 upload_size) { | 1778 uint64 upload_size) { |
| 1778 load_state_ = load_state; | 1779 load_state_ = load_state; |
| 1779 upload_position_ = upload_position; | 1780 upload_position_ = upload_position; |
| 1780 upload_size_ = upload_size; | 1781 upload_size_ = upload_size; |
| 1781 load_state_host_ = net::IDNToUnicode(url.host(), | 1782 load_state_host_ = net::IDNToUnicode(url.host(), |
| 1782 content::GetContentClient()->browser()->GetAcceptLangs(this)); | 1783 content::GetContentClient()->browser()->GetAcceptLangs(this)); |
| 1783 if (load_state_ == net::LOAD_STATE_READING_RESPONSE) | 1784 if (load_state_.state == net::LOAD_STATE_READING_RESPONSE) |
| 1784 SetNotWaitingForResponse(); | 1785 SetNotWaitingForResponse(); |
| 1785 if (IsLoading()) | 1786 if (IsLoading()) |
| 1786 NotifyNavigationStateChanged(INVALIDATE_LOAD | INVALIDATE_TAB); | 1787 NotifyNavigationStateChanged(INVALIDATE_LOAD | INVALIDATE_TAB); |
| 1787 } | 1788 } |
| 1788 | 1789 |
| 1789 void TabContents::WorkerCrashed() { | 1790 void TabContents::WorkerCrashed() { |
| 1790 if (delegate()) | 1791 if (delegate()) |
| 1791 delegate()->WorkerCrashed(this); | 1792 delegate()->WorkerCrashed(this); |
| 1792 } | 1793 } |
| 1793 | 1794 |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1889 } | 1890 } |
| 1890 | 1891 |
| 1891 void TabContents::SwapInRenderViewHost(RenderViewHost* rvh) { | 1892 void TabContents::SwapInRenderViewHost(RenderViewHost* rvh) { |
| 1892 render_manager_.SwapInRenderViewHost(rvh); | 1893 render_manager_.SwapInRenderViewHost(rvh); |
| 1893 } | 1894 } |
| 1894 | 1895 |
| 1895 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { | 1896 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { |
| 1896 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); | 1897 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); |
| 1897 rwh_view->SetSize(view()->GetContainerSize()); | 1898 rwh_view->SetSize(view()->GetContainerSize()); |
| 1898 } | 1899 } |
| OLD | NEW |