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

Side by Side Diff: chrome/browser/net/chrome_http_user_agent_settings.h

Issue 10918279: Provide mutable members of UrlRequestContext via pure-virtual interface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Disable test for chrome_frame_net_tests 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_NET_CHROME_HTTP_USER_AGENT_SETTINGS_H_
6 #define CHROME_BROWSER_NET_CHROME_HTTP_USER_AGENT_SETTINGS_H_
7
8 #include <string>
9
10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h"
12 #include "chrome/browser/api/prefs/pref_member.h"
13 #include "net/url_request/http_user_agent_settings.h"
14
15 class PrefService;
16
17 // An implementation of |HttpUserAgentSettings| that provides HTTP headers
18 // Accept-Language and Accept-Charset values that track Pref settings and uses
19 // |content::GetUserAgent| to provide the HTTP User-Agent header value.
20 class ChromeHttpUserAgentSettings : public net::HttpUserAgentSettings {
21 public:
22 // Must be called on the UI thread.
23 explicit ChromeHttpUserAgentSettings(PrefService* prefs);
24 // Must be called on the IO thread.
25 virtual ~ChromeHttpUserAgentSettings();
26
27 void CleanupOnUIThread();
28
29 // net::HttpUserAgentSettings implementation
30 virtual std::string GetAcceptLanguage() const OVERRIDE;
31 virtual std::string GetAcceptCharset() const OVERRIDE;
32 virtual std::string GetUserAgent(const GURL& url) const OVERRIDE;
33
34 private:
35 StringPrefMember pref_accept_language_;
36 StringPrefMember pref_accept_charset_;
37
38 // Avoid re-processing by caching the last value from the preferences and the
39 // last result of processing via net::HttpUtil::GenerateAccept*Header().
40 mutable std::string last_pref_accept_language_;
41 mutable std::string last_http_accept_language_;
42 mutable std::string last_pref_accept_charset_;
43 mutable std::string last_http_accept_charset_;
44
45 DISALLOW_COPY_AND_ASSIGN(ChromeHttpUserAgentSettings);
46 };
47
48 #endif // CHROME_BROWSER_NET_CHROME_HTTP_USER_AGENT_SETTINGS_H_
49
OLDNEW
« no previous file with comments | « chrome/browser/net/basic_http_user_agent_settings.cc ('k') | chrome/browser/net/chrome_http_user_agent_settings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698