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

Side by Side Diff: ui/display/display_list.h

Issue 2522563002: Remove unnecessary display:: namespaces. (Closed)
Patch Set: Rebase. Created 4 years, 1 month 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
« no previous file with comments | « no previous file | ui/display/display_list.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #ifndef UI_DISPLAY_DISPLAY_LIST_H_ 5 #ifndef UI_DISPLAY_DISPLAY_LIST_H_
6 #define UI_DISPLAY_DISPLAY_LIST_H_ 6 #define UI_DISPLAY_DISPLAY_LIST_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 17 matching lines...) Expand all
28 private: 28 private:
29 friend class DisplayList; 29 friend class DisplayList;
30 30
31 explicit DisplayListObserverLock(DisplayList* display_list); 31 explicit DisplayListObserverLock(DisplayList* display_list);
32 32
33 DisplayList* display_list_; 33 DisplayList* display_list_;
34 34
35 DISALLOW_COPY_AND_ASSIGN(DisplayListObserverLock); 35 DISALLOW_COPY_AND_ASSIGN(DisplayListObserverLock);
36 }; 36 };
37 37
38 // Maintains an ordered list of display::Displays as well as operations to add, 38 // Maintains an ordered list of Displays as well as operations to add, remove
39 // remove and update said list. Additionally maintains display::DisplayObservers 39 // and update said list. Additionally maintains DisplayObservers and updates
40 // and updates them as appropriate. 40 // them as appropriate.
41 class DISPLAY_EXPORT DisplayList { 41 class DISPLAY_EXPORT DisplayList {
42 public: 42 public:
43 using Displays = std::vector<display::Display>; 43 using Displays = std::vector<Display>;
44 44
45 enum class Type { 45 enum class Type {
46 PRIMARY, 46 PRIMARY,
47 NOT_PRIMARY, 47 NOT_PRIMARY,
48 }; 48 };
49 49
50 DisplayList(); 50 DisplayList();
51 ~DisplayList(); 51 ~DisplayList();
52 52
53 void AddObserver(display::DisplayObserver* observer); 53 void AddObserver(DisplayObserver* observer);
54 void RemoveObserver(display::DisplayObserver* observer); 54 void RemoveObserver(DisplayObserver* observer);
55 55
56 const Displays& displays() const { return displays_; } 56 const Displays& displays() const { return displays_; }
57 57
58 Displays::const_iterator FindDisplayById(int64_t id) const; 58 Displays::const_iterator FindDisplayById(int64_t id) const;
59 59
60 Displays::const_iterator GetPrimaryDisplayIterator() const; 60 Displays::const_iterator GetPrimaryDisplayIterator() const;
61 61
62 // Internally increments a counter that while non-zero results in observers 62 // Internally increments a counter that while non-zero results in observers
63 // not being called for any changes to the displays. It is assumed once 63 // not being called for any changes to the displays. It is assumed once
64 // callers release the last lock they call the observers appropriately. 64 // callers release the last lock they call the observers appropriately.
65 std::unique_ptr<DisplayListObserverLock> SuspendObserverUpdates(); 65 std::unique_ptr<DisplayListObserverLock> SuspendObserverUpdates();
66 66
67 // Updates the cached display based on display.id(). 67 // Updates the cached display based on display.id().
68 void UpdateDisplay(const display::Display& display); 68 void UpdateDisplay(const Display& display);
69 69
70 // Updates the cached display based on display.id(). Also updates the primary 70 // Updates the cached display based on display.id(). Also updates the primary
71 // display if |type| indicates |display| is the primary display. 71 // display if |type| indicates |display| is the primary display.
72 void UpdateDisplay(const display::Display& display, Type type); 72 void UpdateDisplay(const Display& display, Type type);
73 73
74 // Adds a new Display. 74 // Adds a new Display.
75 void AddDisplay(const display::Display& display, Type type); 75 void AddDisplay(const Display& display, Type type);
76 76
77 // Removes the Display with the specified id. 77 // Removes the Display with the specified id.
78 void RemoveDisplay(int64_t id); 78 void RemoveDisplay(int64_t id);
79 79
80 base::ObserverList<display::DisplayObserver>* observers() { 80 base::ObserverList<DisplayObserver>* observers() { return &observers_; }
81 return &observers_;
82 }
83 81
84 private: 82 private:
85 friend class DisplayListObserverLock; 83 friend class DisplayListObserverLock;
86 84
87 bool should_notify_observers() const { 85 bool should_notify_observers() const {
88 return observer_suspend_lock_count_ == 0; 86 return observer_suspend_lock_count_ == 0;
89 } 87 }
90 void IncrementObserverSuspendLockCount(); 88 void IncrementObserverSuspendLockCount();
91 void DecrementObserverSuspendLockCount(); 89 void DecrementObserverSuspendLockCount();
92 90
93 Type GetTypeByDisplayId(int64_t display_id) const; 91 Type GetTypeByDisplayId(int64_t display_id) const;
94 92
95 Displays::iterator FindDisplayByIdInternal(int64_t id); 93 Displays::iterator FindDisplayByIdInternal(int64_t id);
96 94
97 std::vector<display::Display> displays_; 95 std::vector<Display> displays_;
98 int primary_display_index_ = -1; 96 int primary_display_index_ = -1;
99 base::ObserverList<display::DisplayObserver> observers_; 97 base::ObserverList<DisplayObserver> observers_;
100 98
101 int observer_suspend_lock_count_ = 0; 99 int observer_suspend_lock_count_ = 0;
102 100
103 DISALLOW_COPY_AND_ASSIGN(DisplayList); 101 DISALLOW_COPY_AND_ASSIGN(DisplayList);
104 }; 102 };
105 103
106 } // namespace display 104 } // namespace display
107 105
108 #endif // UI_DISPLAY_DISPLAY_LIST_H_ 106 #endif // UI_DISPLAY_DISPLAY_LIST_H_
OLDNEW
« no previous file with comments | « no previous file | ui/display/display_list.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698