xref: /aosp_15_r20/external/cronet/net/url_request/static_http_user_agent_settings.h (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2012 The Chromium Authors
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 NET_URL_REQUEST_STATIC_HTTP_USER_AGENT_SETTINGS_H_
6 #define NET_URL_REQUEST_STATIC_HTTP_USER_AGENT_SETTINGS_H_
7 
8 #include <string>
9 
10 #include "base/compiler_specific.h"
11 #include "net/base/http_user_agent_settings.h"
12 #include "net/base/net_export.h"
13 
14 namespace net {
15 
16 // An implementation of |HttpUserAgentSettings| that provides configured
17 // values for the HTTP Accept-Language and User-Agent headers.
18 class NET_EXPORT StaticHttpUserAgentSettings : public HttpUserAgentSettings {
19  public:
20   StaticHttpUserAgentSettings(const std::string& accept_language,
21                               const std::string& user_agent);
22 
23   StaticHttpUserAgentSettings(const StaticHttpUserAgentSettings&) = delete;
24   StaticHttpUserAgentSettings& operator=(const StaticHttpUserAgentSettings&) =
25       delete;
26 
27   ~StaticHttpUserAgentSettings() override;
28 
set_accept_language(const std::string & new_accept_language)29   void set_accept_language(const std::string& new_accept_language) {
30     accept_language_ = new_accept_language;
31   }
32 
33   // HttpUserAgentSettings implementation
34   std::string GetAcceptLanguage() const override;
35   std::string GetUserAgent() const override;
36 
37  private:
38   std::string accept_language_;
39   const std::string user_agent_;
40 };
41 
42 }  // namespace net
43 
44 #endif  // NET_URL_REQUEST_STATIC_HTTP_USER_AGENT_SETTINGS_H_
45