summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoreugenebut <eugenebut@chromium.org>2016-03-26 02:15:37 -0700
committerCommit bot <commit-bot@chromium.org>2016-03-26 09:17:49 +0000
commit2aca722505ea2a9a2fce3372978e210013e7c946 (patch)
treef0647af2e64db8577d345b6fca9f2979fb1c15ee
parent043ab27b4a422d665580b12b588cba2d47afc387 (diff)
downloadchromium_src-master.zip
chromium_src-master.tar.gz
chromium_src-master.tar.bz2
[ios] Removed RequestTracker dependency from WebLoadParams.HEADmaster
WKWebView does not allow controlling the cache so cache_mode load param is not used. BUG=597990 Review URL: https://codereview.chromium.org/1836543002 Cr-Commit-Position: refs/heads/master@{#383452}
-rw-r--r--ios/web/navigation/web_load_params.h13
-rw-r--r--ios/web/navigation/web_load_params.mm3
-rw-r--r--ios/web/web_state/ui/crw_web_controller.mm34
-rw-r--r--ios/web/web_state/web_state_impl.h9
-rw-r--r--ios/web/web_state/web_state_impl.mm9
5 files changed, 5 insertions, 63 deletions
diff --git a/ios/web/navigation/web_load_params.h b/ios/web/navigation/web_load_params.h
index 0fea4df..427cb2f 100644
--- a/ios/web/navigation/web_load_params.h
+++ b/ios/web/navigation/web_load_params.h
@@ -8,18 +8,16 @@
#import <Foundation/Foundation.h>
#import "base/mac/scoped_nsobject.h"
-#include "ios/net/request_tracker.h"
#include "ios/web/public/referrer.h"
#include "ui/base/page_transition_types.h"
#include "url/gurl.h"
namespace web {
-// Parameters for creating a tab. Most paramaters are optional, and
-// can be left at the default values set by the constructor.
-// TODO(stuartmorgan): Remove the dependency on RequestTracker, then move
-// this into NavigationManager to parallel NavigationController's
-// LoadURLParams (which this is modeled after).
+// Parameters for URL loading. Most parameters are optional, and can be left at
+// the default values set by the constructor.
+// TODO(crbug.com/597990): Move this into NavigationManager to parallel
+// NavigationController's LoadURLParams (which this is modeled after).
struct WebLoadParams {
public:
// The URL to load. Must be set.
@@ -35,9 +33,6 @@ struct WebLoadParams {
// important for tracking whether to display pending URLs.
bool is_renderer_initiated;
- // The cache mode to load with. Defaults to CACHE_NORMAL.
- net::RequestTracker::CacheMode cache_mode;
-
// Any extra HTTP headers to add to the load.
base::scoped_nsobject<NSDictionary> extra_headers;
diff --git a/ios/web/navigation/web_load_params.mm b/ios/web/navigation/web_load_params.mm
index 2c5a82c..ddb6067 100644
--- a/ios/web/navigation/web_load_params.mm
+++ b/ios/web/navigation/web_load_params.mm
@@ -10,7 +10,6 @@ WebLoadParams::WebLoadParams(const GURL& url)
: url(url),
transition_type(ui::PAGE_TRANSITION_LINK),
is_renderer_initiated(false),
- cache_mode(net::RequestTracker::CACHE_NORMAL),
post_data(NULL) {
}
@@ -21,7 +20,6 @@ WebLoadParams::WebLoadParams(const WebLoadParams& other)
referrer(other.referrer),
transition_type(other.transition_type),
is_renderer_initiated(other.is_renderer_initiated),
- cache_mode(other.cache_mode),
extra_headers([other.extra_headers copy]),
post_data([other.post_data copy]) {
}
@@ -32,7 +30,6 @@ WebLoadParams& WebLoadParams::operator=(
referrer = other.referrer;
is_renderer_initiated = other.is_renderer_initiated;
transition_type = other.transition_type;
- cache_mode = other.cache_mode;
extra_headers.reset([other.extra_headers copy]);
post_data.reset([other.post_data copy]);
diff --git a/ios/web/web_state/ui/crw_web_controller.mm b/ios/web/web_state/ui/crw_web_controller.mm
index d47b34a..62591e7 100644
--- a/ios/web/web_state/ui/crw_web_controller.mm
+++ b/ios/web/web_state/ui/crw_web_controller.mm
@@ -1222,11 +1222,6 @@ const NSTimeInterval kSnapshotOverlayTransition = 0.5;
[self recordStateInHistory];
}
- // If the web view had been discarded, and this request is to load that
- // URL again, then it's a rebuild and should use the cache.
- BOOL preferCache = _expectedReconstructionURL.is_valid() &&
- _expectedReconstructionURL == requestURL;
-
[_delegate webWillAddPendingURL:requestURL transition:transition];
// Add or update pending url.
if (_webStateImpl->GetNavigationManagerImpl().GetPendingItem()) {
@@ -1240,15 +1235,6 @@ const NSTimeInterval kSnapshotOverlayTransition = 0.5;
transition:transition
rendererInitiated:YES];
}
- // Update the cache mode for all the network requests issued by this web view.
- // The mode is reset to CACHE_NORMAL after each page load.
- if (_webStateImpl->GetCacheMode() != net::RequestTracker::CACHE_NORMAL) {
- _webStateImpl->GetRequestTracker()->SetCacheModeFromUIThread(
- _webStateImpl->GetCacheMode());
- } else if (preferCache) {
- _webStateImpl->GetRequestTracker()->SetCacheModeFromUIThread(
- net::RequestTracker::CACHE_HISTORY);
- }
_webStateImpl->SetIsLoading(true);
[_delegate webDidAddPendingURL];
_webStateImpl->OnProvisionalNavigationStarted(requestURL);
@@ -1456,19 +1442,7 @@ const NSTimeInterval kSnapshotOverlayTransition = 0.5;
[_delegate webDidUpdateSessionForLoadWithParams:params
wasInitialNavigation:initialNavigation];
- // If a non-default cache mode is passed in, it takes precedence over
- // |reload|.
- const BOOL reload = [self shouldReload:navUrl transition:transition];
- if (params.cache_mode != net::RequestTracker::CACHE_NORMAL) {
- _webStateImpl->SetCacheMode(params.cache_mode);
- } else if (reload) {
- _webStateImpl->SetCacheMode(net::RequestTracker::CACHE_RELOAD);
- }
-
[self loadCurrentURL];
-
- // Change the cache mode back to CACHE_NORMAL after a reload.
- _webStateImpl->SetCacheMode(net::RequestTracker::CACHE_NORMAL);
}
- (void)loadCurrentURL {
@@ -1617,10 +1591,7 @@ const NSTimeInterval kSnapshotOverlayTransition = 0.5;
- (void)reload {
[_delegate webWillReload];
-
- _webStateImpl->SetCacheMode(net::RequestTracker::CACHE_RELOAD);
[self reloadInternal];
- _webStateImpl->SetCacheMode(net::RequestTracker::CACHE_NORMAL);
}
- (void)loadCancelled {
@@ -1710,9 +1681,7 @@ const NSTimeInterval kSnapshotOverlayTransition = 0.5;
[[sessionController currentEntry] retain]);
[sessionController goDelta:delta];
if (fromEntry) {
- _webStateImpl->SetCacheMode(net::RequestTracker::CACHE_HISTORY);
[self finishHistoryNavigationFromEntry:fromEntry];
- _webStateImpl->SetCacheMode(net::RequestTracker::CACHE_NORMAL);
}
}
@@ -1761,9 +1730,8 @@ const NSTimeInterval kSnapshotOverlayTransition = 0.5;
// (some of) the requests of the next page. It's expected to be an edge case,
// but if it becomes a problem it should be possible to notice it afterwards
// and react to it (by warning the user or reloading the page for example).
- _webStateImpl->SetCacheMode(net::RequestTracker::CACHE_NORMAL);
_webStateImpl->GetRequestTracker()->SetCacheModeFromUIThread(
- _webStateImpl->GetCacheMode());
+ net::RequestTracker::CACHE_NORMAL);
[self restoreStateFromHistory];
[self loadCompletedForURL:currentURL];
diff --git a/ios/web/web_state/web_state_impl.h b/ios/web/web_state/web_state_impl.h
index dab28e0..639f293 100644
--- a/ios/web/web_state/web_state_impl.h
+++ b/ios/web/web_state/web_state_impl.h
@@ -208,12 +208,6 @@ class WebStateImpl : public WebState, public NavigationManagerDelegate {
// Returns the tracker for this WebStateImpl.
RequestTrackerImpl* GetRequestTracker();
- // Gets and sets the mode controlling the HTTP cache behavior.
- // TODO(rohitrao): As with the other RequestTracker-related methods, this
- // should become an internal detail of this class.
- net::RequestTracker::CacheMode GetCacheMode();
- void SetCacheMode(net::RequestTracker::CacheMode mode);
-
// Lazily creates (if necessary) and returns |request_group_id_|.
// IMPORTANT: This should not be used for anything other than associating this
// instance to network requests.
@@ -330,9 +324,6 @@ class WebStateImpl : public WebState, public NavigationManagerDelegate {
// Request tracker associted with this object.
scoped_refptr<RequestTrackerImpl> request_tracker_;
- // Mode controlling the HTTP cache behavior.
- net::RequestTracker::CacheMode cache_mode_;
-
// A number identifying this object. This number is injected into the user
// agent to allow the network layer to know which web view requests originated
// from.
diff --git a/ios/web/web_state/web_state_impl.mm b/ios/web/web_state/web_state_impl.mm
index 9cd3386..0fa982f 100644
--- a/ios/web/web_state/web_state_impl.mm
+++ b/ios/web/web_state/web_state_impl.mm
@@ -38,7 +38,6 @@ WebStateImpl::WebStateImpl(BrowserState* browser_state)
web_controller_(nil),
navigation_manager_(this, browser_state),
interstitial_(nullptr),
- cache_mode_(net::RequestTracker::CACHE_NORMAL),
weak_factory_(this) {
GlobalWebStateEventTracker::GetInstance()->OnWebStateCreated(this);
}
@@ -439,14 +438,6 @@ RequestTrackerImpl* WebStateImpl::GetRequestTracker() {
return request_tracker_.get();
}
-net::RequestTracker::CacheMode WebStateImpl::GetCacheMode() {
- return cache_mode_;
-}
-
-void WebStateImpl::SetCacheMode(net::RequestTracker::CacheMode mode) {
- cache_mode_ = mode;
-}
-
NSString* WebStateImpl::GetRequestGroupID() {
if (request_group_id_.get() == nil)
request_group_id_.reset([GenerateNewRequestGroupID() copy]);