Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Side by Side Diff: content/renderer/render_view_impl.cc

Issue 180113003: Prepare for per frame did{Start,Stop}Loading calls (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/renderer/render_view_impl.h" 5 #include "content/renderer/render_view_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after
750 750
751 RenderViewImpl::RenderViewImpl(RenderViewImplParams* params) 751 RenderViewImpl::RenderViewImpl(RenderViewImplParams* params)
752 : RenderWidget(blink::WebPopupTypeNone, 752 : RenderWidget(blink::WebPopupTypeNone,
753 params->screen_info, 753 params->screen_info,
754 params->swapped_out, 754 params->swapped_out,
755 params->hidden), 755 params->hidden),
756 webkit_preferences_(params->webkit_prefs), 756 webkit_preferences_(params->webkit_prefs),
757 send_content_state_immediately_(false), 757 send_content_state_immediately_(false),
758 enabled_bindings_(0), 758 enabled_bindings_(0),
759 send_preferred_size_changes_(false), 759 send_preferred_size_changes_(false),
760 is_loading_(false),
761 navigation_gesture_(NavigationGestureUnknown), 760 navigation_gesture_(NavigationGestureUnknown),
762 opened_by_user_gesture_(true), 761 opened_by_user_gesture_(true),
763 opener_suppressed_(false), 762 opener_suppressed_(false),
764 suppress_dialogs_until_swap_out_(false), 763 suppress_dialogs_until_swap_out_(false),
765 page_id_(-1), 764 page_id_(-1),
766 last_page_id_sent_to_browser_(-1), 765 last_page_id_sent_to_browser_(-1),
767 next_page_id_(params->next_page_id), 766 next_page_id_(params->next_page_id),
768 history_list_offset_(-1), 767 history_list_offset_(-1),
769 history_list_length_(0), 768 history_list_length_(0),
770 target_url_status_(TARGET_NONE), 769 target_url_status_(TARGET_NONE),
(...skipping 1402 matching lines...) Expand 10 before | Expand all | Expand 10 after
2173 WebFileChooserCompletion* chooser_completion) { 2172 WebFileChooserCompletion* chooser_completion) {
2174 int id = enumeration_completion_id_++; 2173 int id = enumeration_completion_id_++;
2175 enumeration_completions_[id] = chooser_completion; 2174 enumeration_completions_[id] = chooser_completion;
2176 return Send(new ViewHostMsg_EnumerateDirectory( 2175 return Send(new ViewHostMsg_EnumerateDirectory(
2177 routing_id_, 2176 routing_id_,
2178 id, 2177 id,
2179 base::FilePath::FromUTF16Unsafe(path))); 2178 base::FilePath::FromUTF16Unsafe(path)));
2180 } 2179 }
2181 2180
2182 void RenderViewImpl::didStartLoading(bool to_different_document) { 2181 void RenderViewImpl::didStartLoading(bool to_different_document) {
2183 didStartLoading(); 2182 main_render_frame_->didStartLoading(to_different_document);
2184 } 2183 }
2185 2184
2186 void RenderViewImpl::didStartLoading() { 2185 void RenderViewImpl::didStopLoading() {
2187 if (is_loading_) { 2186 main_render_frame_->didStopLoading();
2188 DVLOG(1) << "didStartLoading called while loading"; 2187 }
2189 return; 2188
2189 void RenderViewImpl::didStartLoading(WebFrame* frame) {
2190 if (load_progress_tracker_ != NULL) {
2191 load_progress_tracker_->DidStartLoading(
2192 RenderFrameImpl::FromWebFrame(frame));
2190 } 2193 }
2191
2192 is_loading_ = true;
2193
2194 // Send the IPC message through the top-level frame.
2195 main_render_frame_->didStartLoading();
2196
2197 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidStartLoading()); 2194 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidStartLoading());
2198 } 2195 }
2199 2196
2200 void RenderViewImpl::didStopLoading() { 2197 void RenderViewImpl::didStopLoading(WebFrame* frame) {
2201 if (!is_loading_) { 2198 if (load_progress_tracker_ != NULL) {
2202 DVLOG(1) << "DidStopLoading called while not loading"; 2199 load_progress_tracker_->DidStopLoading(
2203 return; 2200 RenderFrameImpl::FromWebFrame(frame));
2204 } 2201 }
2205 2202
2206 is_loading_ = false;
2207
2208 // NOTE: For now we're doing the safest thing, and sending out notification
2209 // when done loading. This currently isn't an issue as the favicon is only
2210 // displayed when done loading. Ideally we would send notification when
2211 // finished parsing the head, but webkit doesn't support that yet.
2212 // The feed discovery code would also benefit from access to the head.
2213 // NOTE: Sending of the IPC message happens through the top-level frame.
2214 main_render_frame_->didStopLoading();
2215
2216 if (load_progress_tracker_ != NULL)
2217 load_progress_tracker_->DidStopLoading();
2218
2219 DidStopLoadingIcons(); 2203 DidStopLoadingIcons();
2220 2204
2221 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidStopLoading()); 2205 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidStopLoading());
2222 } 2206 }
2223 2207
2224 void RenderViewImpl::didChangeLoadProgress(WebFrame* frame, 2208 void RenderViewImpl::didChangeLoadProgress(WebFrame* frame,
2225 double load_progress) { 2209 double load_progress) {
2226 if (load_progress_tracker_ != NULL) 2210 if (load_progress_tracker_ != NULL) {
2227 load_progress_tracker_->DidChangeLoadProgress(frame, load_progress); 2211 load_progress_tracker_->DidChangeLoadProgress(
2212 RenderFrameImpl::FromWebFrame(frame), load_progress);
2213 }
2228 } 2214 }
2229 2215
2230 void RenderViewImpl::didCancelCompositionOnSelectionChange() { 2216 void RenderViewImpl::didCancelCompositionOnSelectionChange() {
2231 Send(new ViewHostMsg_ImeCancelComposition(routing_id())); 2217 Send(new ViewHostMsg_ImeCancelComposition(routing_id()));
2232 } 2218 }
2233 2219
2234 void RenderViewImpl::didChangeSelection(bool is_empty_selection) { 2220 void RenderViewImpl::didChangeSelection(bool is_empty_selection) {
2235 if (!handling_input_event_ && !handling_select_range_) 2221 if (!handling_input_event_ && !handling_select_range_)
2236 return; 2222 return;
2237 2223
(...skipping 1574 matching lines...) Expand 10 before | Expand all | Expand 10 after
3812 blink::WebPageVisibilityState RenderViewImpl::GetVisibilityState() const { 3798 blink::WebPageVisibilityState RenderViewImpl::GetVisibilityState() const {
3813 return visibilityState(); 3799 return visibilityState();
3814 } 3800 }
3815 3801
3816 void RenderViewImpl::RunModalAlertDialog(blink::WebFrame* frame, 3802 void RenderViewImpl::RunModalAlertDialog(blink::WebFrame* frame,
3817 const blink::WebString& message) { 3803 const blink::WebString& message) {
3818 return runModalAlertDialog(frame, message); 3804 return runModalAlertDialog(frame, message);
3819 } 3805 }
3820 3806
3821 void RenderViewImpl::DidStartLoading() { 3807 void RenderViewImpl::DidStartLoading() {
3822 didStartLoading(); 3808 main_render_frame_->didStartLoading(true);
3823 } 3809 }
3824 3810
3825 void RenderViewImpl::DidStopLoading() { 3811 void RenderViewImpl::DidStopLoading() {
3826 didStopLoading(); 3812 main_render_frame_->didStopLoading();
3827 } 3813 }
3828 3814
3829 void RenderViewImpl::DidPlay(blink::WebMediaPlayer* player) { 3815 void RenderViewImpl::DidPlay(blink::WebMediaPlayer* player) {
3830 Send(new ViewHostMsg_MediaPlayingNotification(routing_id_, 3816 Send(new ViewHostMsg_MediaPlayingNotification(routing_id_,
3831 reinterpret_cast<int64>(player), 3817 reinterpret_cast<int64>(player),
3832 player->hasVideo(), 3818 player->hasVideo(),
3833 player->hasAudio())); 3819 player->hasAudio()));
3834 } 3820 }
3835 3821
3836 void RenderViewImpl::DidPause(blink::WebMediaPlayer* player) { 3822 void RenderViewImpl::DidPause(blink::WebMediaPlayer* player) {
(...skipping 1908 matching lines...) Expand 10 before | Expand all | Expand 10 after
5745 for (size_t i = 0; i < icon_urls.size(); i++) { 5731 for (size_t i = 0; i < icon_urls.size(); i++) {
5746 WebURL url = icon_urls[i].iconURL(); 5732 WebURL url = icon_urls[i].iconURL();
5747 if (!url.isEmpty()) 5733 if (!url.isEmpty())
5748 urls.push_back(FaviconURL(url, 5734 urls.push_back(FaviconURL(url,
5749 ToFaviconType(icon_urls[i].iconType()))); 5735 ToFaviconType(icon_urls[i].iconType())));
5750 } 5736 }
5751 SendUpdateFaviconURL(urls); 5737 SendUpdateFaviconURL(urls);
5752 } 5738 }
5753 5739
5754 } // namespace content 5740 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698