Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/chromeos/chromeos_utils.h" | 5 #include "chrome/browser/chromeos/chromeos_utils.h" |
| 6 | 6 |
| 7 #include "base/strings/string_util.h" | 7 #include "base/strings/string_util.h" |
| 8 #include "base/sys_info.h" | 8 #include "base/sys_info.h" |
| 9 #include "chrome/grit/generated_resources.h" | 9 #include "chrome/grit/generated_resources.h" |
| 10 #include "ui/base/l10n/l10n_util.h" | 10 #include "ui/base/l10n/l10n_util.h" |
| 11 | 11 |
| 12 namespace chromeos { | 12 namespace chromeos { |
| 13 | 13 |
| 14 namespace { | 14 namespace { |
| 15 | 15 |
| 16 // List of ChromeOS board names corresponding to Chromebase devices. Googlers | 16 // List of ChromeOS board names corresponding to Chromebase devices. Googlers |
| 17 // can find a list of ChromeOS device and board names at http://go/cros-names | 17 // can find a list of ChromeOS device and board names at http://go/cros-names |
| 18 const char* const kChromebaseBoards[] = { | 18 const char* const kChromebaseBoards[] = { |
| 19 "monroe", | 19 "monroe", |
|
xiyuan
2015/03/31 20:33:51
nit: update indent here too?
Tim Song
2015/03/31 20:49:53
Done.
| |
| 20 }; | 20 }; |
| 21 | 21 |
| 22 // List of ChromeOS board names corresponding to Chromebox devices. Googlers | 22 // List of ChromeOS board names corresponding to Chromebox devices. Googlers |
| 23 // can find a list of ChromeOS device and board names at http://go/cros-names | 23 // can find a list of ChromeOS device and board names at http://go/cros-names |
| 24 const char* const kChromeboxBoards[] = { | 24 const char* const kChromeboxBoards[] = { |
| 25 "panther", | 25 "panther", |
| 26 "stumpy", | 26 "stumpy", |
| 27 "zako", | 27 "zako", |
| 28 "tricky", | |
| 29 "mccloud", | |
| 30 }; | |
| 31 | |
| 32 // List of ChromeOS board names corresponding to Chromebit devices. Googlers | |
| 33 // can find a list of ChromeOS device and board names at http://go/cros-names | |
| 34 const char* const kChromebitBoards[] = { | |
| 35 "veyron_brain", | |
| 28 }; | 36 }; |
| 29 | 37 |
| 30 } // namespace | 38 } // namespace |
| 31 | 39 |
| 32 namespace chrome_device_types { | 40 namespace chrome_device_types { |
| 33 | 41 |
| 34 const char kChromebox[] = "chromebox"; | 42 const char kChromebox[] = "chromebox"; |
| 35 const char kChromebase[] = "chromebase"; | 43 const char kChromebase[] = "chromebase"; |
| 44 const char kChromebit[] = "chromebit"; | |
| 36 const char kChromebook[] = "chromebook"; | 45 const char kChromebook[] = "chromebook"; |
| 37 | 46 |
| 38 } // namespace chrome_device_types | 47 } // namespace chrome_device_types |
| 39 | 48 |
| 40 base::string16 GetChromeDeviceType() { | 49 base::string16 GetChromeDeviceType() { |
| 41 return l10n_util::GetStringUTF16(GetChromeDeviceTypeResourceId()); | 50 return l10n_util::GetStringUTF16(GetChromeDeviceTypeResourceId()); |
| 42 } | 51 } |
| 43 | 52 |
| 44 int GetChromeDeviceTypeResourceId() { | 53 int GetChromeDeviceTypeResourceId() { |
| 45 const std::string board = base::SysInfo::GetLsbReleaseBoard(); | 54 const std::string board = base::SysInfo::GetLsbReleaseBoard(); |
| 46 for (size_t i = 0; i < arraysize(kChromeboxBoards); ++i) { | 55 for (size_t i = 0; i < arraysize(kChromeboxBoards); ++i) { |
| 47 if (StartsWithASCII(board, kChromeboxBoards[i], true)) | 56 if (StartsWithASCII(board, kChromeboxBoards[i], true)) |
| 48 return IDS_CHROMEBOX; | 57 return IDS_CHROMEBOX; |
| 49 } | 58 } |
| 50 for (size_t i = 0; i < arraysize(kChromebaseBoards); ++i) { | 59 for (size_t i = 0; i < arraysize(kChromebaseBoards); ++i) { |
| 51 if (StartsWithASCII(board, kChromebaseBoards[i], true)) | 60 if (StartsWithASCII(board, kChromebaseBoards[i], true)) |
| 52 return IDS_CHROMEBASE; | 61 return IDS_CHROMEBASE; |
| 53 } | 62 } |
| 63 for (size_t i = 0; i < arraysize(kChromebitBoards); ++i) { | |
| 64 if (StartsWithASCII(board, kChromebitBoards[i], true)) | |
| 65 return IDS_CHROMEBIT; | |
| 66 } | |
| 54 return IDS_CHROMEBOOK; | 67 return IDS_CHROMEBOOK; |
| 55 } | 68 } |
| 56 | 69 |
| 57 std::string GetChromeDeviceTypeString() { | 70 std::string GetChromeDeviceTypeString() { |
| 58 int resource_id = GetChromeDeviceTypeResourceId(); | 71 int resource_id = GetChromeDeviceTypeResourceId(); |
| 59 switch (resource_id) { | 72 switch (resource_id) { |
| 60 case IDS_CHROMEBOX: | 73 case IDS_CHROMEBOX: |
| 61 return chrome_device_types::kChromebox; | 74 return chrome_device_types::kChromebox; |
| 62 case IDS_CHROMEBASE: | 75 case IDS_CHROMEBASE: |
| 63 return chrome_device_types::kChromebase; | 76 return chrome_device_types::kChromebase; |
| 77 case IDS_CHROMEBIT: | |
| 78 return chrome_device_types::kChromebit; | |
| 64 default: | 79 default: |
| 65 NOTREACHED() << "Unknown Chrome device type: " << resource_id; | 80 NOTREACHED() << "Unknown Chrome device type: " << resource_id; |
| 66 case IDS_CHROMEBOOK: | 81 case IDS_CHROMEBOOK: |
| 67 return chrome_device_types::kChromebook; | 82 return chrome_device_types::kChromebook; |
| 68 } | 83 } |
| 69 } | 84 } |
| 70 | 85 |
| 71 } // namespace chromeos | 86 } // namespace chromeos |
| OLD | NEW |