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

Unified Diff: chrome/service/net/service_url_request_context.h

Issue 2001009: Created a new process type called the service process to host background task... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/service/net/service_url_request_context.h
===================================================================
--- chrome/service/net/service_url_request_context.h (revision 0)
+++ chrome/service/net/service_url_request_context.h (revision 0)
@@ -0,0 +1,78 @@
+// 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.
+
+#ifndef CHROME_SERVICE_NET_SERVICE_URL_REQUEST_CONTEXT_H_
+#define CHROME_SERVICE_NET_SERVICE_URL_REQUEST_CONTEXT_H_
+
+#include <string>
+
+#include "base/message_loop_proxy.h"
+#include "chrome/common/net/url_request_context_getter.h"
+#include "net/base/cookie_monster.h"
+#include "net/base/cookie_policy.h"
+#include "net/base/host_resolver.h"
+#include "net/base/ssl_config_service_defaults.h"
+#include "net/disk_cache/disk_cache.h"
+#include "net/ftp/ftp_network_layer.h"
+#include "net/http/http_auth_handler_factory.h"
+#include "net/http/http_cache.h"
+#include "net/http/http_network_layer.h"
+#include "net/proxy/proxy_service.h"
+#include "net/url_request/url_request_context.h"
+
+// Subclass of URLRequestContext which can be used to store extra information
+// for requests. This subclass is meant to be used in the service process where
+// the profile is not available.
+//
+class ServiceURLRequestContext : public URLRequestContext {
+ public:
+ ServiceURLRequestContext();
+ void set_cookie_policy(net::CookiePolicy* policy) {
+ cookie_policy_ = policy;
+ }
+ void set_user_agent(const std::string& ua) {
+ user_agent_ = ua;
+ }
+
+ // URLRequestContext overrides
+ virtual const std::string& GetUserAgent(const GURL& url) const {
+ // If the user agent is set explicitly return that, otherwise call the
+ // base class method to return default value.
+ return user_agent_.empty() ?
+ URLRequestContext::GetUserAgent(url) : user_agent_;
+ }
+
+ protected:
+ virtual ~ServiceURLRequestContext();
+
+ private:
+ std::string user_agent_;
+};
+
+class ServiceURLRequestContextGetter : public URLRequestContextGetter {
+ public:
+ ServiceURLRequestContextGetter();
+
+ virtual URLRequestContext* GetURLRequestContext() {
+ if (!url_request_context_)
+ url_request_context_ = new ServiceURLRequestContext();
+ return url_request_context_;
+ }
+ virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy() {
+ return io_message_loop_proxy_;
+ }
+
+ void set_user_agent(const std::string& ua) {
+ user_agent_ = ua;
+ }
+ private:
+ ~ServiceURLRequestContextGetter() {}
+
+ std::string user_agent_;
+ scoped_refptr<URLRequestContext> url_request_context_;
+ scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_;
+};
+
+#endif // CHROME_SERVICE_NET_SERVICE_URL_REQUEST_CONTEXT_H_
+
Property changes on: chrome\service\net\service_url_request_context.h
___________________________________________________________________
Added: svn:eol-style
+ LF
« no previous file with comments | « chrome/service/gaia/service_gaia_authenticator.cc ('k') | chrome/service/net/service_url_request_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698