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/prefs/pref_service.h" | 8 #include "chrome/browser/prefs/pref_service.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 "chrome/common/pref_names.h" | 11 #include "chrome/common/pref_names.h" |
12 #include "ui/aura/root_window.h" | 12 #include "ui/aura/root_window.h" |
13 #include "ui/gfx/display.h" | 13 #include "ui/gfx/display.h" |
14 #include "ui/gfx/screen.h" | 14 #include "ui/gfx/screen.h" |
15 | 15 |
16 namespace chromeos { | 16 namespace chromeos { |
17 | 17 |
18 void PrimaryDisplaySwitchObserver::OnRootWindowMoved( | 18 void PrimaryDisplaySwitchObserver::OnRootWindowMoved( |
19 const aura::RootWindow* root_window, const gfx::Point& new_origin) { | 19 const aura::RootWindow* root_window, const gfx::Point& new_origin) { |
20 PrefService* pref_service = ProfileManager::GetDefaultProfile()->GetPrefs(); | 20 PrefService* pref_service = ProfileManager::GetDefaultProfile()->GetPrefs(); |
21 pref_service->SetInt64( | 21 pref_service->SetInt64( |
22 prefs::kPrimaryDisplayID, gfx::Screen::GetPrimaryDisplay().id()); | 22 prefs::kPrimaryDisplayID, |
| 23 ash::Shell::GetAshScreen()->GetPrimaryDisplay().id()); |
23 } | 24 } |
24 | 25 |
25 PrimaryDisplaySwitchObserver::PrimaryDisplaySwitchObserver() | 26 PrimaryDisplaySwitchObserver::PrimaryDisplaySwitchObserver() |
26 : primary_root_(ash::Shell::GetInstance()->GetPrimaryRootWindow()) { | 27 : primary_root_(ash::Shell::GetInstance()->GetPrimaryRootWindow()) { |
27 primary_root_->AddRootWindowObserver(this); | 28 primary_root_->AddRootWindowObserver(this); |
28 } | 29 } |
29 | 30 |
30 PrimaryDisplaySwitchObserver::~PrimaryDisplaySwitchObserver() { | 31 PrimaryDisplaySwitchObserver::~PrimaryDisplaySwitchObserver() { |
31 primary_root_->RemoveRootWindowObserver(this); | 32 primary_root_->RemoveRootWindowObserver(this); |
32 } | 33 } |
33 | 34 |
34 } // namespace chromeos | 35 } // namespace chromeos |
OLD | NEW |