Built UserAgent according to OS And Product.
[platform/framework/web/crosswalk-tizen.git] / vendor / brightray / vendor / libchromiumcontent / src / tizen_src / ewk / efl_integration / common / version_info.h
1 // Copyright 2013 Samsung Electronics. 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 VERSION_INFO_H_
6 #define VERSION_INFO_H_
7
8 #include <string>
9 #include "base/macros.h"
10
11 namespace EflWebView {
12
13 class VersionInfo {
14  public:
15   // The possible channels for an installation, from most fun to most stable.
16   enum Channel {
17     CHANNEL_UNKNOWN = 0,  // Probably blue
18     CHANNEL_CANARY,       // Yellow
19     CHANNEL_DEV,          // Technicolor
20     CHANNEL_BETA,         // Rainbow
21     CHANNEL_STABLE        // Full-spectrum
22   };
23
24   static VersionInfo* GetInstance();
25   static void DeleteInstance();
26
27   // Default user agent
28   std::string DefaultUserAgent() const;
29   // Get chromium version number
30   std::string GetVersionNumber() const;
31   // E.g. "Chrome/a.b.c.d"
32   std::string VersionForUserAgent() const;
33   // OS type. E.g. "Windows", "Linux", "FreeBSD", ...
34   std::string OSType() const;
35
36   std::string AppName() const { return product_name_; }
37
38   void UpdateUserAgentWithAppName(const std::string& name);
39
40   // To update the default user agent with restored (Session data) User Agent.
41   void UpdateUserAgent(const std::string& user_agent);
42
43   // Returns the channel for the installation. In branded builds, this will be
44   // CHANNEL_STABLE, CHANNEL_BETA, CHANNEL_DEV, or CHANNEL_CANARY. In unbranded
45   // builds, or in branded builds when the channel cannot be determined, this
46   // will be CHANNEL_UNKNOWN.
47   static Channel GetChannel()
48   { return CHANNEL_DEV; }
49
50  private:
51   VersionInfo();
52   ~VersionInfo() { }
53
54   std::string CreateUserAgent() const;
55   std::string product_name_;
56   std::string system_info_;
57   std::string user_agent_;
58   static VersionInfo* version_info_;
59
60   DISALLOW_COPY_AND_ASSIGN(VersionInfo);
61 };
62
63 }  // namespace EflWebView
64
65 #endif  // VERSION_INFO_H_