Index: base/android/build_info.h |
diff --git a/base/android/build_info.h b/base/android/build_info.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..f1e7dae1596bbd9e0d97b27d278c8fbff258ffde |
--- /dev/null |
+++ b/base/android/build_info.h |
@@ -0,0 +1,57 @@ |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef BASE_ANDROID_BUILD_INFO_H_ |
+#define BASE_ANDROID_BUILD_INFO_H_ |
+ |
+#include <jni.h> |
+#include <string> |
Mark Mentovai
2012/04/05 14:28:03
Separate C system headers from C++ system headers
carlosvaldivia
2012/04/05 18:35:56
Done.
|
+ |
+namespace base { |
+namespace android { |
+ |
+ |
Mark Mentovai
2012/04/05 14:28:03
Get rid of this extra blank line and the one at li
carlosvaldivia
2012/04/05 18:35:56
Done.
|
+// BuildInfo is a singleton class that stores android build and device |
+// information. |
+class BuildInfo { |
+ public: |
+ |
+ // Static factory method for getting the singleton BuildInfo instance. |
Mark Mentovai
2012/04/05 14:28:03
Observe the proper ordering within a class, per ht
carlosvaldivia
2012/04/05 18:35:56
Done.
|
+ static const BuildInfo* const GetInstance(); |
Mark Mentovai
2012/04/05 14:28:03
Say somewhere that this leaks all of its data and
Mark Mentovai
2012/04/05 14:28:03
Consider using a Singleton (base/memory/singleton.
carlosvaldivia
2012/04/05 18:35:56
Done.
carlosvaldivia
2012/04/05 18:35:56
I'll get to that along with the linux/posix_breakp
|
+ |
+ ~BuildInfo() {}; |
Mark Mentovai
2012/04/05 14:28:03
The semicolon; is unnecessary.
carlosvaldivia
2012/04/05 18:35:56
Done.
|
+ |
+ // We use const char* instead of std::strings because we need to have these |
Mark Mentovai
2012/04/05 14:28:03
Don”t write “we” in comments.
carlosvaldivia
2012/04/05 18:35:56
Done.
|
+ // values available even if the process is in a crash state. Sadly |
+ // std::string.c_str() doesn't guarantee that memory won't be allocated when |
+ // it is called. |
+ const char* device; |
Mark Mentovai
2012/04/05 14:28:03
Data members should always be private. http://goog
carlosvaldivia
2012/04/05 18:35:56
Done.
|
+ const char* model; |
+ const char* brand; |
+ const char* android_build_id; |
+ const char* android_build_fp; |
+ const char* package_version_code; |
+ const char* package_version_name; |
+ |
+ private: |
+ static BuildInfo* instance_; |
Mark Mentovai
2012/04/05 14:28:03
private + static + used directly only in one file?
carlosvaldivia
2012/04/05 18:35:56
It is a jni wrapper. There is java code that uses
|
+ |
+ BuildInfo( |
+ const char* device, |
+ const char* model, |
+ const char* brand, |
+ const char* android_build_id, |
+ const char* android_build_fp, |
+ const char* package_version_code, |
+ const char* package_version_name); |
+ |
Mark Mentovai
2012/04/05 14:28:03
DISALLOW_COPY_AND_ASSIGN?
carlosvaldivia
2012/04/05 18:35:56
Done.
|
+}; |
+ |
+bool RegisterBuildInfo(JNIEnv* env); |
+ |
+} // namespace android |
+} // namespace base |
+ |
+ |
+#endif // BASE_ANDROID_BUILD_INFO_H_ |