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

Side by Side Diff: chrome/browser/policy/device_management_service.cc

Issue 6338002: net: Remove typedef net::URLRequestContext URLRequestContext; (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: for real Created 9 years, 11 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #include "chrome/browser/policy/device_management_service.h" 5 #include "chrome/browser/policy/device_management_service.h"
6 6
7 #include "chrome/browser/browser_thread.h" 7 #include "chrome/browser/browser_thread.h"
8 #include "net/base/cookie_monster.h" 8 #include "net/base/cookie_monster.h"
9 #include "net/base/host_resolver.h" 9 #include "net/base/host_resolver.h"
10 #include "net/base/load_flags.h" 10 #include "net/base/load_flags.h"
11 #include "net/base/ssl_config_service_defaults.h" 11 #include "net/base/ssl_config_service_defaults.h"
12 #include "net/http/http_auth_handler_factory.h" 12 #include "net/http/http_auth_handler_factory.h"
13 #include "net/http/http_network_layer.h" 13 #include "net/http/http_network_layer.h"
14 #include "net/proxy/proxy_service.h" 14 #include "net/proxy/proxy_service.h"
15 #include "net/url_request/url_request_context.h" 15 #include "net/url_request/url_request_context.h"
16 #include "net/url_request/url_request_status.h" 16 #include "net/url_request/url_request_status.h"
17 #include "chrome/browser/io_thread.h" 17 #include "chrome/browser/io_thread.h"
18 #include "chrome/browser/net/chrome_net_log.h" 18 #include "chrome/browser/net/chrome_net_log.h"
19 #include "chrome/browser/policy/device_management_backend_impl.h" 19 #include "chrome/browser/policy/device_management_backend_impl.h"
20 #include "chrome/common/net/url_request_context_getter.h" 20 #include "chrome/common/net/url_request_context_getter.h"
21 #include "webkit/glue/webkit_glue.h" 21 #include "webkit/glue/webkit_glue.h"
22 22
23 namespace policy { 23 namespace policy {
24 24
25 namespace { 25 namespace {
26 26
27 // Custom request context implementation that allows to override the user agent, 27 // Custom request context implementation that allows to override the user agent,
28 // amongst others. Wraps a baseline request context from which we reuse the 28 // amongst others. Wraps a baseline request context from which we reuse the
29 // networking components. 29 // networking components.
30 class DeviceManagementRequestContext : public URLRequestContext { 30 class DeviceManagementRequestContext : public net::URLRequestContext {
31 public: 31 public:
32 explicit DeviceManagementRequestContext(URLRequestContext* base_context); 32 explicit DeviceManagementRequestContext(net::URLRequestContext* base_context);
33 virtual ~DeviceManagementRequestContext(); 33 virtual ~DeviceManagementRequestContext();
34 34
35 private: 35 private:
36 // Overriden from URLRequestContext. 36 // Overridden from net::URLRequestContext:
37 virtual const std::string& GetUserAgent(const GURL& url) const; 37 virtual const std::string& GetUserAgent(const GURL& url) const;
38 }; 38 };
39 39
40 DeviceManagementRequestContext::DeviceManagementRequestContext( 40 DeviceManagementRequestContext::DeviceManagementRequestContext(
41 URLRequestContext* base_context) { 41 net::URLRequestContext* base_context) {
42 // Share resolver, proxy service and ssl bits with the baseline context. This 42 // Share resolver, proxy service and ssl bits with the baseline context. This
43 // is important so we don't make redundant requests (e.g. when resolving proxy 43 // is important so we don't make redundant requests (e.g. when resolving proxy
44 // auto configuration). 44 // auto configuration).
45 net_log_ = base_context->net_log(); 45 net_log_ = base_context->net_log();
46 host_resolver_ = base_context->host_resolver(); 46 host_resolver_ = base_context->host_resolver();
47 proxy_service_ = base_context->proxy_service(); 47 proxy_service_ = base_context->proxy_service();
48 ssl_config_service_ = base_context->ssl_config_service(); 48 ssl_config_service_ = base_context->ssl_config_service();
49 49
50 // Share the http session. 50 // Share the http session.
51 http_transaction_factory_ = net::HttpNetworkLayer::CreateFactory( 51 http_transaction_factory_ = net::HttpNetworkLayer::CreateFactory(
(...skipping 17 matching lines...) Expand all
69 return webkit_glue::GetUserAgent(url); 69 return webkit_glue::GetUserAgent(url);
70 } 70 }
71 71
72 // Request context holder. 72 // Request context holder.
73 class DeviceManagementRequestContextGetter : public URLRequestContextGetter { 73 class DeviceManagementRequestContextGetter : public URLRequestContextGetter {
74 public: 74 public:
75 DeviceManagementRequestContextGetter( 75 DeviceManagementRequestContextGetter(
76 URLRequestContextGetter* base_context_getter) 76 URLRequestContextGetter* base_context_getter)
77 : base_context_getter_(base_context_getter) {} 77 : base_context_getter_(base_context_getter) {}
78 78
79 // URLRequestContextGetter overrides. 79 // Overridden from URLRequestContextGetter:
80 virtual URLRequestContext* GetURLRequestContext(); 80 virtual net::URLRequestContext* GetURLRequestContext();
81 virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy() const; 81 virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy() const;
82 82
83 private: 83 private:
84 scoped_refptr<URLRequestContext> context_; 84 scoped_refptr<net::URLRequestContext> context_;
85 scoped_refptr<URLRequestContextGetter> base_context_getter_; 85 scoped_refptr<URLRequestContextGetter> base_context_getter_;
86 }; 86 };
87 87
88 88
89 URLRequestContext* 89 net::URLRequestContext*
90 DeviceManagementRequestContextGetter::GetURLRequestContext() { 90 DeviceManagementRequestContextGetter::GetURLRequestContext() {
91 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 91 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
92 if (!context_) { 92 if (!context_) {
93 context_ = new DeviceManagementRequestContext( 93 context_ = new DeviceManagementRequestContext(
94 base_context_getter_->GetURLRequestContext()); 94 base_context_getter_->GetURLRequestContext());
95 } 95 }
96 96
97 return context_.get(); 97 return context_.get();
98 } 98 }
99 99
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 DeviceManagementJob* job = entry->second; 183 DeviceManagementJob* job = entry->second;
184 job->HandleResponse(status, response_code, cookies, data); 184 job->HandleResponse(status, response_code, cookies, data);
185 pending_jobs_.erase(entry); 185 pending_jobs_.erase(entry);
186 } else { 186 } else {
187 NOTREACHED() << "Callback from foreign URL fetcher"; 187 NOTREACHED() << "Callback from foreign URL fetcher";
188 } 188 }
189 delete source; 189 delete source;
190 } 190 }
191 191
192 } // namespace policy 192 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698