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

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

Issue 192283002: Revert 255858 "Simplify the user agent code some more since afte..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 9 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) 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 CHROME_BROWSER_NET_CHROME_HTTP_USER_AGENT_SETTINGS_H_ 5 #ifndef CHROME_BROWSER_NET_CHROME_HTTP_USER_AGENT_SETTINGS_H_
6 #define CHROME_BROWSER_NET_CHROME_HTTP_USER_AGENT_SETTINGS_H_ 6 #define CHROME_BROWSER_NET_CHROME_HTTP_USER_AGENT_SETTINGS_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/prefs/pref_member.h" 12 #include "base/prefs/pref_member.h"
13 #include "net/url_request/http_user_agent_settings.h" 13 #include "net/url_request/http_user_agent_settings.h"
14 14
15 class PrefService; 15 class PrefService;
16 16
17 // An implementation of |HttpUserAgentSettings| that provides HTTP header 17 // An implementation of |HttpUserAgentSettings| that provides HTTP header
18 // Accept-Language value that tracks Pref settings. 18 // Accept-Language value that tracks Pref settings and uses
19 // |content::GetUserAgent| to provide the HTTP User-Agent header value.
19 class ChromeHttpUserAgentSettings : public net::HttpUserAgentSettings { 20 class ChromeHttpUserAgentSettings : public net::HttpUserAgentSettings {
20 public: 21 public:
21 // Must be called on the UI thread. 22 // Must be called on the UI thread.
22 explicit ChromeHttpUserAgentSettings(PrefService* prefs); 23 explicit ChromeHttpUserAgentSettings(PrefService* prefs);
23 // Must be called on the IO thread. 24 // Must be called on the IO thread.
24 virtual ~ChromeHttpUserAgentSettings(); 25 virtual ~ChromeHttpUserAgentSettings();
25 26
26 void CleanupOnUIThread(); 27 void CleanupOnUIThread();
27 28
28 // net::HttpUserAgentSettings implementation 29 // net::HttpUserAgentSettings implementation
29 virtual std::string GetAcceptLanguage() const OVERRIDE; 30 virtual std::string GetAcceptLanguage() const OVERRIDE;
30 virtual std::string GetUserAgent() const OVERRIDE; 31 virtual std::string GetUserAgent(const GURL& url) const OVERRIDE;
31 32
32 private: 33 private:
33 StringPrefMember pref_accept_language_; 34 StringPrefMember pref_accept_language_;
34 35
35 // Avoid re-processing by caching the last value from the preferences and the 36 // Avoid re-processing by caching the last value from the preferences and the
36 // last result of processing via net::HttpUtil::GenerateAccept*Header(). 37 // last result of processing via net::HttpUtil::GenerateAccept*Header().
37 mutable std::string last_pref_accept_language_; 38 mutable std::string last_pref_accept_language_;
38 mutable std::string last_http_accept_language_; 39 mutable std::string last_http_accept_language_;
39 40
40 DISALLOW_COPY_AND_ASSIGN(ChromeHttpUserAgentSettings); 41 DISALLOW_COPY_AND_ASSIGN(ChromeHttpUserAgentSettings);
41 }; 42 };
42 43
43 #endif // CHROME_BROWSER_NET_CHROME_HTTP_USER_AGENT_SETTINGS_H_ 44 #endif // CHROME_BROWSER_NET_CHROME_HTTP_USER_AGENT_SETTINGS_H_
44 45
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698