Index: chrome/browser/ui/webui/chromeos/ui_account_tweaks.cc |
diff --git a/chrome/browser/ui/webui/chromeos/ui_account_tweaks.cc b/chrome/browser/ui/webui/chromeos/ui_account_tweaks.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..9cc49812672bdee2f7a5ec0172e0b58a59c622ec |
--- /dev/null |
+++ b/chrome/browser/ui/webui/chromeos/ui_account_tweaks.cc |
@@ -0,0 +1,43 @@ |
+// 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. |
+ |
+#include "chrome/browser/ui/webui/chromeos/ui_account_tweaks.h" |
+ |
+#include "base/utf_string_conversions.h" |
+#include "base/values.h" |
+#include "chrome/browser/chromeos/cros_settings.h" |
+#include "chrome/browser/chromeos/cros_settings_names.h" |
+#include "chrome/browser/chromeos/login/user_manager.h" |
+ |
+namespace chromeos { |
+ |
+void AddAccountUITweaksLocalizedValues( |
+ base::DictionaryValue* localized_strings) { |
+ DCHECK(localized_strings); |
+ |
+ std::string owner_email; |
+ CrosSettings::Get()->GetString(kDeviceOwner, &owner_email); |
+ // Translate owner's email to the display email. |
+ std::string display_email = |
+ UserManager::Get()->GetUserDisplayEmail(owner_email); |
+ localized_strings->SetString("ownerUserId", UTF8ToUTF16(display_email)); |
+ |
+ localized_strings->SetString("currentUserIsOwner", |
+ UserManager::Get()->IsCurrentUserOwner() ? |
+ ASCIIToUTF16("true") : ASCIIToUTF16("false")); |
+ |
+ localized_strings->SetString("loggedInAsGuest", |
+ chromeos::UserManager::Get()->IsLoggedInAsGuest() ? |
+ ASCIIToUTF16("true") : ASCIIToUTF16("false")); |
+} |
+ |
+void AddAccountUITweaksLocalizedValues( |
+ ChromeWebUIDataSource* source) { |
+ DCHECK(source); |
+ DictionaryValue dict; |
+ AddAccountUITweaksLocalizedValues(&dict); |
+ source->AddLocalizedStrings(dict); |
+} |
+ |
+} // namespace chromeos |