diff options
author | derekjchow <derekjchow@chromium.org> | 2015-04-22 19:07:49 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-04-23 02:09:06 +0000 |
commit | aee21a7b4f2dbbcee1fb2f2d812fc711df7f7fc1 (patch) | |
tree | 464d15c22743fdddf46bf09d024717c49a458108 | |
parent | adc058c18eea7df1e989ca3097cc84be8efd3ded (diff) | |
download | chromium_src-aee21a7b4f2dbbcee1fb2f2d812fc711df7f7fc1.zip chromium_src-aee21a7b4f2dbbcee1fb2f2d812fc711df7f7fc1.tar.gz chromium_src-aee21a7b4f2dbbcee1fb2f2d812fc711df7f7fc1.tar.bz2 |
[Chromecast] CastSysInfo implementation.
Adds CastSysInfo. This class is platform dependent and provides
some basic information about the platform it is running on.
R=gunsch@chromium.org,byungchul@chromium.org
BUG=
Review URL: https://codereview.chromium.org/1092283003
Cr-Commit-Position: refs/heads/master@{#326424}
-rw-r--r-- | chromecast/DEPS | 1 | ||||
-rw-r--r-- | chromecast/base/cast_sys_info_dummy.cc | 67 | ||||
-rw-r--r-- | chromecast/base/cast_sys_info_dummy.h | 39 | ||||
-rw-r--r-- | chromecast/base/cast_sys_info_util.h | 21 | ||||
-rw-r--r-- | chromecast/base/cast_sys_info_util_simple.cc | 16 | ||||
-rw-r--r-- | chromecast/chromecast.gyp | 22 | ||||
-rw-r--r-- | chromecast/public/DEPS | 8 | ||||
-rw-r--r-- | chromecast/public/cast_sys_info.h | 62 |
8 files changed, 236 insertions, 0 deletions
diff --git a/chromecast/DEPS b/chromecast/DEPS index d278340..eae26b0 100644 --- a/chromecast/DEPS +++ b/chromecast/DEPS @@ -5,6 +5,7 @@ include_rules = [ # sub-directory within chromecast/. "-chromecast", "+chromecast/base", + "+chromecast/public", # Other Chromecast-wide dependencies. "+content/public/common", diff --git a/chromecast/base/cast_sys_info_dummy.cc b/chromecast/base/cast_sys_info_dummy.cc new file mode 100644 index 0000000..92c39a9 --- /dev/null +++ b/chromecast/base/cast_sys_info_dummy.cc @@ -0,0 +1,67 @@ +// Copyright 2015 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. + +#include "chromecast/base/cast_sys_info_dummy.h" + +namespace chromecast { + +CastSysInfoDummy::CastSysInfoDummy() { +} + +CastSysInfoDummy::~CastSysInfoDummy() { +} + +CastSysInfo::BuildType CastSysInfoDummy::GetBuildType() { + return BUILD_ENG; +} + +std::string CastSysInfoDummy::GetSystemReleaseChannel() { + return ""; +} + +std::string CastSysInfoDummy::GetSerialNumber() { + return "dummy.serial.number"; +} + +std::string CastSysInfoDummy::GetProductName() { + return ""; +} + +std::string CastSysInfoDummy::GetDeviceModel() { + return ""; +} + +std::string CastSysInfoDummy::GetBoardName() { + return ""; +} + +std::string CastSysInfoDummy::GetBoardRevision() { + return ""; +} + +std::string CastSysInfoDummy::GetManufacturer() { + return ""; +} + +std::string CastSysInfoDummy::GetSystemBuildNumber() { + return ""; +} + +std::string CastSysInfoDummy::GetFactoryCountry() { + return "US"; +} + +std::string CastSysInfoDummy::GetFactoryLocale(std::string* second_locale) { + return "en-US"; +} + +std::string CastSysInfoDummy::GetWifiInterface() { + return ""; +} + +std::string CastSysInfoDummy::GetApInterface() { + return ""; +} + +} // namespace chromecast diff --git a/chromecast/base/cast_sys_info_dummy.h b/chromecast/base/cast_sys_info_dummy.h new file mode 100644 index 0000000..0b804a2 --- /dev/null +++ b/chromecast/base/cast_sys_info_dummy.h @@ -0,0 +1,39 @@ +// Copyright 2015 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 CHROMECAST_BASE_CAST_SYS_INFO_DUMMY_H_ +#define CHROMECAST_BASE_CAST_SYS_INFO_DUMMY_H_ + +#include "base/macros.h" +#include "chromecast/public/cast_sys_info.h" + +namespace chromecast { + +class CastSysInfoDummy : public CastSysInfo { + public: + CastSysInfoDummy(); + ~CastSysInfoDummy() override; + + // CastSysInfo implementation: + BuildType GetBuildType() override; + std::string GetSystemReleaseChannel() override; + std::string GetSerialNumber() override; + std::string GetProductName() override; + std::string GetDeviceModel() override; + std::string GetBoardName() override; + std::string GetBoardRevision() override; + std::string GetManufacturer() override; + std::string GetSystemBuildNumber() override; + std::string GetFactoryCountry() override; + std::string GetFactoryLocale(std::string* second_locale) override; + std::string GetWifiInterface() override; + std::string GetApInterface() override; + + private: + DISALLOW_COPY_AND_ASSIGN(CastSysInfoDummy); +}; + +} // namespace chromecast + +#endif // CHROMECAST_BASE_CAST_SYS_INFO_DUMMY_H_ diff --git a/chromecast/base/cast_sys_info_util.h b/chromecast/base/cast_sys_info_util.h new file mode 100644 index 0000000..05ca069 --- /dev/null +++ b/chromecast/base/cast_sys_info_util.h @@ -0,0 +1,21 @@ +// Copyright 2015 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 CHROMECAST_BASE_CAST_SYS_INFO_UTIL_H_ +#define CHROMECAST_BASE_CAST_SYS_INFO_UTIL_H_ + +#include <string> +#include <vector> + +#include "base/memory/scoped_ptr.h" + +namespace chromecast { + +class CastSysInfo; + +scoped_ptr<CastSysInfo> CreateSysInfo(); + +} // namespace chromecast + +#endif // CHROMECAST_BASE_CAST_SYS_INFO_UTIL_H_ diff --git a/chromecast/base/cast_sys_info_util_simple.cc b/chromecast/base/cast_sys_info_util_simple.cc new file mode 100644 index 0000000..68ab9df --- /dev/null +++ b/chromecast/base/cast_sys_info_util_simple.cc @@ -0,0 +1,16 @@ +// Copyright 2015 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. + +#include "chromecast/base/cast_sys_info_util.h" + +#include "chromecast/base/cast_sys_info_dummy.h" + +namespace chromecast { + +// static +scoped_ptr<CastSysInfo> CreateSysInfo() { + return make_scoped_ptr(new CastSysInfoDummy()); +} + +} // namespace chromecast diff --git a/chromecast/chromecast.gyp b/chromecast/chromecast.gyp index f6056b0..5c2e49c 100644 --- a/chromecast/chromecast.gyp +++ b/chromecast/chromecast.gyp @@ -38,6 +38,7 @@ 'sources': [ 'public/cast_egl_platform.h', 'public/cast_egl_platform_shlib.h', + 'public/cast_sys_info.h', 'public/chromecast_export.h', 'public/graphics_properties_shlib.h' ], @@ -179,6 +180,7 @@ 'cast_net', 'cast_shell_pak', 'cast_shell_resources', + 'cast_sys_info', 'cast_version_header', 'chromecast_locales.gyp:chromecast_locales_pak', 'chromecast_locales.gyp:chromecast_settings', @@ -316,6 +318,26 @@ ], }, { + 'target_name': 'cast_sys_info', + 'type': '<(component)', + 'dependencies': [ + 'cast_public_api', + '../base/base.gyp:base', + ], + 'sources': [ + 'base/cast_sys_info_util.h', + 'base/cast_sys_info_dummy.cc', + 'base/cast_sys_info_dummy.h', + ], + 'conditions': [ + ['chromecast_branding!="Chrome"', { + 'sources': [ + 'base/cast_sys_info_util_simple.cc', + ], + }], + ], + }, # end of target 'cast_sys_info' + { 'target_name': 'cast_version_header', 'type': 'none', 'direct_dependent_settings': { diff --git a/chromecast/public/DEPS b/chromecast/public/DEPS new file mode 100644 index 0000000..30d9ea2 --- /dev/null +++ b/chromecast/public/DEPS @@ -0,0 +1,8 @@ +include_rules = [ + # chromecast/public should not depend on anything Chromium specific + "-chromecast", + "-base", + "-content", + "-net", + "-ui", +] diff --git a/chromecast/public/cast_sys_info.h b/chromecast/public/cast_sys_info.h new file mode 100644 index 0000000..95d1da6 --- /dev/null +++ b/chromecast/public/cast_sys_info.h @@ -0,0 +1,62 @@ +// Copyright 2015 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 CHROMECAST_PUBLIC_CAST_SYS_INFO_H_ +#define CHROMECAST_PUBLIC_CAST_SYS_INFO_H_ + +#include <string> +#include <vector> + +namespace chromecast { + +// Pure abstract interface for system information which is accessed by other +// processes as well as cast_shell browser process. All information should be +// immutable. +// It should be possible to instantiate multiple instances of CastSysInfo and +// should be able to be instantiated at any point in the startup process. Other +// processes must be able to create an instance of CastSysInfo. +class CastSysInfo { + public: + enum BuildType { + BUILD_ENG, + BUILD_BETA, + BUILD_PRODUCTION, + }; + + virtual ~CastSysInfo() {} + + // Returns the system build type. + virtual BuildType GetBuildType() = 0; + // Returns release channel of system. + virtual std::string GetSystemReleaseChannel() = 0; + // Returns serial number of the device. + virtual std::string GetSerialNumber() = 0; + // Returns product code name of the device. + virtual std::string GetProductName() = 0; + // Returns model name of device (eg: Chromecast, Nexus Player, ...). + virtual std::string GetDeviceModel() = 0; + // Returns the board's name. + virtual std::string GetBoardName() = 0; + // Returns the revision of board (eg: 514, ...). + virtual std::string GetBoardRevision() = 0; + // Returns device manufacturer (eg: Google, ...). + virtual std::string GetManufacturer() = 0; + // Returns the system's build number (eg: 100, 20000 ...). + // This describes system version which may be different with + // CAST_BUILD_NUMBER. + virtual std::string GetSystemBuildNumber() = 0; + + // Returns default country and locale baked from the factory. + virtual std::string GetFactoryCountry() = 0; + virtual std::string GetFactoryLocale(std::string* second_locale) = 0; + + // Returns the name of the wifi interface used to connect to the internet. + virtual std::string GetWifiInterface() = 0; + // Returns the name of the software AP interface. + virtual std::string GetApInterface() = 0; +}; + +} // namespace chromecast + +#endif // CHROMECAST_PUBLIC_CAST_SYS_INFO_H_ |