| 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 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 } | 467 } |
| 468 } | 468 } |
| 469 | 469 |
| 470 gfx::Rect AvatarMenuBubbleView::GetAnchorRect() { | 470 gfx::Rect AvatarMenuBubbleView::GetAnchorRect() { |
| 471 return anchor_rect_; | 471 return anchor_rect_; |
| 472 } | 472 } |
| 473 | 473 |
| 474 void AvatarMenuBubbleView::Init() { | 474 void AvatarMenuBubbleView::Init() { |
| 475 // Build the menu for the first time. | 475 // Build the menu for the first time. |
| 476 OnAvatarMenuModelChanged(avatar_menu_model_.get()); | 476 OnAvatarMenuModelChanged(avatar_menu_model_.get()); |
| 477 AddAccelerator(ui::Accelerator(ui::VKEY_DOWN, ui::EF_NONE)); | 477 AddAccelerator(ui::Accelerator(ui::VKEY_DOWN, |
| 478 AddAccelerator(ui::Accelerator(ui::VKEY_UP, ui::EF_NONE)); | 478 ui::EF_NONE, |
| 479 ui::ET_KEY_PRESSED)); |
| 480 AddAccelerator(ui::Accelerator(ui::VKEY_UP, ui::EF_NONE, ui::ET_KEY_PRESSED)); |
| 479 } | 481 } |
| 480 | 482 |
| 481 void AvatarMenuBubbleView::OnAvatarMenuModelChanged( | 483 void AvatarMenuBubbleView::OnAvatarMenuModelChanged( |
| 482 AvatarMenuModel* avatar_menu_model) { | 484 AvatarMenuModel* avatar_menu_model) { |
| 483 // Unset all our child view references and call RemoveAllChildViews() which | 485 // Unset all our child view references and call RemoveAllChildViews() which |
| 484 // will actually delete them. | 486 // will actually delete them. |
| 485 add_profile_link_ = NULL; | 487 add_profile_link_ = NULL; |
| 486 item_views_.clear(); | 488 item_views_.clear(); |
| 487 RemoveAllChildViews(true); | 489 RemoveAllChildViews(true); |
| 488 | 490 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 505 add_profile_link_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); | 507 add_profile_link_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); |
| 506 add_profile_link_->SetBackgroundColor(color()); | 508 add_profile_link_->SetBackgroundColor(color()); |
| 507 add_profile_link_->SetEnabledColor(SkColorSetRGB(0xe3, 0xed, 0xf6)); | 509 add_profile_link_->SetEnabledColor(SkColorSetRGB(0xe3, 0xed, 0xf6)); |
| 508 AddChildView(add_profile_link_); | 510 AddChildView(add_profile_link_); |
| 509 | 511 |
| 510 // If the bubble has already been shown then resize and reposition the bubble. | 512 // If the bubble has already been shown then resize and reposition the bubble. |
| 511 Layout(); | 513 Layout(); |
| 512 if (GetBubbleFrameView()) | 514 if (GetBubbleFrameView()) |
| 513 SizeToContents(); | 515 SizeToContents(); |
| 514 } | 516 } |
| OLD | NEW |