OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/renderer/render_frame_impl.h" | 5 #include "content/renderer/render_frame_impl.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 RenderFrameImpl* (*create_render_frame_impl)(RenderViewImpl*, int32)) { | 177 RenderFrameImpl* (*create_render_frame_impl)(RenderViewImpl*, int32)) { |
178 CHECK(!g_create_render_frame_impl); | 178 CHECK(!g_create_render_frame_impl); |
179 g_create_render_frame_impl = create_render_frame_impl; | 179 g_create_render_frame_impl = create_render_frame_impl; |
180 } | 180 } |
181 | 181 |
182 // RenderFrameImpl ---------------------------------------------------------- | 182 // RenderFrameImpl ---------------------------------------------------------- |
183 RenderFrameImpl::RenderFrameImpl(RenderViewImpl* render_view, int routing_id) | 183 RenderFrameImpl::RenderFrameImpl(RenderViewImpl* render_view, int routing_id) |
184 : frame_(NULL), | 184 : frame_(NULL), |
185 render_view_(render_view->AsWeakPtr()), | 185 render_view_(render_view->AsWeakPtr()), |
186 routing_id_(routing_id), | 186 routing_id_(routing_id), |
| 187 is_loading_(false), |
187 is_swapped_out_(false), | 188 is_swapped_out_(false), |
188 is_detaching_(false), | 189 is_detaching_(false), |
189 cookie_jar_(this) { | 190 cookie_jar_(this) { |
190 RenderThread::Get()->AddRoute(routing_id_, this); | 191 RenderThread::Get()->AddRoute(routing_id_, this); |
191 } | 192 } |
192 | 193 |
193 RenderFrameImpl::~RenderFrameImpl() { | 194 RenderFrameImpl::~RenderFrameImpl() { |
194 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, RenderFrameGone()); | 195 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, RenderFrameGone()); |
195 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, OnDestruct()); | 196 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, OnDestruct()); |
196 RenderThread::Get()->RemoveRoute(routing_id_); | 197 RenderThread::Get()->RemoveRoute(routing_id_); |
(...skipping 1819 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2016 | 2017 |
2017 render_view_->last_page_id_sent_to_browser_ = | 2018 render_view_->last_page_id_sent_to_browser_ = |
2018 std::max(render_view_->last_page_id_sent_to_browser_, | 2019 std::max(render_view_->last_page_id_sent_to_browser_, |
2019 render_view_->page_id_); | 2020 render_view_->page_id_); |
2020 | 2021 |
2021 // If we end up reusing this WebRequest (for example, due to a #ref click), | 2022 // If we end up reusing this WebRequest (for example, due to a #ref click), |
2022 // we don't want the transition type to persist. Just clear it. | 2023 // we don't want the transition type to persist. Just clear it. |
2023 navigation_state->set_transition_type(PAGE_TRANSITION_LINK); | 2024 navigation_state->set_transition_type(PAGE_TRANSITION_LINK); |
2024 } | 2025 } |
2025 | 2026 |
2026 void RenderFrameImpl::didStartLoading() { | 2027 void RenderFrameImpl::didStartLoading(bool to_different_document) { |
| 2028 if (is_loading_) { |
| 2029 DVLOG(1) << "didStartLoading called while loading"; |
| 2030 return; |
| 2031 } |
| 2032 |
| 2033 is_loading_ = true; |
| 2034 |
| 2035 render_view_->didStartLoading(frame_); |
| 2036 |
2027 Send(new FrameHostMsg_DidStartLoading(routing_id_)); | 2037 Send(new FrameHostMsg_DidStartLoading(routing_id_)); |
2028 } | 2038 } |
2029 | 2039 |
2030 void RenderFrameImpl::didStopLoading() { | 2040 void RenderFrameImpl::didStopLoading() { |
| 2041 if (!is_loading_) { |
| 2042 DVLOG(1) << "DidStopLoading called while not loading"; |
| 2043 return; |
| 2044 } |
| 2045 |
| 2046 is_loading_ = false; |
| 2047 |
| 2048 render_view_->didStopLoading(frame_); |
| 2049 |
| 2050 // NOTE: For now we're doing the safest thing, and sending out notification |
| 2051 // when done loading. This currently isn't an issue as the favicon is only |
| 2052 // displayed when done loading. Ideally we would send notification when |
| 2053 // finished parsing the head, but webkit doesn't support that yet. |
| 2054 // The feed discovery code would also benefit from access to the head. |
| 2055 // NOTE: Sending of the IPC message happens through the top-level frame. |
2031 Send(new FrameHostMsg_DidStopLoading(routing_id_)); | 2056 Send(new FrameHostMsg_DidStopLoading(routing_id_)); |
2032 } | 2057 } |
2033 | 2058 |
| 2059 void RenderFrameImpl::didChangeLoadProgress(double load_progress) { |
| 2060 render_view_->didChangeLoadProgress(frame_, load_progress); |
| 2061 } |
| 2062 |
2034 } // namespace content | 2063 } // namespace content |
OLD | NEW |