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/ui/views/avatar_menu_bubble_view.h" | 5 #include "chrome/browser/ui/views/avatar_menu_bubble_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 y += kSeparatorPaddingY; | 380 y += kSeparatorPaddingY; |
381 int separator_height = separator_->GetPreferredSize().height(); | 381 int separator_height = separator_->GetPreferredSize().height(); |
382 separator_->SetBounds(0, y, width(), separator_height); | 382 separator_->SetBounds(0, y, width(), separator_height); |
383 y += kSeparatorPaddingY + separator_height; | 383 y += kSeparatorPaddingY + separator_height; |
384 | 384 |
385 add_profile_link_->SetBounds(kIconWidth + kIconMarginX, y, width(), | 385 add_profile_link_->SetBounds(kIconWidth + kIconMarginX, y, width(), |
386 add_profile_link_->GetPreferredSize().height()); | 386 add_profile_link_->GetPreferredSize().height()); |
387 } | 387 } |
388 | 388 |
389 bool AvatarMenuBubbleView::AcceleratorPressed( | 389 bool AvatarMenuBubbleView::AcceleratorPressed( |
390 const views::Accelerator& accelerator) { | 390 const ui::Accelerator& accelerator) { |
391 if (accelerator.key_code() != ui::VKEY_DOWN && | 391 if (accelerator.key_code() != ui::VKEY_DOWN && |
392 accelerator.key_code() != ui::VKEY_UP) { | 392 accelerator.key_code() != ui::VKEY_UP) { |
393 return false; | 393 return false; |
394 } | 394 } |
395 | 395 |
396 if (item_views_.empty()) | 396 if (item_views_.empty()) |
397 return true; | 397 return true; |
398 | 398 |
399 // Find the currently focused item. Note that if there is no focused item, the | 399 // Find the currently focused item. Note that if there is no focused item, the |
400 // code below correctly handles a |focus_index| of -1. | 400 // code below correctly handles a |focus_index| of -1. |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 ProfileItemView* item_view = static_cast<ProfileItemView*>(item_views_[i]); | 439 ProfileItemView* item_view = static_cast<ProfileItemView*>(item_views_[i]); |
440 if (source == item_view->edit_link()) { | 440 if (source == item_view->edit_link()) { |
441 avatar_menu_model_->EditProfile(i); | 441 avatar_menu_model_->EditProfile(i); |
442 return; | 442 return; |
443 } | 443 } |
444 } | 444 } |
445 } | 445 } |
446 | 446 |
447 void AvatarMenuBubbleView::BubbleShown() { | 447 void AvatarMenuBubbleView::BubbleShown() { |
448 GetFocusManager()->RegisterAccelerator( | 448 GetFocusManager()->RegisterAccelerator( |
449 views::Accelerator(ui::VKEY_DOWN, false, false, false), this); | 449 ui::Accelerator(ui::VKEY_DOWN, false, false, false), this); |
450 GetFocusManager()->RegisterAccelerator( | 450 GetFocusManager()->RegisterAccelerator( |
451 views::Accelerator(ui::VKEY_UP, false, false, false), this); | 451 ui::Accelerator(ui::VKEY_UP, false, false, false), this); |
452 } | 452 } |
453 | 453 |
454 void AvatarMenuBubbleView::BubbleClosing(Bubble* bubble, | 454 void AvatarMenuBubbleView::BubbleClosing(Bubble* bubble, |
455 bool closed_by_escape) { | 455 bool closed_by_escape) { |
456 } | 456 } |
457 | 457 |
458 bool AvatarMenuBubbleView::CloseOnEscape() { | 458 bool AvatarMenuBubbleView::CloseOnEscape() { |
459 return true; | 459 return true; |
460 } | 460 } |
461 | 461 |
(...skipping 25 matching lines...) Expand all Loading... |
487 add_profile_link_ = new views::Link( | 487 add_profile_link_ = new views::Link( |
488 l10n_util::GetStringUTF16(IDS_PROFILES_CREATE_NEW_PROFILE_LINK)); | 488 l10n_util::GetStringUTF16(IDS_PROFILES_CREATE_NEW_PROFILE_LINK)); |
489 add_profile_link_->set_listener(this); | 489 add_profile_link_->set_listener(this); |
490 add_profile_link_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); | 490 add_profile_link_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); |
491 add_profile_link_->SetBackgroundColor(Bubble::kBackgroundColor); | 491 add_profile_link_->SetBackgroundColor(Bubble::kBackgroundColor); |
492 add_profile_link_->SetEnabledColor(SkColorSetRGB(0xe3, 0xed, 0xf6)); | 492 add_profile_link_->SetEnabledColor(SkColorSetRGB(0xe3, 0xed, 0xf6)); |
493 AddChildView(add_profile_link_); | 493 AddChildView(add_profile_link_); |
494 | 494 |
495 PreferredSizeChanged(); | 495 PreferredSizeChanged(); |
496 } | 496 } |
OLD | NEW |