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 "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
9 #include "chrome/browser/profiles/profile_info_util.h" | 9 #include "chrome/browser/profiles/profile_info_util.h" |
10 #include "chrome/browser/profiles/profile_manager.h" | 10 #include "chrome/browser/profiles/profile_manager.h" |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 DISALLOW_COPY_AND_ASSIGN(BackgroundColorHoverButton); | 174 DISALLOW_COPY_AND_ASSIGN(BackgroundColorHoverButton); |
175 }; | 175 }; |
176 | 176 |
177 } // namespace | 177 } // namespace |
178 | 178 |
179 | 179 |
180 // ProfileChooserView --------------------------------------------------------- | 180 // ProfileChooserView --------------------------------------------------------- |
181 | 181 |
182 // static | 182 // static |
183 ProfileChooserView* ProfileChooserView::profile_bubble_ = NULL; | 183 ProfileChooserView* ProfileChooserView::profile_bubble_ = NULL; |
184 bool ProfileChooserView::close_on_deactivate_ = true; | 184 bool ProfileChooserView::close_on_deactivate_for_testing_ = true; |
185 | 185 |
186 // static | 186 // static |
187 void ProfileChooserView::ShowBubble( | 187 void ProfileChooserView::ShowBubble( |
188 views::View* anchor_view, | 188 views::View* anchor_view, |
189 views::BubbleBorder::Arrow arrow, | 189 views::BubbleBorder::Arrow arrow, |
190 views::BubbleBorder::BubbleAlignment border_alignment, | 190 views::BubbleBorder::BubbleAlignment border_alignment, |
191 const gfx::Rect& anchor_rect, | 191 const gfx::Rect& anchor_rect, |
192 Browser* browser) { | 192 Browser* browser) { |
193 if (IsShowing()) | 193 if (IsShowing()) |
194 // TODO(bcwhite): handle case where we should show on different window | 194 // TODO(bcwhite): handle case where we should show on different window |
195 return; | 195 return; |
196 | 196 |
197 profile_bubble_ = new ProfileChooserView( | 197 profile_bubble_ = new ProfileChooserView( |
198 anchor_view, arrow, anchor_rect, browser); | 198 anchor_view, arrow, anchor_rect, browser); |
199 views::BubbleDelegateView::CreateBubble(profile_bubble_); | 199 views::BubbleDelegateView::CreateBubble(profile_bubble_); |
200 profile_bubble_->set_close_on_deactivate(close_on_deactivate_); | 200 profile_bubble_->set_close_on_deactivate(close_on_deactivate_for_testing_); |
201 profile_bubble_->SetAlignment(border_alignment); | 201 profile_bubble_->SetAlignment(border_alignment); |
202 profile_bubble_->GetWidget()->Show(); | 202 profile_bubble_->GetWidget()->Show(); |
203 profile_bubble_->SetArrowPaintType(views::BubbleBorder::PAINT_NONE); | 203 profile_bubble_->SetArrowPaintType(views::BubbleBorder::PAINT_NONE); |
204 } | 204 } |
205 | 205 |
206 // static | 206 // static |
207 bool ProfileChooserView::IsShowing() { | 207 bool ProfileChooserView::IsShowing() { |
208 return profile_bubble_ != NULL; | 208 return profile_bubble_ != NULL; |
209 } | 209 } |
210 | 210 |
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
605 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); | 605 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); |
606 | 606 |
607 views::BlueButton* add_account_button = new views::BlueButton( | 607 views::BlueButton* add_account_button = new views::BlueButton( |
608 NULL, | 608 NULL, |
609 l10n_util::GetStringFUTF16(IDS_PROFILES_PROFILE_ADD_ACCOUNT_BUTTON, | 609 l10n_util::GetStringFUTF16(IDS_PROFILES_PROFILE_ADD_ACCOUNT_BUTTON, |
610 avatar_item.name)); | 610 avatar_item.name)); |
611 layout->StartRow(1, 0); | 611 layout->StartRow(1, 0); |
612 layout->AddView(add_account_button); | 612 layout->AddView(add_account_button); |
613 return view; | 613 return view; |
614 } | 614 } |
OLD | NEW |