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

Side by Side Diff: chrome/browser/chromeos/login/ui/login_display_host_impl.cc

Issue 2885153004: React to primary display change instead of removal (Closed)
Patch Set: Remove the probably unnecessary safe guards for test shutdown Created 3 years, 7 months 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/chromeos/login/ui/login_display_host_impl.h" 5 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "ash/public/cpp/shell_window_ids.h" 10 #include "ash/public/cpp/shell_window_ids.h"
(...skipping 962 matching lines...) Expand 10 before | Expand all | Expand 10 after
973 } 973 }
974 974
975 //////////////////////////////////////////////////////////////////////////////// 975 ////////////////////////////////////////////////////////////////////////////////
976 // LoginDisplayHostImpl, display::DisplayObserver: 976 // LoginDisplayHostImpl, display::DisplayObserver:
977 977
978 void LoginDisplayHostImpl::OnDisplayAdded(const display::Display& new_display) { 978 void LoginDisplayHostImpl::OnDisplayAdded(const display::Display& new_display) {
979 if (GetOobeUI()) 979 if (GetOobeUI())
980 GetOobeUI()->OnDisplayConfigurationChanged(); 980 GetOobeUI()->OnDisplayConfigurationChanged();
981 } 981 }
982 982
983 void LoginDisplayHostImpl::OnDisplayRemoved(
984 const display::Display& old_display) {
985 if (GetOobeUI())
986 GetOobeUI()->OnDisplayConfigurationChanged();
987 }
988
989 void LoginDisplayHostImpl::OnDisplayMetricsChanged( 983 void LoginDisplayHostImpl::OnDisplayMetricsChanged(
990 const display::Display& display, 984 const display::Display& display,
991 uint32_t changed_metrics) { 985 uint32_t changed_metrics) {
992 display::Display primary_display = 986 display::Display primary_display =
achuithb 2017/05/23 20:14:22 nit also make this const while you're here
Felix Ekblom 2017/05/23 20:42:19 Done.
993 display::Screen::GetScreen()->GetPrimaryDisplay(); 987 display::Screen::GetScreen()->GetPrimaryDisplay();
994 if (display.id() != primary_display.id() || 988 if (display.id() != primary_display.id() ||
995 !(changed_metrics & DISPLAY_METRIC_BOUNDS)) { 989 !(changed_metrics & DISPLAY_METRIC_BOUNDS)) {
achuithb 2017/05/23 20:14:22 Maybe cache this value in a const bool?
996 return; 990 return;
997 } 991 }
998 992
999 if (GetOobeUI()) { 993 if (GetOobeUI()) {
1000 const gfx::Size& size = primary_display.size(); 994 const gfx::Size& size = primary_display.size();
1001 GetOobeUI()->GetCoreOobeView()->SetClientAreaSize(size.width(), 995 GetOobeUI()->GetCoreOobeView()->SetClientAreaSize(size.width(),
1002 size.height()); 996 size.height());
997
998 if (changed_metrics & DISPLAY_METRIC_PRIMARY)
999 GetOobeUI()->OnDisplayConfigurationChanged();
1003 } 1000 }
1004 } 1001 }
1005 1002
1006 //////////////////////////////////////////////////////////////////////////////// 1003 ////////////////////////////////////////////////////////////////////////////////
1007 // LoginDisplayHostImpl, views::WidgetRemovalsObserver: 1004 // LoginDisplayHostImpl, views::WidgetRemovalsObserver:
1008 void LoginDisplayHostImpl::OnWillRemoveView(views::Widget* widget, 1005 void LoginDisplayHostImpl::OnWillRemoveView(views::Widget* widget,
1009 views::View* view) { 1006 views::View* view) {
1010 if (view != static_cast<views::View*>(login_view_)) 1007 if (view != static_cast<views::View*>(login_view_))
1011 return; 1008 return;
1012 login_view_ = nullptr; 1009 login_view_ = nullptr;
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
1395 // Chrome locale. Otherwise it will be lost if Chrome restarts. 1392 // Chrome locale. Otherwise it will be lost if Chrome restarts.
1396 // Don't need to schedule pref save because setting initial local 1393 // Don't need to schedule pref save because setting initial local
1397 // will enforce preference saving. 1394 // will enforce preference saving.
1398 prefs->SetString(prefs::kApplicationLocale, locale); 1395 prefs->SetString(prefs::kApplicationLocale, locale);
1399 StartupUtils::SetInitialLocale(locale); 1396 StartupUtils::SetInitialLocale(locale);
1400 1397
1401 TriggerShowLoginWizardFinish(locale, std::move(data)); 1398 TriggerShowLoginWizardFinish(locale, std::move(data));
1402 } 1399 }
1403 1400
1404 } // namespace chromeos 1401 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698