| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 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 | 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_controller.h" | 5 #include "chrome/browser/chromeos/login/user_controller.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 | 40 |
| 41 namespace chromeos { | 41 namespace chromeos { |
| 42 | 42 |
| 43 namespace { | 43 namespace { |
| 44 | 44 |
| 45 // Gap between the border around the image/buttons and user name. | 45 // Gap between the border around the image/buttons and user name. |
| 46 const int kUserNameGap = 4; | 46 const int kUserNameGap = 4; |
| 47 | 47 |
| 48 // Approximate height of controls window, this constant is used in new user | 48 // Approximate height of controls window, this constant is used in new user |
| 49 // case to make border window size close to existing users. | 49 // case to make border window size close to existing users. |
| 50 const int kControlsHeight = 26; | 50 const int kControlsHeight = 28; |
| 51 | 51 |
| 52 // Widget that notifies window manager about clicking on itself. | 52 // Widget that notifies window manager about clicking on itself. |
| 53 // Doesn't send anything if user is selected. | 53 // Doesn't send anything if user is selected. |
| 54 class ClickNotifyingWidget : public views::WidgetGtk { | 54 class ClickNotifyingWidget : public views::WidgetGtk { |
| 55 public: | 55 public: |
| 56 ClickNotifyingWidget(views::WidgetGtk::Type type, | 56 ClickNotifyingWidget(views::WidgetGtk::Type type, |
| 57 UserController* controller) | 57 UserController* controller) |
| 58 : WidgetGtk(type), | 58 : WidgetGtk(type), |
| 59 controller_(controller) { | 59 controller_(controller) { |
| 60 } | 60 } |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 } else { | 358 } else { |
| 359 existing_user_view_ = new ExistingUserView(this); | 359 existing_user_view_ = new ExistingUserView(this); |
| 360 existing_user_view_->RecreateFields(); | 360 existing_user_view_->RecreateFields(); |
| 361 control_view = existing_user_view_; | 361 control_view = existing_user_view_; |
| 362 } | 362 } |
| 363 | 363 |
| 364 *height = kControlsHeight; | 364 *height = kControlsHeight; |
| 365 if (is_new_user_) | 365 if (is_new_user_) |
| 366 *height += kUserImageSize + kUserNameGap; | 366 *height += kUserImageSize + kUserNameGap; |
| 367 | 367 |
| 368 int width = kUserImageSize; |
| 368 WidgetGtk* window = new WidgetGtk(WidgetGtk::TYPE_WINDOW); | 369 WidgetGtk* window = new WidgetGtk(WidgetGtk::TYPE_WINDOW); |
| 369 ConfigureLoginWindow(window, | 370 ConfigureLoginWindow(window, |
| 370 index, | 371 index, |
| 371 gfx::Rect(kUserImageSize, *height), | 372 gfx::Rect(width, *height), |
| 372 WM_IPC_WINDOW_LOGIN_CONTROLS, | 373 WM_IPC_WINDOW_LOGIN_CONTROLS, |
| 373 control_view); | 374 control_view); |
| 374 return window; | 375 return window; |
| 375 } | 376 } |
| 376 | 377 |
| 377 WidgetGtk* UserController::CreateImageWindow(int index) { | 378 WidgetGtk* UserController::CreateImageWindow(int index) { |
| 378 user_view_ = new UserView(this, true, !is_new_user_); | 379 user_view_ = new UserView(this, true, !is_new_user_); |
| 379 | 380 |
| 380 if (is_guest_) { | 381 if (is_guest_) { |
| 381 user_view_->SetImage(*ResourceBundle::GetSharedInstance().GetBitmapNamed( | 382 user_view_->SetImage(*ResourceBundle::GetSharedInstance().GetBitmapNamed( |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 520 | 521 |
| 521 void UserController::SelectUser(int index) { | 522 void UserController::SelectUser(int index) { |
| 522 delegate_->SelectUser(index); | 523 delegate_->SelectUser(index); |
| 523 } | 524 } |
| 524 | 525 |
| 525 void UserController::FocusPasswordField() { | 526 void UserController::FocusPasswordField() { |
| 526 existing_user_view_->FocusPasswordField(); | 527 existing_user_view_->FocusPasswordField(); |
| 527 } | 528 } |
| 528 | 529 |
| 529 } // namespace chromeos | 530 } // namespace chromeos |
| OLD | NEW |