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

Side by Side Diff: chrome/browser/chromeos/display/primary_display_switch_observer.cc

Issue 12438016: Save display preference when all display configuration changes has been completed. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: replace dcheck Created 7 years, 9 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/chromeos/display/primary_display_switch_observer.h"
6
7 #include "ash/shell.h"
8 #include "chrome/browser/chromeos/display/display_preferences.h"
9 #include "ui/aura/root_window.h"
10
11 namespace chromeos {
12
13 PrimaryDisplaySwitchObserver::PrimaryDisplaySwitchObserver()
14 : primary_root_(ash::Shell::GetInstance()->GetPrimaryRootWindow()) {
15 primary_root_->AddRootWindowObserver(this);
16 primary_root_->AddObserver(this);
17 }
18
19 PrimaryDisplaySwitchObserver::~PrimaryDisplaySwitchObserver() {
20 primary_root_->RemoveRootWindowObserver(this);
21 primary_root_->RemoveObserver(this);
22 }
23
24 void PrimaryDisplaySwitchObserver::OnRootWindowMoved(
25 const aura::RootWindow* root_window, const gfx::Point& new_origin) {
26 StoreDisplayPrefs();
27 }
28
29 void PrimaryDisplaySwitchObserver::OnWindowDestroying(aura::Window* window) {
30 if (primary_root_ == window) {
31 primary_root_->RemoveRootWindowObserver(this);
32 primary_root_->RemoveObserver(this);
33 primary_root_ = ash::Shell::GetInstance()->GetPrimaryRootWindow();
34 primary_root_->AddRootWindowObserver(this);
35 primary_root_->AddObserver(this);
36 }
37 }
38
39 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/display/primary_display_switch_observer.h ('k') | chrome/chrome_browser_chromeos.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698