OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 if (accelerator.key_code() == ui::VKEY_DOWN) | 477 if (accelerator.key_code() == ui::VKEY_DOWN) |
478 focus_index = (focus_index + 1) % item_views_.size(); | 478 focus_index = (focus_index + 1) % item_views_.size(); |
479 else | 479 else |
480 focus_index = ((focus_index > 0) ? focus_index : item_views_.size()) - 1; | 480 focus_index = ((focus_index > 0) ? focus_index : item_views_.size()) - 1; |
481 item_views_[focus_index]->RequestFocus(); | 481 item_views_[focus_index]->RequestFocus(); |
482 | 482 |
483 return true; | 483 return true; |
484 } | 484 } |
485 | 485 |
486 void AvatarMenuBubbleView::ButtonPressed(views::Button* sender, | 486 void AvatarMenuBubbleView::ButtonPressed(views::Button* sender, |
487 const views::Event& event) { | 487 const ui::Event& event) { |
488 for (size_t i = 0; i < item_views_.size(); ++i) { | 488 for (size_t i = 0; i < item_views_.size(); ++i) { |
489 ProfileItemView* item_view = static_cast<ProfileItemView*>(item_views_[i]); | 489 ProfileItemView* item_view = static_cast<ProfileItemView*>(item_views_[i]); |
490 if (sender == item_view) { | 490 if (sender == item_view) { |
491 // Clicking on the active profile shouldn't do anything. | 491 // Clicking on the active profile shouldn't do anything. |
492 if (!item_view->item().active) { | 492 if (!item_view->item().active) { |
493 avatar_menu_model_->SwitchToProfile( | 493 avatar_menu_model_->SwitchToProfile( |
494 i, chrome::DispositionFromEventFlags(event.flags()) == NEW_WINDOW); | 494 i, chrome::DispositionFromEventFlags(event.flags()) == NEW_WINDOW); |
495 } | 495 } |
496 break; | 496 break; |
497 } | 497 } |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 add_profile_link_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); | 551 add_profile_link_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); |
552 add_profile_link_->SetBackgroundColor(color()); | 552 add_profile_link_->SetBackgroundColor(color()); |
553 add_profile_link_->SetEnabledColor(SkColorSetRGB(0xe3, 0xed, 0xf6)); | 553 add_profile_link_->SetEnabledColor(SkColorSetRGB(0xe3, 0xed, 0xf6)); |
554 AddChildView(add_profile_link_); | 554 AddChildView(add_profile_link_); |
555 | 555 |
556 // If the bubble has already been shown then resize and reposition the bubble. | 556 // If the bubble has already been shown then resize and reposition the bubble. |
557 Layout(); | 557 Layout(); |
558 if (GetBubbleFrameView()) | 558 if (GetBubbleFrameView()) |
559 SizeToContents(); | 559 SizeToContents(); |
560 } | 560 } |
OLD | NEW |