OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2010 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/chromeos/dom_ui/cros_personal_options_handler.h" |
| 6 |
| 7 #include "app/l10n_util.h" |
| 8 #include "base/values.h" |
| 9 #include "chrome/browser/chromeos/login/user_manager.h" |
| 10 #include "chrome/browser/dom_ui/dom_ui_util.h" |
| 11 #include "grit/generated_resources.h" |
| 12 #include "third_party/skia/include/core/SkBitmap.h" |
| 13 |
| 14 namespace chromeos { |
| 15 |
| 16 CrosPersonalOptionsHandler::CrosPersonalOptionsHandler() { |
| 17 } |
| 18 |
| 19 CrosPersonalOptionsHandler::~CrosPersonalOptionsHandler() { |
| 20 } |
| 21 |
| 22 void CrosPersonalOptionsHandler::GetLocalizedValues( |
| 23 DictionaryValue* localized_strings) { |
| 24 localized_strings->SetString("account", |
| 25 l10n_util::GetStringUTF16(IDS_OPTIONS_PERSONAL_ACCOUNT_GROUP_NAME)); |
| 26 localized_strings->SetString("enable_screenlock", |
| 27 l10n_util::GetStringUTF16(IDS_OPTIONS_ENABLE_SCREENLOCKER_CHECKBOX)); |
| 28 } |
| 29 |
| 30 void CrosPersonalOptionsHandler::RegisterMessages() { |
| 31 dom_ui_->RegisterMessageCallback( |
| 32 "loadAccountPicture", |
| 33 NewCallback(this, &CrosPersonalOptionsHandler::LoadAccountPicture)); |
| 34 } |
| 35 |
| 36 void CrosPersonalOptionsHandler::LoadAccountPicture(const ListValue* args) { |
| 37 const SkBitmap& account_picture = |
| 38 UserManager::Get()->logged_in_user().image(); |
| 39 |
| 40 if (!account_picture.isNull()) { |
| 41 StringValue data_url(dom_ui_util::GetImageDataUrl(account_picture)); |
| 42 dom_ui_->CallJavascriptFunction(L"PersonalOptions.setAccountPicture", |
| 43 data_url); |
| 44 } |
| 45 } |
| 46 |
| 47 } // namespace chromeos |
| 48 |
OLD | NEW |