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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 = 28; | 50 const int kControlsHeight = 28; |
51 | 51 |
52 // Username label height in different states. | |
53 const int kSelectedLabelHeight = 25; | |
54 const int kUnselectedLabelHeight = 20; | |
55 | |
56 // Delta for the unselected username font. | 52 // Delta for the unselected username font. |
57 const int kUnselectedUsernameFontDelta = 1; | 53 const int kUnselectedUsernameFontDelta = 1; |
58 | 54 |
59 // Widget that notifies window manager about clicking on itself. | 55 // Widget that notifies window manager about clicking on itself. |
60 // Doesn't send anything if user is selected. | 56 // Doesn't send anything if user is selected. |
61 class ClickNotifyingWidget : public views::WidgetGtk { | 57 class ClickNotifyingWidget : public views::WidgetGtk { |
62 public: | 58 public: |
63 ClickNotifyingWidget(views::WidgetGtk::Type type, | 59 ClickNotifyingWidget(views::WidgetGtk::Type type, |
64 UserController* controller) | 60 UserController* controller) |
65 : WidgetGtk(type), | 61 : WidgetGtk(type), |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 else | 466 else |
471 unselected_label_view_ = label; | 467 unselected_label_view_ = label; |
472 | 468 |
473 int width = (type == WM_IPC_WINDOW_LOGIN_LABEL) ? | 469 int width = (type == WM_IPC_WINDOW_LOGIN_LABEL) ? |
474 kUserImageSize : kUnselectedSize; | 470 kUserImageSize : kUnselectedSize; |
475 if (is_new_user_) { | 471 if (is_new_user_) { |
476 // Make label as small as possible to don't show tooltip. | 472 // Make label as small as possible to don't show tooltip. |
477 width = 0; | 473 width = 0; |
478 } | 474 } |
479 int height = (type == WM_IPC_WINDOW_LOGIN_LABEL) ? | 475 int height = (type == WM_IPC_WINDOW_LOGIN_LABEL) ? |
480 kSelectedLabelHeight : kUnselectedLabelHeight; | 476 login::kSelectedLabelHeight : login::kUnselectedLabelHeight; |
481 WidgetGtk* window = new ClickNotifyingWidget(WidgetGtk::TYPE_WINDOW, this); | 477 WidgetGtk* window = new ClickNotifyingWidget(WidgetGtk::TYPE_WINDOW, this); |
482 ConfigureLoginWindow(window, | 478 ConfigureLoginWindow(window, |
483 index, | 479 index, |
484 gfx::Rect(0, 0, width, height), | 480 gfx::Rect(0, 0, width, height), |
485 type, | 481 type, |
486 label); | 482 label); |
487 return window; | 483 return window; |
488 } | 484 } |
489 | 485 |
490 gfx::Rect UserController::GetScreenBounds() const { | 486 gfx::Rect UserController::GetScreenBounds() const { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 | 518 |
523 void UserController::SelectUser(int index) { | 519 void UserController::SelectUser(int index) { |
524 delegate_->SelectUser(index); | 520 delegate_->SelectUser(index); |
525 } | 521 } |
526 | 522 |
527 void UserController::FocusPasswordField() { | 523 void UserController::FocusPasswordField() { |
528 existing_user_view_->FocusPasswordField(); | 524 existing_user_view_->FocusPasswordField(); |
529 } | 525 } |
530 | 526 |
531 } // namespace chromeos | 527 } // namespace chromeos |
OLD | NEW |