summaryrefslogtreecommitdiffstats
path: root/chrome/browser/net
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/net')
-rw-r--r--chrome/browser/net/chrome_network_delegate.cc12
-rw-r--r--chrome/browser/net/chrome_network_delegate.h10
-rw-r--r--chrome/browser/net/cookie_store_util.cc19
-rw-r--r--chrome/browser/net/evicted_domain_cookie_counter.cc5
-rw-r--r--chrome/browser/net/evicted_domain_cookie_counter.h1
-rw-r--r--chrome/browser/net/evicted_domain_cookie_counter_unittest.cc2
6 files changed, 48 insertions, 1 deletions
diff --git a/chrome/browser/net/chrome_network_delegate.cc b/chrome/browser/net/chrome_network_delegate.cc
index 1cab93d..bafd11f 100644
--- a/chrome/browser/net/chrome_network_delegate.cc
+++ b/chrome/browser/net/chrome_network_delegate.cc
@@ -29,6 +29,7 @@
#include "chrome/browser/net/client_hints.h"
#include "chrome/browser/net/connect_interceptor.h"
#include "chrome/browser/performance_monitor/performance_monitor.h"
+#include "chrome/browser/prerender/prerender_tracker.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/task_manager/task_manager.h"
#include "chrome/common/pref_names.h"
@@ -52,6 +53,7 @@
#include "net/http/http_response_headers.h"
#include "net/socket_stream/socket_stream.h"
#include "net/url_request/url_request.h"
+#include "net/url_request/url_request_context.h"
#if defined(OS_CHROMEOS)
#include "base/command_line.h"
@@ -358,7 +360,8 @@ ChromeNetworkDelegate::ChromeNetworkDelegate(
domain_reliability_monitor_(NULL),
received_content_length_(0),
original_content_length_(0),
- first_request_(true) {
+ first_request_(true),
+ prerender_tracker_(NULL) {
DCHECK(event_router);
DCHECK(enable_referrers);
}
@@ -742,6 +745,13 @@ bool ChromeNetworkDelegate::OnCanSetCookie(const net::URLRequest& request,
cookie_line, *options, !allow));
}
+ if (prerender_tracker_) {
+ prerender_tracker_->OnCookieChangedForURL(
+ render_process_id,
+ request.context()->cookie_store()->GetCookieMonster(),
+ request.url());
+ }
+
return allow;
}
diff --git a/chrome/browser/net/chrome_network_delegate.h b/chrome/browser/net/chrome_network_delegate.h
index 2053180..608ba05 100644
--- a/chrome/browser/net/chrome_network_delegate.h
+++ b/chrome/browser/net/chrome_network_delegate.h
@@ -49,6 +49,10 @@ namespace policy {
class URLBlacklistManager;
}
+namespace prerender {
+class PrerenderTracker;
+}
+
// ChromeNetworkDelegate is the central point from within the chrome code to
// add hooks into the network stack.
class ChromeNetworkDelegate : public net::NetworkDelegate {
@@ -106,6 +110,10 @@ class ChromeNetworkDelegate : public net::NetworkDelegate {
domain_reliability_monitor_ = domain_reliability_monitor;
}
+ void set_prerender_tracker(prerender::PrerenderTracker* prerender_tracker) {
+ prerender_tracker_ = prerender_tracker;
+ }
+
// Adds the Client Hints header to HTTP requests.
void SetEnableClientHints();
@@ -228,6 +236,8 @@ class ChromeNetworkDelegate : public net::NetworkDelegate {
bool first_request_;
+ prerender::PrerenderTracker* prerender_tracker_;
+
DISALLOW_COPY_AND_ASSIGN(ChromeNetworkDelegate);
};
diff --git a/chrome/browser/net/cookie_store_util.cc b/chrome/browser/net/cookie_store_util.cc
index 924c9b0..5e5d780 100644
--- a/chrome/browser/net/cookie_store_util.cc
+++ b/chrome/browser/net/cookie_store_util.cc
@@ -12,6 +12,8 @@
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/net/chrome_cookie_notification_details.h"
#include "chrome/browser/net/evicted_domain_cookie_counter.h"
+#include "chrome/browser/prerender/prerender_manager.h"
+#include "chrome/browser/prerender/prerender_manager_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/common/chrome_constants.h"
@@ -49,6 +51,13 @@ class ChromeCookieMonsterDelegate : public net::CookieMonsterDelegate {
this, cookie, removed, cause));
}
+ virtual void OnLoaded() OVERRIDE {
+ BrowserThread::PostTask(
+ BrowserThread::UI, FROM_HERE,
+ base::Bind(&ChromeCookieMonsterDelegate::OnLoadedAsyncHelper,
+ this));
+ }
+
private:
virtual ~ChromeCookieMonsterDelegate() {}
@@ -73,6 +82,16 @@ class ChromeCookieMonsterDelegate : public net::CookieMonsterDelegate {
}
}
+ void OnLoadedAsyncHelper() {
+ Profile* profile = profile_getter_.Run();
+ if (profile) {
+ prerender::PrerenderManager* prerender_manager =
+ prerender::PrerenderManagerFactory::GetForProfile(profile);
+ if (prerender_manager)
+ prerender_manager->OnCookieStoreLoaded();
+ }
+ }
+
const base::Callback<Profile*(void)> profile_getter_;
};
diff --git a/chrome/browser/net/evicted_domain_cookie_counter.cc b/chrome/browser/net/evicted_domain_cookie_counter.cc
index 2d9590a..71139a5 100644
--- a/chrome/browser/net/evicted_domain_cookie_counter.cc
+++ b/chrome/browser/net/evicted_domain_cookie_counter.cc
@@ -111,6 +111,11 @@ void EvictedDomainCookieCounter::OnCookieChanged(
next_cookie_monster_delegate_->OnCookieChanged(cookie, removed, cause);
}
+void EvictedDomainCookieCounter::OnLoaded() {
+ if (next_cookie_monster_delegate_.get())
+ next_cookie_monster_delegate_->OnLoaded();
+}
+
// static
EvictedDomainCookieCounter::EvictedCookieKey
EvictedDomainCookieCounter::GetKey(const net::CanonicalCookie& cookie) {
diff --git a/chrome/browser/net/evicted_domain_cookie_counter.h b/chrome/browser/net/evicted_domain_cookie_counter.h
index 5cf8797..5731fa9 100644
--- a/chrome/browser/net/evicted_domain_cookie_counter.h
+++ b/chrome/browser/net/evicted_domain_cookie_counter.h
@@ -90,6 +90,7 @@ class EvictedDomainCookieCounter : public net::CookieMonster::Delegate {
virtual void OnCookieChanged(const net::CanonicalCookie& cookie,
bool removed,
ChangeCause cause) OVERRIDE;
+ virtual void OnLoaded() OVERRIDE;
private:
// Identifier of an evicted cookie.
diff --git a/chrome/browser/net/evicted_domain_cookie_counter_unittest.cc b/chrome/browser/net/evicted_domain_cookie_counter_unittest.cc
index ca2597d..1a73589 100644
--- a/chrome/browser/net/evicted_domain_cookie_counter_unittest.cc
+++ b/chrome/browser/net/evicted_domain_cookie_counter_unittest.cc
@@ -193,6 +193,8 @@ TEST_F(EvictedDomainCookieCounterTest, TestChain) {
++(*result_);
}
+ virtual void OnLoaded() OVERRIDE {}
+
private:
virtual ~ChangedDelegateDummy() {}