Chromium Code Reviews| 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 #ifndef NDEBUG | |
|
sky
2014/10/28 17:46:54
#if !defined(NDEBUG_)
Also, spacing is off, and d
guohui
2014/10/28 18:02:53
Done.
| |
| 716 return false; | |
| 717 #else | |
| 718 return true; | |
| 719 #endif | |
| 720 } | |
| 721 | |
| 713 void ProfileChooserView::ButtonPressed(views::Button* sender, | 722 void ProfileChooserView::ButtonPressed(views::Button* sender, |
| 714 const ui::Event& event) { | 723 const ui::Event& event) { |
| 715 if (sender == users_button_) { | 724 if (sender == users_button_) { |
| 716 // If this is a guest session, close all the guest browser windows. | 725 // If this is a guest session, close all the guest browser windows. |
| 717 if (browser_->profile()->IsGuestSession()) { | 726 if (browser_->profile()->IsGuestSession()) { |
| 718 profiles::CloseGuestProfileWindows(); | 727 profiles::CloseGuestProfileWindows(); |
| 719 } else { | 728 } else { |
| 720 UserManager::Show(base::FilePath(), | 729 UserManager::Show(base::FilePath(), |
| 721 profiles::USER_MANAGER_NO_TUTORIAL, | 730 profiles::USER_MANAGER_NO_TUTORIAL, |
| 722 profiles::USER_MANAGER_SELECT_PROFILE_NO_ACTION); | 731 profiles::USER_MANAGER_SELECT_PROFILE_NO_ACTION); |
| (...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1438 } | 1447 } |
| 1439 default: | 1448 default: |
| 1440 NOTREACHED() << "Called with invalid mode=" << view_mode_; | 1449 NOTREACHED() << "Called with invalid mode=" << view_mode_; |
| 1441 return NULL; | 1450 return NULL; |
| 1442 } | 1451 } |
| 1443 | 1452 |
| 1444 // Adds Gaia signin webview | 1453 // Adds Gaia signin webview |
| 1445 Profile* profile = browser_->profile(); | 1454 Profile* profile = browser_->profile(); |
| 1446 views::WebView* web_view = new views::WebView(profile); | 1455 views::WebView* web_view = new views::WebView(profile); |
| 1447 web_view->LoadInitialURL(url); | 1456 web_view->LoadInitialURL(url); |
| 1457 web_view->GetWebContents()->SetDelegate(this); | |
| 1448 web_view->SetPreferredSize( | 1458 web_view->SetPreferredSize( |
| 1449 gfx::Size(kFixedGaiaViewWidth, kFixedGaiaViewHeight)); | 1459 gfx::Size(kFixedGaiaViewWidth, kFixedGaiaViewHeight)); |
| 1450 content::RenderWidgetHostView* rwhv = | 1460 content::RenderWidgetHostView* rwhv = |
| 1451 web_view->GetWebContents()->GetRenderWidgetHostView(); | 1461 web_view->GetWebContents()->GetRenderWidgetHostView(); |
| 1452 if (rwhv) | 1462 if (rwhv) |
| 1453 rwhv->SetBackgroundColor(profiles::kAvatarBubbleGaiaBackgroundColor); | 1463 rwhv->SetBackgroundColor(profiles::kAvatarBubbleGaiaBackgroundColor); |
| 1454 TitleCard* title_card = new TitleCard(l10n_util::GetStringUTF16(message_id), | 1464 TitleCard* title_card = new TitleCard(l10n_util::GetStringUTF16(message_id), |
| 1455 this, | 1465 this, |
| 1456 &gaia_signin_cancel_button_); | 1466 &gaia_signin_cancel_button_); |
| 1457 return TitleCard::AddPaddedTitleCard( | 1467 return TitleCard::AddPaddedTitleCard( |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1654 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != | 1664 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != |
| 1655 IncognitoModePrefs::DISABLED; | 1665 IncognitoModePrefs::DISABLED; |
| 1656 return incognito_available && !browser_->profile()->IsGuestSession(); | 1666 return incognito_available && !browser_->profile()->IsGuestSession(); |
| 1657 } | 1667 } |
| 1658 | 1668 |
| 1659 void ProfileChooserView::PostActionPerformed( | 1669 void ProfileChooserView::PostActionPerformed( |
| 1660 ProfileMetrics::ProfileDesktopMenu action_performed) { | 1670 ProfileMetrics::ProfileDesktopMenu action_performed) { |
| 1661 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); | 1671 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); |
| 1662 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; | 1672 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; |
| 1663 } | 1673 } |
| OLD | NEW |