Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(280)

Side by Side Diff: chrome/browser/ui/views/profiles/profile_chooser_view.cc

Issue 682113002: Fix accelerators in avatar gaia webview on mac (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits fixed Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 in non-debug mode.
716 #ifndef NDEBUG
717 return false;
718 #else
719 return true;
720 #endif
721 }
722
713 void ProfileChooserView::ButtonPressed(views::Button* sender, 723 void ProfileChooserView::ButtonPressed(views::Button* sender,
714 const ui::Event& event) { 724 const ui::Event& event) {
715 if (sender == users_button_) { 725 if (sender == users_button_) {
716 // If this is a guest session, close all the guest browser windows. 726 // If this is a guest session, close all the guest browser windows.
717 if (browser_->profile()->IsGuestSession()) { 727 if (browser_->profile()->IsGuestSession()) {
718 profiles::CloseGuestProfileWindows(); 728 profiles::CloseGuestProfileWindows();
719 } else { 729 } else {
720 UserManager::Show(base::FilePath(), 730 UserManager::Show(base::FilePath(),
721 profiles::USER_MANAGER_NO_TUTORIAL, 731 profiles::USER_MANAGER_NO_TUTORIAL,
722 profiles::USER_MANAGER_SELECT_PROFILE_NO_ACTION); 732 profiles::USER_MANAGER_SELECT_PROFILE_NO_ACTION);
(...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after
1438 } 1448 }
1439 default: 1449 default:
1440 NOTREACHED() << "Called with invalid mode=" << view_mode_; 1450 NOTREACHED() << "Called with invalid mode=" << view_mode_;
1441 return NULL; 1451 return NULL;
1442 } 1452 }
1443 1453
1444 // Adds Gaia signin webview 1454 // Adds Gaia signin webview
1445 Profile* profile = browser_->profile(); 1455 Profile* profile = browser_->profile();
1446 views::WebView* web_view = new views::WebView(profile); 1456 views::WebView* web_view = new views::WebView(profile);
1447 web_view->LoadInitialURL(url); 1457 web_view->LoadInitialURL(url);
1458 web_view->GetWebContents()->SetDelegate(this);
1448 web_view->SetPreferredSize( 1459 web_view->SetPreferredSize(
1449 gfx::Size(kFixedGaiaViewWidth, kFixedGaiaViewHeight)); 1460 gfx::Size(kFixedGaiaViewWidth, kFixedGaiaViewHeight));
1450 content::RenderWidgetHostView* rwhv = 1461 content::RenderWidgetHostView* rwhv =
1451 web_view->GetWebContents()->GetRenderWidgetHostView(); 1462 web_view->GetWebContents()->GetRenderWidgetHostView();
1452 if (rwhv) 1463 if (rwhv)
1453 rwhv->SetBackgroundColor(profiles::kAvatarBubbleGaiaBackgroundColor); 1464 rwhv->SetBackgroundColor(profiles::kAvatarBubbleGaiaBackgroundColor);
1454 TitleCard* title_card = new TitleCard(l10n_util::GetStringUTF16(message_id), 1465 TitleCard* title_card = new TitleCard(l10n_util::GetStringUTF16(message_id),
1455 this, 1466 this,
1456 &gaia_signin_cancel_button_); 1467 &gaia_signin_cancel_button_);
1457 return TitleCard::AddPaddedTitleCard( 1468 return TitleCard::AddPaddedTitleCard(
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
1654 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != 1665 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) !=
1655 IncognitoModePrefs::DISABLED; 1666 IncognitoModePrefs::DISABLED;
1656 return incognito_available && !browser_->profile()->IsGuestSession(); 1667 return incognito_available && !browser_->profile()->IsGuestSession();
1657 } 1668 }
1658 1669
1659 void ProfileChooserView::PostActionPerformed( 1670 void ProfileChooserView::PostActionPerformed(
1660 ProfileMetrics::ProfileDesktopMenu action_performed) { 1671 ProfileMetrics::ProfileDesktopMenu action_performed) {
1661 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); 1672 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_);
1662 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; 1673 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE;
1663 } 1674 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698