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

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

Issue 4118004: Update NetLog to be thread safe. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Response to comments (And net-internals refresh fix) Created 10 years, 1 month 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
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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_backend_impl.h" 5 #include "chrome/browser/policy/device_management_backend_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/stl_util-inl.h" 10 #include "base/stl_util-inl.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 const char kDMTokenAuthHeader[] = "Authorization: GoogleDMToken token="; 44 const char kDMTokenAuthHeader[] = "Authorization: GoogleDMToken token=";
45 45
46 } // namespace 46 } // namespace
47 47
48 // Custom request context implementation that allows to override the user agent, 48 // Custom request context implementation that allows to override the user agent,
49 // amongst others. Using the default request context is not an option since this 49 // amongst others. Using the default request context is not an option since this
50 // service may be constructed before the default request context is created 50 // service may be constructed before the default request context is created
51 // (i.e. before the profile has been loaded). 51 // (i.e. before the profile has been loaded).
52 class DeviceManagementBackendRequestContext : public URLRequestContext { 52 class DeviceManagementBackendRequestContext : public URLRequestContext {
53 public: 53 public:
54 explicit DeviceManagementBackendRequestContext(IOThread::Globals* io_globals); 54 explicit DeviceManagementBackendRequestContext(net::NetLog* net_log,
eroman 2010/11/18 18:04:03 remove "explicit".
55 IOThread::Globals* io_globals);
55 virtual ~DeviceManagementBackendRequestContext(); 56 virtual ~DeviceManagementBackendRequestContext();
56 57
57 private: 58 private:
58 virtual const std::string& GetUserAgent(const GURL& url) const; 59 virtual const std::string& GetUserAgent(const GURL& url) const;
59 60
60 std::string user_agent_; 61 std::string user_agent_;
61 }; 62 };
62 63
63 DeviceManagementBackendRequestContext::DeviceManagementBackendRequestContext( 64 DeviceManagementBackendRequestContext::DeviceManagementBackendRequestContext(
64 IOThread::Globals* io_globals) { 65 net::NetLog* net_log, IOThread::Globals* io_globals) {
65 net_log_ = io_globals->net_log.get(); 66 net_log_ = net_log;
66 host_resolver_ = io_globals->host_resolver.get(); 67 host_resolver_ = io_globals->host_resolver.get();
67 proxy_service_ = net::ProxyService::CreateDirect(); 68 proxy_service_ = net::ProxyService::CreateDirect();
68 ssl_config_service_ = net::SSLConfigService::CreateSystemSSLConfigService(); 69 ssl_config_service_ = net::SSLConfigService::CreateSystemSSLConfigService();
69 http_auth_handler_factory_ = 70 http_auth_handler_factory_ =
70 net::HttpAuthHandlerFactory::CreateDefault(host_resolver_); 71 net::HttpAuthHandlerFactory::CreateDefault(host_resolver_);
71 http_transaction_factory_ = 72 http_transaction_factory_ =
72 net::HttpNetworkLayer::CreateFactory(host_resolver_, 73 net::HttpNetworkLayer::CreateFactory(host_resolver_,
73 io_globals->dnsrr_resolver.get(), 74 io_globals->dnsrr_resolver.get(),
74 NULL /* ssl_host_info_factory */, 75 NULL /* ssl_host_info_factory */,
75 proxy_service_, 76 proxy_service_,
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 108
108 private: 109 private:
109 scoped_refptr<URLRequestContext> context_; 110 scoped_refptr<URLRequestContext> context_;
110 IOThread* io_thread_; 111 IOThread* io_thread_;
111 }; 112 };
112 113
113 114
114 URLRequestContext* 115 URLRequestContext*
115 DeviceManagementBackendRequestContextGetter::GetURLRequestContext() { 116 DeviceManagementBackendRequestContextGetter::GetURLRequestContext() {
116 if (!context_) 117 if (!context_)
117 context_ = new DeviceManagementBackendRequestContext(io_thread_->globals()); 118 context_ = new DeviceManagementBackendRequestContext(io_thread_->net_log(),
119 io_thread_->globals());
118 120
119 return context_.get(); 121 return context_.get();
120 } 122 }
121 123
122 scoped_refptr<base::MessageLoopProxy> 124 scoped_refptr<base::MessageLoopProxy>
123 DeviceManagementBackendRequestContextGetter::GetIOMessageLoopProxy() const { 125 DeviceManagementBackendRequestContextGetter::GetIOMessageLoopProxy() const {
124 return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); 126 return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO);
125 } 127 }
126 128
127 // Helper class for URL query parameter encoding/decoding. 129 // Helper class for URL query parameter encoding/decoding.
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 fetcher->Start(); 408 fetcher->Start();
407 } 409 }
408 410
409 void DeviceManagementBackendImpl::PutCommonQueryParameters( 411 void DeviceManagementBackendImpl::PutCommonQueryParameters(
410 URLQueryParameters* params) { 412 URLQueryParameters* params) {
411 params->Put(kServiceParamDeviceType, kServiceValueDeviceType); 413 params->Put(kServiceParamDeviceType, kServiceValueDeviceType);
412 params->Put(kServiceParamAgent, GetAgentString()); 414 params->Put(kServiceParamAgent, GetAgentString());
413 } 415 }
414 416
415 } // namespace policy 417 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698