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 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 Browser* browser) { | 400 Browser* browser) { |
401 if (IsShowing()) | 401 if (IsShowing()) |
402 return; | 402 return; |
403 | 403 |
404 DCHECK(chrome::IsCommandEnabled(browser, IDC_SHOW_AVATAR_MENU)); | 404 DCHECK(chrome::IsCommandEnabled(browser, IDC_SHOW_AVATAR_MENU)); |
405 avatar_bubble_ = new AvatarMenuBubbleView( | 405 avatar_bubble_ = new AvatarMenuBubbleView( |
406 anchor_view, arrow_location, anchor_rect, browser); | 406 anchor_view, arrow_location, anchor_rect, browser); |
407 views::BubbleDelegateView::CreateBubble(avatar_bubble_); | 407 views::BubbleDelegateView::CreateBubble(avatar_bubble_); |
408 avatar_bubble_->SetBackgroundColors(); | 408 avatar_bubble_->SetBackgroundColors(); |
409 avatar_bubble_->SetAlignment(border_alignment); | 409 avatar_bubble_->SetAlignment(border_alignment); |
410 avatar_bubble_->Show(); | 410 avatar_bubble_->GetWidget()->Show(); |
411 } | 411 } |
412 | 412 |
413 // static | 413 // static |
414 bool AvatarMenuBubbleView::IsShowing() { | 414 bool AvatarMenuBubbleView::IsShowing() { |
415 return avatar_bubble_ != NULL; | 415 return avatar_bubble_ != NULL; |
416 } | 416 } |
417 | 417 |
418 // static | 418 // static |
419 void AvatarMenuBubbleView::Hide() { | 419 void AvatarMenuBubbleView::Hide() { |
420 if (IsShowing()) | 420 if (IsShowing()) |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
595 Layout(); | 595 Layout(); |
596 if (GetBubbleFrameView()) | 596 if (GetBubbleFrameView()) |
597 SizeToContents(); | 597 SizeToContents(); |
598 } | 598 } |
599 | 599 |
600 void AvatarMenuBubbleView::SetBackgroundColors() { | 600 void AvatarMenuBubbleView::SetBackgroundColors() { |
601 for (size_t i = 0; i < item_views_.size(); ++i) { | 601 for (size_t i = 0; i < item_views_.size(); ++i) { |
602 item_views_[i]->OnHighlightStateChanged(); | 602 item_views_[i]->OnHighlightStateChanged(); |
603 } | 603 } |
604 } | 604 } |
OLD | NEW |