OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/web_contents/web_contents_impl.h" | 5 #include "content/browser/web_contents/web_contents_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 controller_(this, browser_context), | 327 controller_(this, browser_context), |
328 render_view_host_delegate_view_(NULL), | 328 render_view_host_delegate_view_(NULL), |
329 opener_(opener), | 329 opener_(opener), |
330 created_with_opener_(!!opener), | 330 created_with_opener_(!!opener), |
331 #if defined(OS_WIN) | 331 #if defined(OS_WIN) |
332 accessible_parent_(NULL), | 332 accessible_parent_(NULL), |
333 #endif | 333 #endif |
334 frame_tree_(new NavigatorImpl(&controller_, this), | 334 frame_tree_(new NavigatorImpl(&controller_, this), |
335 this, this, this, this), | 335 this, this, this, this), |
336 is_loading_(false), | 336 is_loading_(false), |
| 337 is_load_to_different_document_(false), |
337 crashed_status_(base::TERMINATION_STATUS_STILL_RUNNING), | 338 crashed_status_(base::TERMINATION_STATUS_STILL_RUNNING), |
338 crashed_error_code_(0), | 339 crashed_error_code_(0), |
339 waiting_for_response_(false), | 340 waiting_for_response_(false), |
340 load_state_(net::LOAD_STATE_IDLE, base::string16()), | 341 load_state_(net::LOAD_STATE_IDLE, base::string16()), |
341 loading_total_progress_(0.0), | 342 loading_total_progress_(0.0), |
342 loading_weak_factory_(this), | 343 loading_weak_factory_(this), |
343 loading_frames_in_progress_(0), | 344 loading_frames_in_progress_(0), |
344 upload_size_(0), | 345 upload_size_(0), |
345 upload_position_(0), | 346 upload_position_(0), |
346 displayed_insecure_content_(false), | 347 displayed_insecure_content_(false), |
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
839 RenderViewHost* dest_rvh = GetRenderManager()->pending_render_view_host() ? | 840 RenderViewHost* dest_rvh = GetRenderManager()->pending_render_view_host() ? |
840 GetRenderManager()->pending_render_view_host() : | 841 GetRenderManager()->pending_render_view_host() : |
841 GetRenderManager()->current_host(); | 842 GetRenderManager()->current_host(); |
842 return dest_rvh->GetSiteInstance(); | 843 return dest_rvh->GetSiteInstance(); |
843 } | 844 } |
844 | 845 |
845 bool WebContentsImpl::IsLoading() const { | 846 bool WebContentsImpl::IsLoading() const { |
846 return is_loading_; | 847 return is_loading_; |
847 } | 848 } |
848 | 849 |
| 850 bool WebContentsImpl::IsLoadingToDifferentDocument() const { |
| 851 return is_loading_ && is_load_to_different_document_; |
| 852 } |
| 853 |
849 bool WebContentsImpl::IsWaitingForResponse() const { | 854 bool WebContentsImpl::IsWaitingForResponse() const { |
850 return waiting_for_response_; | 855 return waiting_for_response_ && is_load_to_different_document_; |
851 } | 856 } |
852 | 857 |
853 const net::LoadStateWithParam& WebContentsImpl::GetLoadState() const { | 858 const net::LoadStateWithParam& WebContentsImpl::GetLoadState() const { |
854 return load_state_; | 859 return load_state_; |
855 } | 860 } |
856 | 861 |
857 const base::string16& WebContentsImpl::GetLoadStateHost() const { | 862 const base::string16& WebContentsImpl::GetLoadStateHost() const { |
858 return load_state_host_; | 863 return load_state_host_; |
859 } | 864 } |
860 | 865 |
(...skipping 2132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2993 base::string16()); | 2998 base::string16()); |
2994 load_state_host_.clear(); | 2999 load_state_host_.clear(); |
2995 upload_size_ = 0; | 3000 upload_size_ = 0; |
2996 upload_position_ = 0; | 3001 upload_position_ = 0; |
2997 } | 3002 } |
2998 | 3003 |
2999 GetRenderManager()->SetIsLoading(is_loading); | 3004 GetRenderManager()->SetIsLoading(is_loading); |
3000 | 3005 |
3001 is_loading_ = is_loading; | 3006 is_loading_ = is_loading; |
3002 waiting_for_response_ = is_loading; | 3007 waiting_for_response_ = is_loading; |
| 3008 is_load_to_different_document_ = to_different_document; |
3003 | 3009 |
3004 if (delegate_) | 3010 if (delegate_) |
3005 delegate_->LoadingStateChanged(this, to_different_document); | 3011 delegate_->LoadingStateChanged(this, to_different_document); |
3006 NotifyNavigationStateChanged(INVALIDATE_TYPE_LOAD); | 3012 NotifyNavigationStateChanged(INVALIDATE_TYPE_LOAD); |
3007 | 3013 |
3008 std::string url = (details ? details->url.possibly_invalid_spec() : "NULL"); | 3014 std::string url = (details ? details->url.possibly_invalid_spec() : "NULL"); |
3009 if (is_loading) { | 3015 if (is_loading) { |
3010 TRACE_EVENT_ASYNC_BEGIN1("browser", "WebContentsImpl Loading", this, | 3016 TRACE_EVENT_ASYNC_BEGIN1("browser", "WebContentsImpl Loading", this, |
3011 "URL", url); | 3017 "URL", url); |
3012 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 3018 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
(...skipping 1077 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4090 | 4096 |
4091 void WebContentsImpl::OnPreferredSizeChanged(const gfx::Size& old_size) { | 4097 void WebContentsImpl::OnPreferredSizeChanged(const gfx::Size& old_size) { |
4092 if (!delegate_) | 4098 if (!delegate_) |
4093 return; | 4099 return; |
4094 const gfx::Size new_size = GetPreferredSize(); | 4100 const gfx::Size new_size = GetPreferredSize(); |
4095 if (new_size != old_size) | 4101 if (new_size != old_size) |
4096 delegate_->UpdatePreferredSize(this, new_size); | 4102 delegate_->UpdatePreferredSize(this, new_size); |
4097 } | 4103 } |
4098 | 4104 |
4099 } // namespace content | 4105 } // namespace content |
OLD | NEW |