Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1795)

Unified Diff: chrome/browser/chromeos/extensions/info_private_api.cc

Issue 308913004: cros: Expose client_id via chromeosInfoPrivate. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove sn since not working Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/common/extensions/api/chromeos_info_private.json » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/extensions/info_private_api.cc
diff --git a/chrome/browser/chromeos/extensions/info_private_api.cc b/chrome/browser/chromeos/extensions/info_private_api.cc
index c6079c36752f2aebf6a28ae68335a5281f44dcae..9d4d48288d01f16b9f8674f7de8cb7985a4cc8f4 100644
--- a/chrome/browser/chromeos/extensions/info_private_api.cc
+++ b/chrome/browser/chromeos/extensions/info_private_api.cc
@@ -8,10 +8,14 @@
#include "base/prefs/pref_service.h"
#include "base/sys_info.h"
#include "base/values.h"
+#include "chrome/browser/app_mode/app_mode_utils.h"
+#include "chrome/browser/browser_process.h"
#include "chrome/browser/chromeos/login/startup_utils.h"
#include "chrome/browser/chromeos/login/users/user_manager.h"
+#include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
#include "chrome/browser/chromeos/settings/cros_settings.h"
#include "chrome/browser/chromeos/system/timezone_util.h"
+#include "chrome/browser/metrics/metrics_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/pref_names.h"
#include "chromeos/network/device_state.h"
@@ -43,9 +47,12 @@ const char kPropertyInitialLocale[] = "initialLocale";
// Key which corresponds to the board property in JS.
const char kPropertyBoard[] = "board";
-// Key which corresponds to the board property in JS.
+// Key which corresponds to the isOwner property in JS.
const char kPropertyOwner[] = "isOwner";
+// Key which corresponds to the clientId property in JS.
+const char kPropertyClientId[] = "clientId";
+
// Key which corresponds to the timezone property in JS.
const char kPropertyTimezone[] = "timezone";
@@ -103,6 +110,21 @@ const char* GetBoolPrefNameForApiProperty(const char* api_name) {
return NULL;
}
+bool IsEnterpriseKiosk() {
+ if (!chrome::IsRunningInForcedAppMode())
+ return false;
+
+ policy::BrowserPolicyConnectorChromeOS* connector =
+ g_browser_process->platform_part()->browser_policy_connector_chromeos();
+ return connector->IsEnterpriseManaged();
+}
+
+std::string GetClientId() {
+ return IsEnterpriseKiosk()
+ ? g_browser_process->metrics_service()->GetClientId()
+ : std::string();
+}
+
} // namespace
ChromeosInfoPrivateGetFunction::ChromeosInfoPrivateGetFunction() {
@@ -158,6 +180,8 @@ base::Value* ChromeosInfoPrivateGetFunction::GetValue(
} else if (property_name == kPropertyOwner) {
return base::Value::CreateBooleanValue(
chromeos::UserManager::Get()->IsCurrentUserOwner());
+ } else if (property_name == kPropertyClientId) {
+ return base::Value::CreateStringValue(GetClientId());
} else if (property_name == kPropertyTimezone) {
return chromeos::CrosSettings::Get()->GetPref(
chromeos::kSystemTimezone)->DeepCopy();
« no previous file with comments | « no previous file | chrome/common/extensions/api/chromeos_info_private.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698