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

Side by Side Diff: content/browser/web_contents/navigation_controller_impl.h

Issue 21544005: Take the navigation type into account when checking if the navigation is in page. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Readability. Bringing back removed TC. Created 7 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
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 #ifndef CONTENT_BROWSER_WEB_CONTENTS_NAVIGATION_CONTROLLER_IMPL_H_ 5 #ifndef CONTENT_BROWSER_WEB_CONTENTS_NAVIGATION_CONTROLLER_IMPL_H_
6 #define CONTENT_BROWSER_WEB_CONTENTS_NAVIGATION_CONTROLLER_IMPL_H_ 6 #define CONTENT_BROWSER_WEB_CONTENTS_NAVIGATION_CONTROLLER_IMPL_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/gtest_prod_util.h" 10 #include "base/gtest_prod_util.h"
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 // pending and in page navigations only happen on committed pages. If there 148 // pending and in page navigations only happen on committed pages. If there
149 // is no last committed entry, then nothing will be in-page. 149 // is no last committed entry, then nothing will be in-page.
150 // 150 //
151 // Special note: if the URLs are the same, it does NOT automatically count as 151 // Special note: if the URLs are the same, it does NOT automatically count as
152 // an in-page navigation. Neither does an input URL that has no ref, even if 152 // an in-page navigation. Neither does an input URL that has no ref, even if
153 // the rest is the same. This may seem weird, but when we're considering 153 // the rest is the same. This may seem weird, but when we're considering
154 // whether a navigation happened without loading anything, the same URL could 154 // whether a navigation happened without loading anything, the same URL could
155 // be a reload, while only a different ref would be in-page (pages can't clear 155 // be a reload, while only a different ref would be in-page (pages can't clear
156 // refs without reload, only change to "#" which we don't count as empty). 156 // refs without reload, only change to "#" which we don't count as empty).
157 bool IsURLInPageNavigation(const GURL& url) const { 157 bool IsURLInPageNavigation(const GURL& url) const {
158 return IsURLInPageNavigation(url, false); 158 return IsURLInPageNavigation(url, false, NAVIGATION_TYPE_UNKNOWN);
159 } 159 }
160 160
161 // The situation is made murkier by history.replaceState(), which could 161 // The situation is made murkier by history.replaceState(), which could
162 // provide the same URL as part of an in-page navigation, not a reload. So 162 // provide the same URL as part of an in-page navigation, not a reload. So
163 // we need this form which lets the (untrustworthy) renderer resolve the 163 // we need this form which lets the (untrustworthy) renderer resolve the
164 // ambiguity, but only when the URLs are equal. This should be safe since the 164 // ambiguity, but only when the URLs are equal. This should be safe since the
165 // origin isn't changing. 165 // origin isn't changing.
166 bool IsURLInPageNavigation(const GURL& url, bool renderer_says_in_page) const; 166 bool IsURLInPageNavigation(
167 const GURL& url,
168 bool renderer_says_in_page,
169 NavigationType navigation_type) const;
167 170
168 // Sets the SessionStorageNamespace for the given |partition_id|. This is 171 // Sets the SessionStorageNamespace for the given |partition_id|. This is
169 // used during initialization of a new NavigationController to allow 172 // used during initialization of a new NavigationController to allow
170 // pre-population of the SessionStorageNamespace objects. Session restore, 173 // pre-population of the SessionStorageNamespace objects. Session restore,
171 // prerendering, and the implementaion of window.open() are the primary users 174 // prerendering, and the implementaion of window.open() are the primary users
172 // of this API. 175 // of this API.
173 // 176 //
174 // Calling this function when a SessionStorageNamespace has already been 177 // Calling this function when a SessionStorageNamespace has already been
175 // associated with a |partition_id| will CHECK() fail. 178 // associated with a |partition_id| will CHECK() fail.
176 void SetSessionStorageNamespace( 179 void SetSessionStorageNamespace(
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 TimeSmoother time_smoother_; 400 TimeSmoother time_smoother_;
398 401
399 scoped_ptr<WebContentsScreenshotManager> screenshot_manager_; 402 scoped_ptr<WebContentsScreenshotManager> screenshot_manager_;
400 403
401 DISALLOW_COPY_AND_ASSIGN(NavigationControllerImpl); 404 DISALLOW_COPY_AND_ASSIGN(NavigationControllerImpl);
402 }; 405 };
403 406
404 } // namespace content 407 } // namespace content
405 408
406 #endif // CONTENT_BROWSER_WEB_CONTENTS_NAVIGATION_CONTROLLER_IMPL_H_ 409 #endif // CONTENT_BROWSER_WEB_CONTENTS_NAVIGATION_CONTROLLER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698