Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2015 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 ANDROID_WEBVIEW_BROWSER_NET_AW_HTTP_USER_AGENT_SETTINGS_H_ | |
| 6 #define ANDROID_WEBVIEW_BROWSER_NET_AW_HTTP_USER_AGENT_SETTINGS_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "base/basictypes.h" | |
| 11 #include "base/compiler_specific.h" | |
| 12 #include "net/url_request/http_user_agent_settings.h" | |
| 13 | |
| 14 namespace android_webview { | |
| 15 | |
| 16 // An implementation of |HttpUserAgentSettings| that provides HTTP header | |
| 17 // Accept-Language value that tracks aw accept language. | |
| 18 class AwHttpUserAgentSettings : public net::HttpUserAgentSettings { | |
| 19 public: | |
| 20 // Must be called on the UI thread. | |
| 21 explicit AwHttpUserAgentSettings(); | |
|
Torne
2015/07/17 13:33:19
explicit is only for 1-arg constructors.
ctserng
2015/07/17 16:51:15
Will do.
| |
| 22 // Must be called on the IO thread. | |
|
Torne
2015/07/17 13:33:19
Explicitly requiring this to be destructed on a di
ctserng
2015/07/17 16:51:15
I understand this, but the life cycle of AwURLRequ
| |
| 23 ~AwHttpUserAgentSettings() override; | |
| 24 | |
| 25 // net::HttpUserAgentSettings implementation | |
| 26 std::string GetAcceptLanguage() const override; | |
| 27 std::string GetUserAgent() const override; | |
| 28 | |
| 29 private: | |
| 30 // Avoid re-processing by caching the last value from the locale and the | |
| 31 // last result of processing via net::HttpUtil::GenerateAccept*Header(). | |
| 32 mutable std::string last_aw_accept_language_; | |
| 33 mutable std::string last_http_accept_language_; | |
| 34 | |
| 35 DISALLOW_COPY_AND_ASSIGN(AwHttpUserAgentSettings); | |
| 36 }; | |
| 37 | |
| 38 } // namespace android_webview | |
| 39 | |
| 40 #endif // ANDROID_WEBVIEW_BROWSER_NET_AW_HTTP_USER_AGENT_SETTINGS_H_ | |
| 41 | |
| OLD | NEW |