| 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 <string> | |
| 8 | |
| 9 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
| 11 #include "chrome/browser/chromeos/login/default_images_view.h" | 9 #include "chrome/browser/chromeos/login/default_images_view.h" |
| 12 #include "chrome/browser/chromeos/login/default_user_images.h" | 10 #include "chrome/browser/chromeos/login/default_user_images.h" |
| 13 #include "chrome/browser/chromeos/login/helper.h" | 11 #include "chrome/browser/chromeos/login/helper.h" |
| 14 #include "chrome/browser/chromeos/login/rounded_rect_painter.h" | 12 #include "chrome/browser/chromeos/login/rounded_rect_painter.h" |
| 15 #include "chrome/browser/chromeos/login/user_manager.h" | 13 #include "chrome/browser/chromeos/login/user_manager.h" |
| 16 #include "chrome/browser/policy/browser_policy_connector.h" | 14 #include "chrome/browser/policy/browser_policy_connector.h" |
| 17 #include "grit/generated_resources.h" | 15 #include "grit/generated_resources.h" |
| 18 #include "grit/theme_resources.h" | 16 #include "grit/theme_resources.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 42 const int kVerticalPadding = 10; | 40 const int kVerticalPadding = 10; |
| 43 // Color for splitter separating contents from OK button. | 41 // Color for splitter separating contents from OK button. |
| 44 const SkColor kSplitterColor = SkColorSetRGB(187, 195, 200); | 42 const SkColor kSplitterColor = SkColorSetRGB(187, 195, 200); |
| 45 // Height for the splitter. | 43 // Height for the splitter. |
| 46 const int kSplitterHeight = 1; | 44 const int kSplitterHeight = 1; |
| 47 | 45 |
| 48 // IDs of column sets for grid layout manager. | 46 // IDs of column sets for grid layout manager. |
| 49 enum ColumnSets { | 47 enum ColumnSets { |
| 50 kTitleRow, // Column set for screen title. | 48 kTitleRow, // Column set for screen title. |
| 51 kImagesRow, // Column set for image from camera and snapshot button. | 49 kImagesRow, // Column set for image from camera and snapshot button. |
| 52 kSplitterRow, // Place for the splitter. | 50 kSplitterRow, // Place for the splitter. |
| 53 kButtonsRow, // Column set for OK button. | 51 kButtonsRow, // Column set for OK button. |
| 54 }; | 52 }; |
| 55 | 53 |
| 56 views::View* CreateSplitter(const SkColor& color) { | 54 views::View* CreateSplitter(const SkColor& color) { |
| 57 views::View* splitter = new views::View(); | 55 views::View* splitter = new views::View(); |
| 58 splitter->set_background(views::Background::CreateSolidBackground(color)); | 56 splitter->set_background(views::Background::CreateSolidBackground(color)); |
| 59 return splitter; | 57 return splitter; |
| 60 } | 58 } |
| 61 | 59 |
| 62 } // namespace | 60 } // namespace |
| (...skipping 12 matching lines...) Expand all Loading... |
| 75 UserImageView::~UserImageView() { | 73 UserImageView::~UserImageView() { |
| 76 } | 74 } |
| 77 | 75 |
| 78 void UserImageView::Init() { | 76 void UserImageView::Init() { |
| 79 // Use rounded rect background. | 77 // Use rounded rect background. |
| 80 set_border(CreateWizardBorder(&BorderDefinition::kScreenBorder)); | 78 set_border(CreateWizardBorder(&BorderDefinition::kScreenBorder)); |
| 81 views::Painter* painter = CreateWizardPainter( | 79 views::Painter* painter = CreateWizardPainter( |
| 82 &BorderDefinition::kScreenBorder); | 80 &BorderDefinition::kScreenBorder); |
| 83 set_background(views::Background::CreateBackgroundPainter(true, painter)); | 81 set_background(views::Background::CreateBackgroundPainter(true, painter)); |
| 84 | 82 |
| 85 title_label_ = new views::Label( | 83 title_label_ = new views::Label(UTF16ToWide( |
| 86 l10n_util::GetStringUTF16(IDS_OPTIONS_CHANGE_PICTURE_DIALOG_TEXT)); | 84 l10n_util::GetStringUTF16(IDS_OPTIONS_CHANGE_PICTURE_DIALOG_TEXT))); |
| 87 title_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); | 85 title_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); |
| 88 title_label_->SetMultiLine(true); | 86 title_label_->SetMultiLine(true); |
| 89 CorrectLabelFontSize(title_label_); | 87 CorrectLabelFontSize(title_label_); |
| 90 | 88 |
| 91 default_images_view_ = new DefaultImagesView(this); | 89 default_images_view_ = new DefaultImagesView(this); |
| 92 take_photo_view_ = new TakePhotoView(this); | 90 take_photo_view_ = new TakePhotoView(this); |
| 93 take_photo_view_->set_show_title(false); | 91 take_photo_view_->set_show_title(false); |
| 94 | 92 |
| 95 splitter_ = CreateSplitter(kSplitterColor); | 93 splitter_ = CreateSplitter(kSplitterColor); |
| 96 | 94 |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 return; | 284 return; |
| 287 delegate_->StopCamera(); | 285 delegate_->StopCamera(); |
| 288 ok_button_->SetEnabled(true); | 286 ok_button_->SetEnabled(true); |
| 289 ok_button_->RequestFocus(); | 287 ok_button_->RequestFocus(); |
| 290 take_photo_view_->SetImage( | 288 take_photo_view_->SetImage( |
| 291 ResourceBundle::GetSharedInstance().GetBitmapNamed( | 289 ResourceBundle::GetSharedInstance().GetBitmapNamed( |
| 292 kDefaultImageResources[image_index])); | 290 kDefaultImageResources[image_index])); |
| 293 } | 291 } |
| 294 | 292 |
| 295 } // namespace chromeos | 293 } // namespace chromeos |
| OLD | NEW |