OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/profiles/profile_chooser_view.h" | 5 #include "chrome/browser/ui/views/profiles/profile_chooser_view.h" |
6 | 6 |
7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/lifetime/application_lifetime.h" | 10 #include "chrome/browser/lifetime/application_lifetime.h" |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 ProfileChooserView* ProfileChooserView::profile_bubble_ = NULL; | 442 ProfileChooserView* ProfileChooserView::profile_bubble_ = NULL; |
443 bool ProfileChooserView::close_on_deactivate_for_testing_ = true; | 443 bool ProfileChooserView::close_on_deactivate_for_testing_ = true; |
444 | 444 |
445 // static | 445 // static |
446 void ProfileChooserView::ShowBubble( | 446 void ProfileChooserView::ShowBubble( |
447 profiles::BubbleViewMode view_mode, | 447 profiles::BubbleViewMode view_mode, |
448 signin::GAIAServiceType service_type, | 448 signin::GAIAServiceType service_type, |
449 views::View* anchor_view, | 449 views::View* anchor_view, |
450 views::BubbleBorder::Arrow arrow, | 450 views::BubbleBorder::Arrow arrow, |
451 views::BubbleBorder::BubbleAlignment border_alignment, | 451 views::BubbleBorder::BubbleAlignment border_alignment, |
452 const gfx::Rect& anchor_rect, | |
453 Browser* browser) { | 452 Browser* browser) { |
454 if (IsShowing()) | 453 if (IsShowing()) |
455 return; | 454 return; |
456 | 455 |
457 profile_bubble_ = new ProfileChooserView(anchor_view, arrow, anchor_rect, | 456 profile_bubble_ = new ProfileChooserView(anchor_view, arrow, browser, |
458 browser, view_mode, service_type); | 457 view_mode, service_type); |
459 views::BubbleDelegateView::CreateBubble(profile_bubble_); | 458 views::BubbleDelegateView::CreateBubble(profile_bubble_); |
460 profile_bubble_->set_close_on_deactivate(close_on_deactivate_for_testing_); | 459 profile_bubble_->set_close_on_deactivate(close_on_deactivate_for_testing_); |
461 profile_bubble_->SetAlignment(border_alignment); | 460 profile_bubble_->SetAlignment(border_alignment); |
462 profile_bubble_->GetWidget()->Show(); | 461 profile_bubble_->GetWidget()->Show(); |
463 profile_bubble_->SetArrowPaintType(views::BubbleBorder::PAINT_NONE); | 462 profile_bubble_->SetArrowPaintType(views::BubbleBorder::PAINT_NONE); |
464 } | 463 } |
465 | 464 |
466 // static | 465 // static |
467 bool ProfileChooserView::IsShowing() { | 466 bool ProfileChooserView::IsShowing() { |
468 return profile_bubble_ != NULL; | 467 return profile_bubble_ != NULL; |
469 } | 468 } |
470 | 469 |
471 // static | 470 // static |
472 void ProfileChooserView::Hide() { | 471 void ProfileChooserView::Hide() { |
473 if (IsShowing()) | 472 if (IsShowing()) |
474 profile_bubble_->GetWidget()->Close(); | 473 profile_bubble_->GetWidget()->Close(); |
475 } | 474 } |
476 | 475 |
477 ProfileChooserView::ProfileChooserView(views::View* anchor_view, | 476 ProfileChooserView::ProfileChooserView(views::View* anchor_view, |
478 views::BubbleBorder::Arrow arrow, | 477 views::BubbleBorder::Arrow arrow, |
479 const gfx::Rect& anchor_rect, | |
480 Browser* browser, | 478 Browser* browser, |
481 profiles::BubbleViewMode view_mode, | 479 profiles::BubbleViewMode view_mode, |
482 signin::GAIAServiceType service_type) | 480 signin::GAIAServiceType service_type) |
483 : BubbleDelegateView(anchor_view, arrow), | 481 : BubbleDelegateView(anchor_view, arrow), |
484 browser_(browser), | 482 browser_(browser), |
485 view_mode_(view_mode), | 483 view_mode_(view_mode), |
486 tutorial_mode_(profiles::TUTORIAL_MODE_NONE), | 484 tutorial_mode_(profiles::TUTORIAL_MODE_NONE), |
487 gaia_service_type_(service_type) { | 485 gaia_service_type_(service_type) { |
488 // Reset the default margins inherited from the BubbleDelegateView. | 486 // Reset the default margins inherited from the BubbleDelegateView. |
489 set_margins(gfx::Insets()); | 487 set_margins(gfx::Insets()); |
(...skipping 1002 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1492 layout->StartRowWithPadding( | 1490 layout->StartRowWithPadding( |
1493 1, 0, 0, views::kUnrelatedControlVerticalSpacing); | 1491 1, 0, 0, views::kUnrelatedControlVerticalSpacing); |
1494 layout->AddView(end_preview_and_relaunch_button_); | 1492 layout->AddView(end_preview_and_relaunch_button_); |
1495 | 1493 |
1496 TitleCard* title_card = new TitleCard( | 1494 TitleCard* title_card = new TitleCard( |
1497 IDS_PROFILES_END_PREVIEW, this, &end_preview_cancel_button_); | 1495 IDS_PROFILES_END_PREVIEW, this, &end_preview_cancel_button_); |
1498 return TitleCard::AddPaddedTitleCard( | 1496 return TitleCard::AddPaddedTitleCard( |
1499 view, title_card, kFixedAccountRemovalViewWidth); | 1497 view, title_card, kFixedAccountRemovalViewWidth); |
1500 } | 1498 } |
1501 | 1499 |
OLD | NEW |