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

Side by Side Diff: sync/internal_api/public/http_bridge.h

Issue 10918279: Provide mutable members of UrlRequestContext via pure-virtual interface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add TODO Created 8 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef SYNC_INTERNAL_API_PUBLIC_HTTP_BRIDGE_H_ 5 #ifndef SYNC_INTERNAL_API_PUBLIC_HTTP_BRIDGE_H_
6 #define SYNC_INTERNAL_API_PUBLIC_HTTP_BRIDGE_H_ 6 #define SYNC_INTERNAL_API_PUBLIC_HTTP_BRIDGE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/gtest_prod_util.h" 12 #include "base/gtest_prod_util.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/synchronization/lock.h" 14 #include "base/synchronization/lock.h"
15 #include "base/synchronization/waitable_event.h" 15 #include "base/synchronization/waitable_event.h"
16 #include "googleurl/src/gurl.h" 16 #include "googleurl/src/gurl.h"
17 #include "net/url_request/url_fetcher_delegate.h" 17 #include "net/url_request/url_fetcher_delegate.h"
18 #include "net/url_request/url_request_context.h" 18 #include "net/url_request/url_request_context.h"
19 #include "net/url_request/url_request_context_getter.h" 19 #include "net/url_request/url_request_context_getter.h"
20 #include "sync/internal_api/public/http_post_provider_factory.h" 20 #include "sync/internal_api/public/http_post_provider_factory.h"
21 #include "sync/internal_api/public/http_post_provider_interface.h" 21 #include "sync/internal_api/public/http_post_provider_interface.h"
22 22
23 class MessageLoop; 23 class MessageLoop;
24 class HttpBridgeTest; 24 class HttpBridgeTest;
25 25
26 namespace net { 26 namespace net {
27 class StaticHttpUserAgentSettings;
27 class HttpResponseHeaders; 28 class HttpResponseHeaders;
28 class URLFetcher; 29 class URLFetcher;
29 } 30 }
30 31
31 namespace syncer { 32 namespace syncer {
32 33
33 // A bridge between the syncer and Chromium HTTP layers. 34 // A bridge between the syncer and Chromium HTTP layers.
34 // Provides a way for the sync backend to use Chromium directly for HTTP 35 // Provides a way for the sync backend to use Chromium directly for HTTP
35 // requests rather than depending on a third party provider (e.g libcurl). 36 // requests rather than depending on a third party provider (e.g libcurl).
36 // This is a one-time use bridge. Create one for each request you want to make. 37 // This is a one-time use bridge. Create one for each request you want to make.
(...skipping 14 matching lines...) Expand all
51 // currently active profile. 52 // currently active profile.
52 RequestContext( 53 RequestContext(
53 net::URLRequestContext* baseline_context, 54 net::URLRequestContext* baseline_context,
54 const scoped_refptr<base::SingleThreadTaskRunner>& 55 const scoped_refptr<base::SingleThreadTaskRunner>&
55 network_task_runner, 56 network_task_runner,
56 const std::string& user_agent); 57 const std::string& user_agent);
57 58
58 // The destructor MUST be called on the IO thread. 59 // The destructor MUST be called on the IO thread.
59 virtual ~RequestContext(); 60 virtual ~RequestContext();
60 61
61 virtual const std::string& GetUserAgent(const GURL& url) const OVERRIDE;
62
63 private: 62 private:
64 net::URLRequestContext* const baseline_context_; 63 net::URLRequestContext* const baseline_context_;
65 const scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_; 64 const scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_;
66 const std::string user_agent_; 65 scoped_ptr<net::StaticHttpUserAgentSettings>
erikwright (departed) 2012/10/24 13:14:33 This could be just HttpUserAgentSettings, right?
66 static_http_user_agent_settings_;
67 67
68 DISALLOW_COPY_AND_ASSIGN(RequestContext); 68 DISALLOW_COPY_AND_ASSIGN(RequestContext);
69 }; 69 };
70 70
71 // Lazy-getter for RequestContext objects. 71 // Lazy-getter for RequestContext objects.
72 class RequestContextGetter : public net::URLRequestContextGetter { 72 class RequestContextGetter : public net::URLRequestContextGetter {
73 public: 73 public:
74 RequestContextGetter( 74 RequestContextGetter(
75 net::URLRequestContextGetter* baseline_context_getter, 75 net::URLRequestContextGetter* baseline_context_getter,
76 const std::string& user_agent); 76 const std::string& user_agent);
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 222
223 const scoped_refptr<HttpBridge::RequestContextGetter> 223 const scoped_refptr<HttpBridge::RequestContextGetter>
224 request_context_getter_; 224 request_context_getter_;
225 225
226 DISALLOW_COPY_AND_ASSIGN(HttpBridgeFactory); 226 DISALLOW_COPY_AND_ASSIGN(HttpBridgeFactory);
227 }; 227 };
228 228
229 } // namespace syncer 229 } // namespace syncer
230 230
231 #endif // SYNC_INTERNAL_API_PUBLIC_HTTP_BRIDGE_H_ 231 #endif // SYNC_INTERNAL_API_PUBLIC_HTTP_BRIDGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698