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

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
« no previous file with comments | « content/renderer/render_view_impl.h ('k') | content/shell/renderer/test_runner/WebTestProxy.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 646 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 657
658 RenderViewImpl::RenderViewImpl(RenderViewImplParams* params) 658 RenderViewImpl::RenderViewImpl(RenderViewImplParams* params)
659 : RenderWidget(blink::WebPopupTypeNone, 659 : RenderWidget(blink::WebPopupTypeNone,
660 params->screen_info, 660 params->screen_info,
661 params->swapped_out, 661 params->swapped_out,
662 params->hidden), 662 params->hidden),
663 webkit_preferences_(params->webkit_prefs), 663 webkit_preferences_(params->webkit_prefs),
664 send_content_state_immediately_(false), 664 send_content_state_immediately_(false),
665 enabled_bindings_(0), 665 enabled_bindings_(0),
666 send_preferred_size_changes_(false), 666 send_preferred_size_changes_(false),
667 is_loading_(false),
668 navigation_gesture_(NavigationGestureUnknown), 667 navigation_gesture_(NavigationGestureUnknown),
669 opened_by_user_gesture_(true), 668 opened_by_user_gesture_(true),
670 opener_suppressed_(false), 669 opener_suppressed_(false),
671 suppress_dialogs_until_swap_out_(false), 670 suppress_dialogs_until_swap_out_(false),
672 page_id_(-1), 671 page_id_(-1),
673 last_page_id_sent_to_browser_(-1), 672 last_page_id_sent_to_browser_(-1),
674 next_page_id_(params->next_page_id), 673 next_page_id_(params->next_page_id),
675 history_list_offset_(-1), 674 history_list_offset_(-1),
676 history_list_length_(0), 675 history_list_length_(0),
677 target_url_status_(TARGET_NONE), 676 target_url_status_(TARGET_NONE),
(...skipping 1159 matching lines...) Expand 10 before | Expand all | Expand 10 after
1837 WebFileChooserCompletion* chooser_completion) { 1836 WebFileChooserCompletion* chooser_completion) {
1838 int id = enumeration_completion_id_++; 1837 int id = enumeration_completion_id_++;
1839 enumeration_completions_[id] = chooser_completion; 1838 enumeration_completions_[id] = chooser_completion;
1840 return Send(new ViewHostMsg_EnumerateDirectory( 1839 return Send(new ViewHostMsg_EnumerateDirectory(
1841 routing_id_, 1840 routing_id_,
1842 id, 1841 id,
1843 base::FilePath::FromUTF16Unsafe(path))); 1842 base::FilePath::FromUTF16Unsafe(path)));
1844 } 1843 }
1845 1844
1846 void RenderViewImpl::didStartLoading(bool to_different_document) { 1845 void RenderViewImpl::didStartLoading(bool to_different_document) {
1847 didStartLoading(); 1846 main_render_frame_->didStartLoading(to_different_document);
1848 } 1847 }
1849 1848
1850 void RenderViewImpl::didStartLoading() { 1849 void RenderViewImpl::didStopLoading() {
1851 if (is_loading_) { 1850 main_render_frame_->didStopLoading();
1852 DVLOG(1) << "didStartLoading called while loading"; 1851 }
1853 return; 1852
1853 void RenderViewImpl::didStartLoading(WebFrame* frame) {
1854 if (load_progress_tracker_ != NULL) {
1855 load_progress_tracker_->DidStartLoading(
1856 RenderFrameImpl::FromWebFrame(frame)->GetRoutingID());
1854 } 1857 }
1855
1856 is_loading_ = true;
1857
1858 // Send the IPC message through the top-level frame.
1859 main_render_frame_->didStartLoading();
1860
1861 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidStartLoading()); 1858 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidStartLoading());
1862 } 1859 }
1863 1860
1864 void RenderViewImpl::didStopLoading() { 1861 void RenderViewImpl::didStopLoading(WebFrame* frame) {
1865 if (!is_loading_) { 1862 if (load_progress_tracker_ != NULL) {
1866 DVLOG(1) << "DidStopLoading called while not loading"; 1863 load_progress_tracker_->DidStopLoading(
1867 return; 1864 RenderFrameImpl::FromWebFrame(frame)->GetRoutingID());
1868 } 1865 }
1869 1866
1870 is_loading_ = false;
1871
1872 // NOTE: For now we're doing the safest thing, and sending out notification
1873 // when done loading. This currently isn't an issue as the favicon is only
1874 // displayed when done loading. Ideally we would send notification when
1875 // finished parsing the head, but webkit doesn't support that yet.
1876 // The feed discovery code would also benefit from access to the head.
1877 // NOTE: Sending of the IPC message happens through the top-level frame.
1878 main_render_frame_->didStopLoading();
1879
1880 if (load_progress_tracker_ != NULL)
1881 load_progress_tracker_->DidStopLoading();
1882
1883 DidStopLoadingIcons(); 1867 DidStopLoadingIcons();
1884 1868
1885 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidStopLoading()); 1869 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidStopLoading());
1886 } 1870 }
1887 1871
1888 void RenderViewImpl::didChangeLoadProgress(WebFrame* frame, 1872 void RenderViewImpl::didChangeLoadProgress(WebFrame* frame,
1889 double load_progress) { 1873 double load_progress) {
1890 if (load_progress_tracker_ != NULL) 1874 if (load_progress_tracker_ != NULL) {
1891 load_progress_tracker_->DidChangeLoadProgress(frame, load_progress); 1875 load_progress_tracker_->DidChangeLoadProgress(
1876 RenderFrameImpl::FromWebFrame(frame)->GetRoutingID(), load_progress);
1877 }
1892 } 1878 }
1893 1879
1894 void RenderViewImpl::didCancelCompositionOnSelectionChange() { 1880 void RenderViewImpl::didCancelCompositionOnSelectionChange() {
1895 Send(new ViewHostMsg_ImeCancelComposition(routing_id())); 1881 Send(new ViewHostMsg_ImeCancelComposition(routing_id()));
1896 } 1882 }
1897 1883
1898 void RenderViewImpl::didChangeSelection(bool is_empty_selection) { 1884 void RenderViewImpl::didChangeSelection(bool is_empty_selection) {
1899 if (!handling_input_event_ && !handling_select_range_) 1885 if (!handling_input_event_ && !handling_select_range_)
1900 return; 1886 return;
1901 1887
(...skipping 1345 matching lines...) Expand 10 before | Expand all | Expand 10 after
3247 blink::WebPageVisibilityState RenderViewImpl::GetVisibilityState() const { 3233 blink::WebPageVisibilityState RenderViewImpl::GetVisibilityState() const {
3248 return visibilityState(); 3234 return visibilityState();
3249 } 3235 }
3250 3236
3251 void RenderViewImpl::RunModalAlertDialog(blink::WebFrame* frame, 3237 void RenderViewImpl::RunModalAlertDialog(blink::WebFrame* frame,
3252 const blink::WebString& message) { 3238 const blink::WebString& message) {
3253 return runModalAlertDialog(frame, message); 3239 return runModalAlertDialog(frame, message);
3254 } 3240 }
3255 3241
3256 void RenderViewImpl::DidStartLoading() { 3242 void RenderViewImpl::DidStartLoading() {
3257 didStartLoading(); 3243 main_render_frame_->didStartLoading(true);
3258 } 3244 }
3259 3245
3260 void RenderViewImpl::DidStopLoading() { 3246 void RenderViewImpl::DidStopLoading() {
3261 didStopLoading(); 3247 main_render_frame_->didStopLoading();
3262 } 3248 }
3263 3249
3264 void RenderViewImpl::DidPlay(blink::WebMediaPlayer* player) { 3250 void RenderViewImpl::DidPlay(blink::WebMediaPlayer* player) {
3265 Send(new ViewHostMsg_MediaPlayingNotification(routing_id_, 3251 Send(new ViewHostMsg_MediaPlayingNotification(routing_id_,
3266 reinterpret_cast<int64>(player), 3252 reinterpret_cast<int64>(player),
3267 player->hasVideo(), 3253 player->hasVideo(),
3268 player->hasAudio())); 3254 player->hasAudio()));
3269 } 3255 }
3270 3256
3271 void RenderViewImpl::DidPause(blink::WebMediaPlayer* player) { 3257 void RenderViewImpl::DidPause(blink::WebMediaPlayer* player) {
(...skipping 1869 matching lines...) Expand 10 before | Expand all | Expand 10 after
5141 for (size_t i = 0; i < icon_urls.size(); i++) { 5127 for (size_t i = 0; i < icon_urls.size(); i++) {
5142 WebURL url = icon_urls[i].iconURL(); 5128 WebURL url = icon_urls[i].iconURL();
5143 if (!url.isEmpty()) 5129 if (!url.isEmpty())
5144 urls.push_back(FaviconURL(url, 5130 urls.push_back(FaviconURL(url,
5145 ToFaviconType(icon_urls[i].iconType()))); 5131 ToFaviconType(icon_urls[i].iconType())));
5146 } 5132 }
5147 SendUpdateFaviconURL(urls); 5133 SendUpdateFaviconURL(urls);
5148 } 5134 }
5149 5135
5150 } // namespace content 5136 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_view_impl.h ('k') | content/shell/renderer/test_runner/WebTestProxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698