| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/login/user_image_view.h" | 5 #include "chrome/browser/chromeos/login/user_image_view.h" |
| 6 | 6 |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "chrome/browser/chromeos/login/default_images_view.h" | 8 #include "chrome/browser/chromeos/login/default_images_view.h" |
| 9 #include "chrome/browser/chromeos/login/default_user_images.h" | 9 #include "chrome/browser/chromeos/login/default_user_images.h" |
| 10 #include "chrome/browser/chromeos/login/helper.h" | 10 #include "chrome/browser/chromeos/login/helper.h" |
| 11 #include "chrome/browser/chromeos/login/rounded_rect_painter.h" | 11 #include "chrome/browser/chromeos/login/rounded_rect_painter.h" |
| 12 #include "chrome/browser/chromeos/login/user_manager.h" |
| 12 #include "grit/generated_resources.h" | 13 #include "grit/generated_resources.h" |
| 13 #include "grit/theme_resources.h" | 14 #include "grit/theme_resources.h" |
| 14 #include "ui/base/l10n/l10n_util.h" | 15 #include "ui/base/l10n/l10n_util.h" |
| 15 #include "ui/base/resource/resource_bundle.h" | 16 #include "ui/base/resource/resource_bundle.h" |
| 16 #include "ui/gfx/canvas.h" | 17 #include "ui/gfx/canvas.h" |
| 17 #include "views/background.h" | 18 #include "views/background.h" |
| 18 #include "views/controls/button/native_button.h" | 19 #include "views/controls/button/native_button.h" |
| 19 #include "views/controls/label.h" | 20 #include "views/controls/label.h" |
| 20 #include "views/layout/grid_layout.h" | 21 #include "views/layout/grid_layout.h" |
| 21 | 22 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 splitter_ = CreateSplitter(kSplitterColor); | 85 splitter_ = CreateSplitter(kSplitterColor); |
| 85 | 86 |
| 86 ok_button_ = new login::WideButton( | 87 ok_button_ = new login::WideButton( |
| 87 this, UTF16ToWide(l10n_util::GetStringUTF16(IDS_OK))); | 88 this, UTF16ToWide(l10n_util::GetStringUTF16(IDS_OK))); |
| 88 ok_button_->SetEnabled(false); | 89 ok_button_->SetEnabled(false); |
| 89 | 90 |
| 90 InitLayout(); | 91 InitLayout(); |
| 91 | 92 |
| 92 default_images_view_->Init(); | 93 default_images_view_->Init(); |
| 93 take_photo_view_->Init(); | 94 take_photo_view_->Init(); |
| 95 |
| 96 UserManager* user_manager = UserManager::Get(); |
| 97 const std::string& logged_in_user = user_manager->logged_in_user().email(); |
| 98 int image_index = user_manager->GetUserDefaultImageIndex(logged_in_user); |
| 99 |
| 100 default_images_view_->SetDefaultImageIndex(image_index); |
| 94 } | 101 } |
| 95 | 102 |
| 96 void UserImageView::InitLayout() { | 103 void UserImageView::InitLayout() { |
| 97 views::GridLayout* layout = new views::GridLayout(this); | 104 views::GridLayout* layout = new views::GridLayout(this); |
| 98 layout->SetInsets(GetInsets()); | 105 layout->SetInsets(GetInsets()); |
| 99 SetLayoutManager(layout); | 106 SetLayoutManager(layout); |
| 100 | 107 |
| 101 // The title, left-top aligned. | 108 // The title, left-top aligned. |
| 102 views::ColumnSet* column_set = layout->AddColumnSet(kTitleRow); | 109 views::ColumnSet* column_set = layout->AddColumnSet(kTitleRow); |
| 103 column_set->AddPaddingColumn(0, kHorizontalMargin); | 110 column_set->AddPaddingColumn(0, kHorizontalMargin); |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 return; | 230 return; |
| 224 delegate_->StopCamera(); | 231 delegate_->StopCamera(); |
| 225 ok_button_->SetEnabled(true); | 232 ok_button_->SetEnabled(true); |
| 226 ok_button_->RequestFocus(); | 233 ok_button_->RequestFocus(); |
| 227 take_photo_view_->SetImage( | 234 take_photo_view_->SetImage( |
| 228 ResourceBundle::GetSharedInstance().GetBitmapNamed( | 235 ResourceBundle::GetSharedInstance().GetBitmapNamed( |
| 229 kDefaultImageResources[image_index])); | 236 kDefaultImageResources[image_index])); |
| 230 } | 237 } |
| 231 | 238 |
| 232 } // namespace chromeos | 239 } // namespace chromeos |
| OLD | NEW |