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

Side by Side Diff: Source/core/loader/NavigationScheduler.cpp

Issue 1309883003: Add hooks for capturing meaningful text info, gently. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 4 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 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
4 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 4 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
5 * Copyright (C) 2009 Adam Barth. All rights reserved. 5 * Copyright (C) 2009 Adam Barth. All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 10 *
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 virtual ~ScheduledNavigation() { } 81 virtual ~ScheduledNavigation() { }
82 82
83 virtual void fire(LocalFrame*) = 0; 83 virtual void fire(LocalFrame*) = 0;
84 84
85 virtual bool shouldStartTimer(LocalFrame*) { return true; } 85 virtual bool shouldStartTimer(LocalFrame*) { return true; }
86 86
87 double delay() const { return m_delay; } 87 double delay() const { return m_delay; }
88 Document* originDocument() const { return m_originDocument.get(); } 88 Document* originDocument() const { return m_originDocument.get(); }
89 bool replacesCurrentItem() const { return m_replacesCurrentItem; } 89 bool replacesCurrentItem() const { return m_replacesCurrentItem; }
90 bool isLocationChange() const { return m_isLocationChange; } 90 bool isLocationChange() const { return m_isLocationChange; }
91 virtual bool isRedirect() const { return false; }
91 PassOwnPtr<UserGestureIndicator> createUserGestureIndicator() 92 PassOwnPtr<UserGestureIndicator> createUserGestureIndicator()
92 { 93 {
93 if (m_wasUserGesture && m_userGestureToken) 94 if (m_wasUserGesture && m_userGestureToken)
94 return adoptPtr(new UserGestureIndicator(m_userGestureToken)); 95 return adoptPtr(new UserGestureIndicator(m_userGestureToken));
95 return adoptPtr(new UserGestureIndicator(DefinitelyNotProcessingUserGest ure)); 96 return adoptPtr(new UserGestureIndicator(DefinitelyNotProcessingUserGest ure));
96 } 97 }
97 98
98 DEFINE_INLINE_VIRTUAL_TRACE() 99 DEFINE_INLINE_VIRTUAL_TRACE()
99 { 100 {
100 visitor->trace(m_originDocument); 101 visitor->trace(m_originDocument);
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 void fire(LocalFrame* frame) override 152 void fire(LocalFrame* frame) override
152 { 153 {
153 OwnPtr<UserGestureIndicator> gestureIndicator = createUserGestureIndicat or(); 154 OwnPtr<UserGestureIndicator> gestureIndicator = createUserGestureIndicat or();
154 FrameLoadRequest request(originDocument(), url(), "_self"); 155 FrameLoadRequest request(originDocument(), url(), "_self");
155 request.setReplacesCurrentItem(replacesCurrentItem()); 156 request.setReplacesCurrentItem(replacesCurrentItem());
156 if (equalIgnoringFragmentIdentifier(frame->document()->url(), request.re sourceRequest().url())) 157 if (equalIgnoringFragmentIdentifier(frame->document()->url(), request.re sourceRequest().url()))
157 request.resourceRequest().setCachePolicy(ReloadIgnoringCacheData); 158 request.resourceRequest().setCachePolicy(ReloadIgnoringCacheData);
158 request.setClientRedirect(ClientRedirect); 159 request.setClientRedirect(ClientRedirect);
159 frame->loader().load(request); 160 frame->loader().load(request);
160 } 161 }
162
163 bool isRedirect() const override { return true; }
164
161 private: 165 private:
162 ScheduledRedirect(double delay, Document* originDocument, const String& url, bool replacesCurrentItem) 166 ScheduledRedirect(double delay, Document* originDocument, const String& url, bool replacesCurrentItem)
163 : ScheduledURLNavigation(delay, originDocument, url, replacesCurrentItem , false) 167 : ScheduledURLNavigation(delay, originDocument, url, replacesCurrentItem , false)
164 { 168 {
165 clearUserGesture(); 169 clearUserGesture();
166 } 170 }
167 }; 171 };
168 172
169 class ScheduledLocationChange final : public ScheduledURLNavigation { 173 class ScheduledLocationChange final : public ScheduledURLNavigation {
170 public: 174 public:
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 276
273 NavigationScheduler::~NavigationScheduler() 277 NavigationScheduler::~NavigationScheduler()
274 { 278 {
275 } 279 }
276 280
277 bool NavigationScheduler::locationChangePending() 281 bool NavigationScheduler::locationChangePending()
278 { 282 {
279 return m_redirect && m_redirect->isLocationChange(); 283 return m_redirect && m_redirect->isLocationChange();
280 } 284 }
281 285
286 bool NavigationScheduler::isRedirect() const
287 {
288 return m_redirect && m_redirect->isRedirect();
289 }
290
282 inline bool NavigationScheduler::shouldScheduleReload() const 291 inline bool NavigationScheduler::shouldScheduleReload() const
283 { 292 {
284 return m_frame->page() && isFrameNavigationAllowed() && NavigationDisablerFo rBeforeUnload::isNavigationAllowed(); 293 return m_frame->page() && isFrameNavigationAllowed() && NavigationDisablerFo rBeforeUnload::isNavigationAllowed();
285 } 294 }
286 295
287 inline bool NavigationScheduler::shouldScheduleNavigation(const String& url) con st 296 inline bool NavigationScheduler::shouldScheduleNavigation(const String& url) con st
288 { 297 {
289 return m_frame->page() && isFrameNavigationAllowed() && (protocolIsJavaScrip t(url) || NavigationDisablerForBeforeUnload::isNavigationAllowed()); 298 return m_frame->page() && isFrameNavigationAllowed() && (protocolIsJavaScrip t(url) || NavigationDisablerForBeforeUnload::isNavigationAllowed());
290 } 299 }
291 300
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 m_redirect.clear(); 433 m_redirect.clear();
425 } 434 }
426 435
427 DEFINE_TRACE(NavigationScheduler) 436 DEFINE_TRACE(NavigationScheduler)
428 { 437 {
429 visitor->trace(m_frame); 438 visitor->trace(m_frame);
430 visitor->trace(m_redirect); 439 visitor->trace(m_redirect);
431 } 440 }
432 441
433 } // namespace blink 442 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698