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

Unified Diff: ui/gfx/display_change_notifier.cc

Issue 1964153002: Move Screen, its impls, DisplayObserver and DisplayChangeNotifier to ui/display (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix tabs Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gfx/display_change_notifier.h ('k') | ui/gfx/display_change_notifier_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/display_change_notifier.cc
diff --git a/ui/gfx/display_change_notifier.cc b/ui/gfx/display_change_notifier.cc
deleted file mode 100644
index b8cf54d08fea1ca80048c009afec847f5edf4e57..0000000000000000000000000000000000000000
--- a/ui/gfx/display_change_notifier.cc
+++ /dev/null
@@ -1,94 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ui/gfx/display_change_notifier.h"
-
-#include <stdint.h>
-
-#include "ui/gfx/display.h"
-#include "ui/gfx/display_observer.h"
-
-namespace gfx {
-
-namespace {
-
-class DisplayComparator {
- public:
- explicit DisplayComparator(const Display& display)
- : display_id_(display.id())
- {}
-
- bool operator()(const Display& display) const {
- return display.id() == display_id_;
- }
-
- private:
- int64_t display_id_;
-};
-
-} // anonymous namespace
-
-DisplayChangeNotifier::DisplayChangeNotifier() {
-}
-
-DisplayChangeNotifier::~DisplayChangeNotifier() {
-}
-
-void DisplayChangeNotifier::AddObserver(DisplayObserver* obs) {
- observer_list_.AddObserver(obs);
-}
-
-void DisplayChangeNotifier::RemoveObserver(DisplayObserver* obs) {
- observer_list_.RemoveObserver(obs);
-}
-
-void DisplayChangeNotifier::NotifyDisplaysChanged(
- const std::vector<Display>& old_displays,
- const std::vector<Display>& new_displays) {
- // Display present in old_displays but not in new_displays has been removed.
- std::vector<Display>::const_iterator old_it = old_displays.begin();
- for (; old_it != old_displays.end(); ++old_it) {
- if (std::find_if(new_displays.begin(), new_displays.end(),
- DisplayComparator(*old_it)) == new_displays.end()) {
- FOR_EACH_OBSERVER(DisplayObserver, observer_list_,
- OnDisplayRemoved(*old_it));
- }
- }
-
- // Display present in new_displays but not in old_displays has been added.
- // Display present in both might have been modified.
- for (std::vector<Display>::const_iterator new_it =
- new_displays.begin(); new_it != new_displays.end(); ++new_it) {
- std::vector<Display>::const_iterator old_it = std::find_if(
- old_displays.begin(), old_displays.end(), DisplayComparator(*new_it));
-
- if (old_it == old_displays.end()) {
- FOR_EACH_OBSERVER(DisplayObserver, observer_list_,
- OnDisplayAdded(*new_it));
- continue;
- }
-
- uint32_t metrics = DisplayObserver::DISPLAY_METRIC_NONE;
-
- if (new_it->bounds() != old_it->bounds())
- metrics |= DisplayObserver::DISPLAY_METRIC_BOUNDS;
-
- if (new_it->rotation() != old_it->rotation())
- metrics |= DisplayObserver::DISPLAY_METRIC_ROTATION;
-
- if (new_it->work_area() != old_it->work_area())
- metrics |= DisplayObserver::DISPLAY_METRIC_WORK_AREA;
-
- if (new_it->device_scale_factor() != old_it->device_scale_factor())
- metrics |= DisplayObserver::DISPLAY_METRIC_DEVICE_SCALE_FACTOR;
-
- if (metrics != DisplayObserver::DISPLAY_METRIC_NONE) {
- FOR_EACH_OBSERVER(DisplayObserver,
- observer_list_,
- OnDisplayMetricsChanged(*new_it, metrics));
- }
- }
-}
-
-} // namespace gfx
« no previous file with comments | « ui/gfx/display_change_notifier.h ('k') | ui/gfx/display_change_notifier_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698