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

Unified Diff: ash/display/display_manager.cc

Issue 138003007: [Cleanup] Screen cleanup (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix conflict Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: ash/display/display_manager.cc
diff --git a/ash/display/display_manager.cc b/ash/display/display_manager.cc
index 2731144a99536a88dbe9322bc2730d9f6f082386..c425c848df0152711b2187f1911e4d23ecc9a4eb 100644
--- a/ash/display/display_manager.cc
+++ b/ash/display/display_manager.cc
@@ -11,7 +11,8 @@
#include "ash/ash_switches.h"
#include "ash/display/display_layout_store.h"
-#include "ash/screen_ash.h"
+#include "ash/display/screen_ash.h"
+#include "ash/screen_util.h"
#include "ash/shell.h"
#include "base/auto_reset.h"
#include "base/command_line.h"
@@ -143,6 +144,8 @@ using std::vector;
DisplayManager::DisplayManager()
: delegate_(NULL),
+ screen_ash_(new ScreenAsh),
+ screen_(screen_ash_.get()),
layout_store_(new DisplayLayoutStore),
first_display_id_(gfx::Display::kInvalidDisplayID),
num_connected_displays_(0),
@@ -302,7 +305,7 @@ void DisplayManager::SetLayoutForCurrentDisplays(
DCHECK_EQ(2U, GetNumDisplays());
if (GetNumDisplays() < 2)
return;
- const gfx::Display& primary = Shell::GetScreen()->GetPrimaryDisplay();
+ const gfx::Display& primary = screen_->GetPrimaryDisplay();
const DisplayIdPair pair = GetCurrentDisplayIdPair();
// Invert if the primary was swapped.
DisplayLayout to_set = pair.first == primary.id() ?
@@ -322,13 +325,12 @@ void DisplayManager::SetLayoutForCurrentDisplays(
const DisplayLayout layout = GetCurrentDisplayLayout();
UpdateDisplayBoundsForLayoutById(
layout, primary,
- ScreenAsh::GetSecondaryDisplay().id());
+ ScreenUtil::GetSecondaryDisplay().id());
- //UpdateCurrentDisplayBoundsForLayout();
// Primary's bounds stay the same. Just notify bounds change
// on the secondary.
- Shell::GetInstance()->screen()->NotifyBoundsChanged(
- ScreenAsh::GetSecondaryDisplay());
+ screen_ash_->NotifyBoundsChanged(
+ ScreenUtil::GetSecondaryDisplay());
if (delegate_)
delegate_->PostDisplayConfigurationChange();
}
@@ -751,7 +753,7 @@ void DisplayManager::UpdateDisplays(
for (DisplayList::const_reverse_iterator iter = removed_displays.rbegin();
iter != removed_displays.rend(); ++iter) {
- Shell::GetInstance()->screen()->NotifyDisplayRemoved(displays_.back());
+ screen_ash_->NotifyDisplayRemoved(displays_.back());
displays_.pop_back();
}
// Close the non desktop window here to avoid creating two compositor on
@@ -760,7 +762,7 @@ void DisplayManager::UpdateDisplays(
non_desktop_display_updater.reset();
for (std::vector<size_t>::iterator iter = added_display_indices.begin();
iter != added_display_indices.end(); ++iter) {
- Shell::GetInstance()->screen()->NotifyDisplayAdded(displays_[*iter]);
+ screen_ash_->NotifyDisplayAdded(displays_[*iter]);
}
// Create the non destkop window after all displays are added so that
// it can mirror the display newly added. This can happen when switching
@@ -768,7 +770,7 @@ void DisplayManager::UpdateDisplays(
non_desktop_display_updater.reset();
for (std::vector<size_t>::iterator iter = changed_display_indices.begin();
iter != changed_display_indices.end(); ++iter) {
- Shell::GetInstance()->screen()->NotifyBoundsChanged(displays_[*iter]);
+ screen_ash_->NotifyBoundsChanged(displays_[*iter]);
}
if (delegate_)
delegate_->PostDisplayConfigurationChange();
@@ -915,7 +917,7 @@ bool DisplayManager::UpdateDisplayBounds(int64 display_id,
return false;
gfx::Display* display = FindDisplayForId(display_id);
display->SetSize(display_info_[display_id].size_in_pixel());
- Shell::GetInstance()->screen()->NotifyBoundsChanged(*display);
+ screen_ash_->NotifyBoundsChanged(*display);
return true;
}
return false;
@@ -925,6 +927,10 @@ void DisplayManager::CreateMirrorWindowIfAny() {
NonDesktopDisplayUpdater updater(this, delegate_);
}
+gfx::Screen* DisplayManager::CreateScreenForShutdown() const{
+ return screen_ash_->CloneForShutdown();
+}
+
gfx::Display* DisplayManager::FindDisplayForId(int64 id) {
for (DisplayList::iterator iter = displays_.begin();
iter != displays_.end(); ++iter) {

Powered by Google App Engine
This is Rietveld 408576698