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 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
703 bool ProfileChooserView::AcceleratorPressed( | 703 bool ProfileChooserView::AcceleratorPressed( |
704 const ui::Accelerator& accelerator) { | 704 const ui::Accelerator& accelerator) { |
705 if (accelerator.key_code() != ui::VKEY_DOWN && | 705 if (accelerator.key_code() != ui::VKEY_DOWN && |
706 accelerator.key_code() != ui::VKEY_UP) | 706 accelerator.key_code() != ui::VKEY_UP) |
707 return BubbleDelegateView::AcceleratorPressed(accelerator); | 707 return BubbleDelegateView::AcceleratorPressed(accelerator); |
708 // Move the focus up or down. | 708 // Move the focus up or down. |
709 GetFocusManager()->AdvanceFocus(accelerator.key_code() != ui::VKEY_DOWN); | 709 GetFocusManager()->AdvanceFocus(accelerator.key_code() != ui::VKEY_DOWN); |
710 return true; | 710 return true; |
711 } | 711 } |
712 | 712 |
| 713 bool ProfileChooserView::HandleContextMenu( |
| 714 const content::ContextMenuParams& params) { |
| 715 // Suppresses the context menu because some features, such as inspecting |
| 716 // elements, are not appropriate in a bubble. |
| 717 return true; |
| 718 } |
| 719 |
713 void ProfileChooserView::ButtonPressed(views::Button* sender, | 720 void ProfileChooserView::ButtonPressed(views::Button* sender, |
714 const ui::Event& event) { | 721 const ui::Event& event) { |
715 if (sender == users_button_) { | 722 if (sender == users_button_) { |
716 // If this is a guest session, close all the guest browser windows. | 723 // If this is a guest session, close all the guest browser windows. |
717 if (browser_->profile()->IsGuestSession()) { | 724 if (browser_->profile()->IsGuestSession()) { |
718 profiles::CloseGuestProfileWindows(); | 725 profiles::CloseGuestProfileWindows(); |
719 } else { | 726 } else { |
720 UserManager::Show(base::FilePath(), | 727 UserManager::Show(base::FilePath(), |
721 profiles::USER_MANAGER_NO_TUTORIAL, | 728 profiles::USER_MANAGER_NO_TUTORIAL, |
722 profiles::USER_MANAGER_SELECT_PROFILE_NO_ACTION); | 729 profiles::USER_MANAGER_SELECT_PROFILE_NO_ACTION); |
(...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1438 } | 1445 } |
1439 default: | 1446 default: |
1440 NOTREACHED() << "Called with invalid mode=" << view_mode_; | 1447 NOTREACHED() << "Called with invalid mode=" << view_mode_; |
1441 return NULL; | 1448 return NULL; |
1442 } | 1449 } |
1443 | 1450 |
1444 // Adds Gaia signin webview | 1451 // Adds Gaia signin webview |
1445 Profile* profile = browser_->profile(); | 1452 Profile* profile = browser_->profile(); |
1446 views::WebView* web_view = new views::WebView(profile); | 1453 views::WebView* web_view = new views::WebView(profile); |
1447 web_view->LoadInitialURL(url); | 1454 web_view->LoadInitialURL(url); |
| 1455 web_view->GetWebContents()->SetDelegate(this); |
1448 web_view->SetPreferredSize( | 1456 web_view->SetPreferredSize( |
1449 gfx::Size(kFixedGaiaViewWidth, kFixedGaiaViewHeight)); | 1457 gfx::Size(kFixedGaiaViewWidth, kFixedGaiaViewHeight)); |
1450 content::RenderWidgetHostView* rwhv = | 1458 content::RenderWidgetHostView* rwhv = |
1451 web_view->GetWebContents()->GetRenderWidgetHostView(); | 1459 web_view->GetWebContents()->GetRenderWidgetHostView(); |
1452 if (rwhv) | 1460 if (rwhv) |
1453 rwhv->SetBackgroundColor(profiles::kAvatarBubbleGaiaBackgroundColor); | 1461 rwhv->SetBackgroundColor(profiles::kAvatarBubbleGaiaBackgroundColor); |
1454 TitleCard* title_card = new TitleCard(l10n_util::GetStringUTF16(message_id), | 1462 TitleCard* title_card = new TitleCard(l10n_util::GetStringUTF16(message_id), |
1455 this, | 1463 this, |
1456 &gaia_signin_cancel_button_); | 1464 &gaia_signin_cancel_button_); |
1457 return TitleCard::AddPaddedTitleCard( | 1465 return TitleCard::AddPaddedTitleCard( |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1654 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != | 1662 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != |
1655 IncognitoModePrefs::DISABLED; | 1663 IncognitoModePrefs::DISABLED; |
1656 return incognito_available && !browser_->profile()->IsGuestSession(); | 1664 return incognito_available && !browser_->profile()->IsGuestSession(); |
1657 } | 1665 } |
1658 | 1666 |
1659 void ProfileChooserView::PostActionPerformed( | 1667 void ProfileChooserView::PostActionPerformed( |
1660 ProfileMetrics::ProfileDesktopMenu action_performed) { | 1668 ProfileMetrics::ProfileDesktopMenu action_performed) { |
1661 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); | 1669 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); |
1662 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; | 1670 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; |
1663 } | 1671 } |
OLD | NEW |