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/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.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" |
11 #include "chrome/browser/profiles/profile_window.h" | 11 #include "chrome/browser/profiles/profile_window.h" |
12 #include "chrome/browser/profiles/profiles_state.h" | 12 #include "chrome/browser/profiles/profiles_state.h" |
13 #include "chrome/browser/signin/profile_oauth2_token_service.h" | 13 #include "chrome/browser/signin/profile_oauth2_token_service.h" |
14 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 14 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
15 #include "chrome/browser/signin/signin_manager.h" | 15 #include "chrome/browser/signin/signin_manager.h" |
16 #include "chrome/browser/signin/signin_manager_factory.h" | 16 #include "chrome/browser/signin/signin_manager_factory.h" |
17 #include "chrome/browser/signin/signin_promo.h" | 17 #include "chrome/browser/signin/signin_promo.h" |
18 #include "chrome/browser/ui/browser.h" | 18 #include "chrome/browser/ui/browser.h" |
19 #include "chrome/browser/ui/browser_dialogs.h" | 19 #include "chrome/browser/ui/browser_dialogs.h" |
20 #include "chrome/browser/ui/singleton_tabs.h" | 20 #include "chrome/browser/ui/singleton_tabs.h" |
21 #include "chrome/browser/ui/views/user_manager_view.h" | 21 #include "chrome/browser/ui/views/user_manager_view.h" |
22 #include "chrome/common/profile_management_switches.h" | |
23 #include "chrome/common/url_constants.h" | 22 #include "chrome/common/url_constants.h" |
24 #include "grit/chromium_strings.h" | 23 #include "grit/chromium_strings.h" |
25 #include "grit/generated_resources.h" | 24 #include "grit/generated_resources.h" |
26 #include "grit/theme_resources.h" | 25 #include "grit/theme_resources.h" |
27 #include "third_party/skia/include/core/SkColor.h" | 26 #include "third_party/skia/include/core/SkColor.h" |
28 #include "ui/base/l10n/l10n_util.h" | 27 #include "ui/base/l10n/l10n_util.h" |
29 #include "ui/base/resource/resource_bundle.h" | 28 #include "ui/base/resource/resource_bundle.h" |
30 #include "ui/gfx/image/image.h" | 29 #include "ui/gfx/image/image.h" |
31 #include "ui/gfx/image/image_skia.h" | 30 #include "ui/gfx/image/image_skia.h" |
32 #include "ui/gfx/text_elider.h" | 31 #include "ui/gfx/text_elider.h" |
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 } | 561 } |
563 | 562 |
564 void ProfileChooserView::LinkClicked(views::Link* sender, int event_flags) { | 563 void ProfileChooserView::LinkClicked(views::Link* sender, int event_flags) { |
565 if (sender == manage_accounts_link_) { | 564 if (sender == manage_accounts_link_) { |
566 // ShowView() will DCHECK if this view is displayed for non signed-in users. | 565 // ShowView() will DCHECK if this view is displayed for non signed-in users. |
567 ShowView(ACCOUNT_MANAGEMENT_VIEW, avatar_menu_.get()); | 566 ShowView(ACCOUNT_MANAGEMENT_VIEW, avatar_menu_.get()); |
568 } else if (sender == signout_current_profile_link_) { | 567 } else if (sender == signout_current_profile_link_) { |
569 profiles::LockProfile(browser_->profile()); | 568 profiles::LockProfile(browser_->profile()); |
570 } else { | 569 } else { |
571 DCHECK(sender == signin_current_profile_link_); | 570 DCHECK(sender == signin_current_profile_link_); |
572 if (switches::IsEnableInlineSignin()) { | 571 ShowView(GAIA_SIGNIN_VIEW, avatar_menu_.get()); |
573 ShowView(GAIA_SIGNIN_VIEW, avatar_menu_.get()); | |
574 } else { | |
575 GURL page = signin::GetPromoURL(signin::SOURCE_MENU, false); | |
576 chrome::ShowSingletonTab(browser_, page); | |
577 } | |
578 } | 572 } |
579 } | 573 } |
580 | 574 |
581 bool ProfileChooserView::HandleKeyEvent(views::Textfield* sender, | 575 bool ProfileChooserView::HandleKeyEvent(views::Textfield* sender, |
582 const ui::KeyEvent& key_event) { | 576 const ui::KeyEvent& key_event) { |
583 views::Textfield* name_textfield = | 577 views::Textfield* name_textfield = |
584 current_profile_name_->profile_name_textfield(); | 578 current_profile_name_->profile_name_textfield(); |
585 DCHECK(sender == name_textfield); | 579 DCHECK(sender == name_textfield); |
586 | 580 |
587 if (key_event.key_code() == ui::VKEY_RETURN || | 581 if (key_event.key_code() == ui::VKEY_RETURN || |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
844 email_button->set_menu_marker( | 838 email_button->set_menu_marker( |
845 rb->GetImageNamed(IDR_CLOSE_1).ToImageSkia()); | 839 rb->GetImageNamed(IDR_CLOSE_1).ToImageSkia()); |
846 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); | 840 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); |
847 } | 841 } |
848 layout->StartRow(1, 0); | 842 layout->StartRow(1, 0); |
849 layout->AddView(email_button); | 843 layout->AddView(email_button); |
850 | 844 |
851 // Save the original email address, as the button text could be elided. | 845 // Save the original email address, as the button text could be elided. |
852 current_profile_accounts_map_[email_button] = account; | 846 current_profile_accounts_map_[email_button] = account; |
853 } | 847 } |
OLD | NEW |