OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/display/primary_display_switch_observer.h" | 5 #include "chrome/browser/chromeos/display/primary_display_switch_observer.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "chrome/browser/chromeos/display/display_preferences.h" | 8 #include "chrome/browser/chromeos/display/display_preferences.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/profiles/profile_manager.h" | 10 #include "chrome/browser/profiles/profile_manager.h" |
11 #include "ui/aura/root_window.h" | 11 #include "ui/aura/root_window.h" |
12 #include "ui/gfx/display.h" | 12 #include "ui/gfx/display.h" |
13 #include "ui/gfx/screen.h" | 13 #include "ui/gfx/screen.h" |
14 | 14 |
15 namespace chromeos { | 15 namespace chromeos { |
16 | 16 |
17 void PrimaryDisplaySwitchObserver::OnRootWindowMoved( | 17 void PrimaryDisplaySwitchObserver::OnRootWindowMoved( |
18 const aura::RootWindow* root_window, const gfx::Point& new_origin) { | 18 const aura::RootWindow* root_window, const gfx::Point& new_origin) { |
19 StorePrimaryDisplayIDPref(ProfileManager::GetDefaultProfile()->GetPrefs(), | 19 StorePrimaryDisplayIDPref( |
20 gfx::Screen::GetPrimaryDisplay().id()); | 20 ProfileManager::GetDefaultProfile()->GetPrefs(), |
| 21 ash::Shell::GetAshScreen()->GetPrimaryDisplay().id()); |
21 } | 22 } |
22 | 23 |
23 PrimaryDisplaySwitchObserver::PrimaryDisplaySwitchObserver() | 24 PrimaryDisplaySwitchObserver::PrimaryDisplaySwitchObserver() |
24 : primary_root_(ash::Shell::GetInstance()->GetPrimaryRootWindow()) { | 25 : primary_root_(ash::Shell::GetInstance()->GetPrimaryRootWindow()) { |
25 primary_root_->AddRootWindowObserver(this); | 26 primary_root_->AddRootWindowObserver(this); |
26 } | 27 } |
27 | 28 |
28 PrimaryDisplaySwitchObserver::~PrimaryDisplaySwitchObserver() { | 29 PrimaryDisplaySwitchObserver::~PrimaryDisplaySwitchObserver() { |
29 primary_root_->RemoveRootWindowObserver(this); | 30 primary_root_->RemoveRootWindowObserver(this); |
30 } | 31 } |
31 | 32 |
32 } // namespace chromeos | 33 } // namespace chromeos |
OLD | NEW |