OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "chrome/browser/ui/webui/chromeos/ui_account_tweaks.h" | |
6 | |
7 #include "base/bind.h" | |
Nikita (slow)
2012/04/06 12:36:09
Please cleanup headers. You don't need bind relate
Denis Kuznetsov (DE-MUC)
2012/04/09 11:21:30
Done.
| |
8 #include "base/bind_helpers.h" | |
9 #include "base/json/json_reader.h" | |
10 #include "base/memory/scoped_ptr.h" | |
11 #include "base/utf_string_conversions.h" | |
12 #include "base/values.h" | |
13 #include "chrome/browser/browser_process.h" | |
14 #include "chrome/browser/chromeos/cros_settings.h" | |
15 #include "chrome/browser/chromeos/cros_settings_names.h" | |
16 #include "chrome/browser/chromeos/login/authenticator.h" | |
17 #include "chrome/browser/chromeos/login/user_manager.h" | |
18 #include "chrome/browser/prefs/pref_service.h" | |
19 #include "chrome/browser/policy/browser_policy_connector.h" | |
20 #include "content/public/browser/web_ui.h" | |
21 #include "grit/generated_resources.h" | |
22 #include "ui/base/l10n/l10n_util.h" | |
23 | |
24 namespace chromeos { | |
25 | |
26 /** | |
27 * Fills given dictionary with account status data (whether current user is | |
Nikita (slow)
2012/04/06 12:36:09
This comment should be moved to header.
Denis Kuznetsov (DE-MUC)
2012/04/09 11:21:30
Done.
| |
28 * owner/guest, id of the owner). | |
29 */ | |
30 void AddAccountUITweaksLocalizedValues( | |
31 base::DictionaryValue* localized_strings) { | |
32 DCHECK(localized_strings); | |
33 | |
34 std::string owner_email; | |
35 CrosSettings::Get()->GetString(kDeviceOwner, &owner_email); | |
36 // Translate owner's email to the display email. | |
37 std::string display_email = | |
38 UserManager::Get()->GetUserDisplayEmail(owner_email); | |
39 localized_strings->SetString("ownerUserId", UTF8ToUTF16(display_email)); | |
40 | |
41 localized_strings->SetString("currentUserIsOwner", | |
42 UserManager::Get()->IsCurrentUserOwner() ? | |
43 ASCIIToUTF16("true") : ASCIIToUTF16("false")); | |
44 | |
45 localized_strings->SetString("loggedInAsGuest", | |
46 chromeos::UserManager::Get()->IsLoggedInAsGuest() ? | |
47 ASCIIToUTF16("true") : ASCIIToUTF16("false")); | |
48 } | |
49 | |
50 /** | |
51 * Fills given data source with account status data (whether current user is | |
Nikita (slow)
2012/04/06 12:36:09
Remove / move to header.
Denis Kuznetsov (DE-MUC)
2012/04/09 11:21:30
Done.
| |
52 * owner/guest, id of the owner). | |
53 */ | |
54 void AddAccountUITweaksLocalizedValues( | |
55 ChromeWebUIDataSource* source) { | |
56 DCHECK(source); | |
57 DictionaryValue dict; | |
58 AddAccountUITweaksLocalizedValues(&dict); | |
59 source->AddLocalizedStrings(dict); | |
60 } | |
61 | |
62 } // namespace chromeos | |
OLD | NEW |