| 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/app/chrome_command_ids.h" | 10 #include "chrome/app/chrome_command_ids.h" |
| (...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 512 } | 512 } |
| 513 | 513 |
| 514 void AvatarMenuBubbleView::ButtonPressed(views::Button* sender, | 514 void AvatarMenuBubbleView::ButtonPressed(views::Button* sender, |
| 515 const ui::Event& event) { | 515 const ui::Event& event) { |
| 516 for (size_t i = 0; i < item_views_.size(); ++i) { | 516 for (size_t i = 0; i < item_views_.size(); ++i) { |
| 517 ProfileItemView* item_view = static_cast<ProfileItemView*>(item_views_[i]); | 517 ProfileItemView* item_view = static_cast<ProfileItemView*>(item_views_[i]); |
| 518 if (sender == item_view) { | 518 if (sender == item_view) { |
| 519 // Clicking on the active profile shouldn't do anything. | 519 // Clicking on the active profile shouldn't do anything. |
| 520 if (!item_view->item().active) { | 520 if (!item_view->item().active) { |
| 521 avatar_menu_model_->SwitchToProfile( | 521 avatar_menu_model_->SwitchToProfile( |
| 522 i, chrome::DispositionFromEventFlags(event.flags()) == NEW_WINDOW); | 522 i, ui::DispositionFromEventFlags(event.flags()) == NEW_WINDOW); |
| 523 } | 523 } |
| 524 break; | 524 break; |
| 525 } | 525 } |
| 526 } | 526 } |
| 527 } | 527 } |
| 528 | 528 |
| 529 void AvatarMenuBubbleView::LinkClicked(views::Link* source, int event_flags) { | 529 void AvatarMenuBubbleView::LinkClicked(views::Link* source, int event_flags) { |
| 530 if (source == add_profile_link_) { | 530 if (source == add_profile_link_) { |
| 531 avatar_menu_model_->AddNewProfile(ProfileMetrics::ADD_NEW_USER_ICON); | 531 avatar_menu_model_->AddNewProfile(ProfileMetrics::ADD_NEW_USER_ICON); |
| 532 return; | 532 return; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 583 add_profile_link_->set_listener(this); | 583 add_profile_link_->set_listener(this); |
| 584 add_profile_link_->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 584 add_profile_link_->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| 585 add_profile_link_->SetBackgroundColor(color()); | 585 add_profile_link_->SetBackgroundColor(color()); |
| 586 AddChildView(add_profile_link_); | 586 AddChildView(add_profile_link_); |
| 587 | 587 |
| 588 // If the bubble has already been shown then resize and reposition the bubble. | 588 // If the bubble has already been shown then resize and reposition the bubble. |
| 589 Layout(); | 589 Layout(); |
| 590 if (GetBubbleFrameView()) | 590 if (GetBubbleFrameView()) |
| 591 SizeToContents(); | 591 SizeToContents(); |
| 592 } | 592 } |
| OLD | NEW |