| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/profile_chooser_view.h" | 5 #include "chrome/browser/ui/views/profile_chooser_view.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/profiles/avatar_menu_model.h" | 10 #include "chrome/browser/profiles/avatar_menu_model.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "ui/views/controls/link.h" | 23 #include "ui/views/controls/link.h" |
| 24 #include "ui/views/controls/separator.h" | 24 #include "ui/views/controls/separator.h" |
| 25 #include "ui/views/layout/box_layout.h" | 25 #include "ui/views/layout/box_layout.h" |
| 26 #include "ui/views/layout/grid_layout.h" | 26 #include "ui/views/layout/grid_layout.h" |
| 27 #include "ui/views/layout/layout_constants.h" | 27 #include "ui/views/layout/layout_constants.h" |
| 28 #include "ui/views/widget/widget.h" | 28 #include "ui/views/widget/widget.h" |
| 29 | 29 |
| 30 | 30 |
| 31 // static | 31 // static |
| 32 ProfileChooserView* ProfileChooserView::profile_bubble_ = NULL; | 32 ProfileChooserView* ProfileChooserView::profile_bubble_ = NULL; |
| 33 bool ProfileChooserView::close_on_deactivate_ = true; |
| 33 | 34 |
| 34 // static | 35 // static |
| 35 void ProfileChooserView::ShowBubble( | 36 void ProfileChooserView::ShowBubble( |
| 36 views::View* anchor_view, | 37 views::View* anchor_view, |
| 37 views::BubbleBorder::Arrow arrow, | 38 views::BubbleBorder::Arrow arrow, |
| 38 views::BubbleBorder::BubbleAlignment border_alignment, | 39 views::BubbleBorder::BubbleAlignment border_alignment, |
| 39 const gfx::Rect& anchor_rect, | 40 const gfx::Rect& anchor_rect, |
| 40 Browser* browser) { | 41 Browser* browser) { |
| 41 if (IsShowing()) | 42 if (IsShowing()) |
| 42 // TODO(bcwhite): handle case where we should show on different window | 43 // TODO(bcwhite): handle case where we should show on different window |
| 43 return; | 44 return; |
| 44 | 45 |
| 45 profile_bubble_ = new ProfileChooserView( | 46 profile_bubble_ = new ProfileChooserView( |
| 46 anchor_view, arrow, anchor_rect, browser); | 47 anchor_view, arrow, anchor_rect, browser); |
| 47 views::BubbleDelegateView::CreateBubble(profile_bubble_); | 48 views::BubbleDelegateView::CreateBubble(profile_bubble_); |
| 49 profile_bubble_->set_close_on_deactivate(close_on_deactivate_); |
| 48 profile_bubble_->SetAlignment(border_alignment); | 50 profile_bubble_->SetAlignment(border_alignment); |
| 49 profile_bubble_->GetWidget()->Show(); | 51 profile_bubble_->GetWidget()->Show(); |
| 50 } | 52 } |
| 51 | 53 |
| 52 // static | 54 // static |
| 53 bool ProfileChooserView::IsShowing() { | 55 bool ProfileChooserView::IsShowing() { |
| 54 return profile_bubble_ != NULL; | 56 return profile_bubble_ != NULL; |
| 55 } | 57 } |
| 56 | 58 |
| 57 // static | 59 // static |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 layout->AddView(users_button_view_, 1, 1, | 330 layout->AddView(users_button_view_, 1, 1, |
| 329 views::GridLayout::FILL, views::GridLayout::FILL, | 331 views::GridLayout::FILL, views::GridLayout::FILL, |
| 330 0, kButtonHeight); | 332 0, kButtonHeight); |
| 331 layout->AddView(new views::Separator(views::Separator::VERTICAL)); | 333 layout->AddView(new views::Separator(views::Separator::VERTICAL)); |
| 332 layout->AddView(guest_button_view_, 1, 1, | 334 layout->AddView(guest_button_view_, 1, 1, |
| 333 views::GridLayout::FILL, views::GridLayout::FILL, | 335 views::GridLayout::FILL, views::GridLayout::FILL, |
| 334 0, kButtonHeight); | 336 0, kButtonHeight); |
| 335 | 337 |
| 336 return view; | 338 return view; |
| 337 } | 339 } |
| OLD | NEW |