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

Unified Diff: chrome/browser/net/prerender_interceptor.cc

Issue 5633003: Moved PrerenderInterceptor to chrome\browser\prerender... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Another merge Created 10 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/net/prerender_interceptor.h ('k') | chrome/browser/net/prerender_interceptor_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/net/prerender_interceptor.cc
===================================================================
--- chrome/browser/net/prerender_interceptor.cc (revision 68608)
+++ chrome/browser/net/prerender_interceptor.cc (working copy)
@@ -1,77 +0,0 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/net/prerender_interceptor.h"
-
-#include <string>
-
-#include "base/logging.h"
-#include "chrome/browser/browser_thread.h"
-#include "chrome/browser/io_thread.h"
-#include "googleurl/src/gurl.h"
-#include "net/base/load_flags.h"
-
-DISABLE_RUNNABLE_METHOD_REFCOUNT(chrome_browser_net::PrerenderInterceptor);
-
-namespace chrome_browser_net {
-
-PrerenderInterceptor::PrerenderInterceptor()
- : ALLOW_THIS_IN_INITIALIZER_LIST(
- callback_(NewCallback(this,
- &PrerenderInterceptor::PrerenderDispatch))) {
- net::URLRequest::RegisterRequestInterceptor(this);
-}
-
-PrerenderInterceptor::PrerenderInterceptor(
- PrerenderInterceptorCallback* callback)
- : callback_(callback) {
- net::URLRequest::RegisterRequestInterceptor(this);
-}
-
-PrerenderInterceptor::~PrerenderInterceptor() {
- net::URLRequest::UnregisterRequestInterceptor(this);
-}
-
-net::URLRequestJob* PrerenderInterceptor::MaybeIntercept(
- net::URLRequest* request) {
- return NULL;
-}
-
-net::URLRequestJob* PrerenderInterceptor::MaybeInterceptResponse(
- net::URLRequest* request) {
- // TODO(gavinp): unfortunately, we can't figure out the origin
- // of this request here on systems where the referrer is blocked by
- // configuration.
-
- // TODO(gavinp): note that the response still might be intercepted
- // by a later interceptor. Should we write an interposing delegate
- // and only prerender dispatch on requests that aren't intercepted?
- // Or is this a slippery slope?
-
- if (request->load_flags() & net::LOAD_PREFETCH) {
- std::string mime_type;
- request->GetMimeType(&mime_type);
- if (mime_type == "text/html")
- BrowserThread::PostTask(
- BrowserThread::UI,
- FROM_HERE,
- NewRunnableMethod(this,
- &PrerenderInterceptor::RunCallbackFromUIThread,
- request->url()));
- }
- return NULL;
-}
-
-void PrerenderInterceptor::RunCallbackFromUIThread(const GURL& url) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- callback_->Run(url);
-}
-
-void PrerenderInterceptor::PrerenderDispatch(
- const GURL& url) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- DVLOG(2) << "PrerenderDispatchOnUIThread: url=" << url;
-}
-
-} // namespace chrome_browser_net
« no previous file with comments | « chrome/browser/net/prerender_interceptor.h ('k') | chrome/browser/net/prerender_interceptor_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698