Propagate theme color updates to the WebContentsDelegates.
[chromium-blink-merge.git] / base / android / build_info.h
blobd6155b9eed953ebc1af03d554c273d8cb47f8ea8
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.
5 #ifndef BASE_ANDROID_BUILD_INFO_H_
6 #define BASE_ANDROID_BUILD_INFO_H_
8 #include <jni.h>
10 #include <string>
12 #include "base/base_export.h"
13 #include "base/memory/singleton.h"
15 namespace base {
16 namespace android {
18 // This enumeration maps to the values returned by BuildInfo::sdk_int(),
19 // indicating the Android release associated with a given SDK version.
20 enum SdkVersion {
21 SDK_VERSION_JELLY_BEAN = 16,
22 SDK_VERSION_JELLY_BEAN_MR1 = 17,
23 SDK_VERSION_JELLY_BEAN_MR2 = 18,
24 SDK_VERSION_KITKAT = 19,
25 SDK_VERSION_KITKAT_WEAR = 20,
26 SDK_VERSION_LOLLIPOP = 21
29 // BuildInfo is a singleton class that stores android build and device
30 // information. It will be called from Android specific code and gets used
31 // primarily in crash reporting.
33 // It is also used to store the last java exception seen during JNI.
34 // TODO(nileshagrawal): Find a better place to store this info.
35 class BASE_EXPORT BuildInfo {
36 public:
38 ~BuildInfo() {}
40 // Static factory method for getting the singleton BuildInfo instance.
41 // Note that ownership is not conferred on the caller and the BuildInfo in
42 // question isn't actually freed until shutdown. This is ok because there
43 // should only be one instance of BuildInfo ever created.
44 static BuildInfo* GetInstance();
46 // Const char* is used instead of std::strings because these values must be
47 // available even if the process is in a crash state. Sadly
48 // std::string.c_str() doesn't guarantee that memory won't be allocated when
49 // it is called.
50 const char* device() const {
51 return device_;
54 const char* manufacturer() const {
55 return manufacturer_;
58 const char* model() const {
59 return model_;
62 const char* brand() const {
63 return brand_;
66 const char* android_build_id() const {
67 return android_build_id_;
70 const char* android_build_fp() const {
71 return android_build_fp_;
74 const char* package_version_code() const {
75 return package_version_code_;
78 const char* package_version_name() const {
79 return package_version_name_;
82 const char* package_label() const {
83 return package_label_;
86 const char* package_name() const {
87 return package_name_;
90 const char* build_type() const {
91 return build_type_;
94 int sdk_int() const {
95 return sdk_int_;
98 const char* java_exception_info() const {
99 return java_exception_info_;
102 void SetJavaExceptionInfo(const std::string& info);
104 void ClearJavaExceptionInfo();
106 static bool RegisterBindings(JNIEnv* env);
108 private:
109 friend struct BuildInfoSingletonTraits;
111 explicit BuildInfo(JNIEnv* env);
113 // Const char* is used instead of std::strings because these values must be
114 // available even if the process is in a crash state. Sadly
115 // std::string.c_str() doesn't guarantee that memory won't be allocated when
116 // it is called.
117 const char* const device_;
118 const char* const manufacturer_;
119 const char* const model_;
120 const char* const brand_;
121 const char* const android_build_id_;
122 const char* const android_build_fp_;
123 const char* const package_version_code_;
124 const char* const package_version_name_;
125 const char* const package_label_;
126 const char* const package_name_;
127 const char* const build_type_;
128 const int sdk_int_;
129 // This is set via set_java_exception_info, not at constructor time.
130 const char* java_exception_info_;
132 DISALLOW_COPY_AND_ASSIGN(BuildInfo);
135 } // namespace android
136 } // namespace base
138 #endif // BASE_ANDROID_BUILD_INFO_H_