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

Side by Side Diff: ash/system/web_notification/ash_popup_alignment_delegate.cc

Issue 1924703002: Rename gfx::Display/Screen to display::Display/Screen in ash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "ash/system/web_notification/ash_popup_alignment_delegate.h" 5 #include "ash/system/web_notification/ash_popup_alignment_delegate.h"
6 6
7 #include "ash/display/window_tree_host_manager.h" 7 #include "ash/display/window_tree_host_manager.h"
8 #include "ash/screen_util.h" 8 #include "ash/screen_util.h"
9 #include "ash/shelf/shelf_constants.h" 9 #include "ash/shelf/shelf_constants.h"
10 #include "ash/shelf/shelf_layout_manager.h" 10 #include "ash/shelf/shelf_layout_manager.h"
11 #include "ash/shelf/shelf_types.h" 11 #include "ash/shelf/shelf_types.h"
12 #include "ash/shelf/shelf_widget.h" 12 #include "ash/shelf/shelf_widget.h"
13 #include "ash/shell.h" 13 #include "ash/shell.h"
14 #include "base/i18n/rtl.h" 14 #include "base/i18n/rtl.h"
15 #include "ui/aura/window.h" 15 #include "ui/aura/window.h"
16 #include "ui/gfx/display.h" 16 #include "ui/display/display.h"
17 #include "ui/display/screen.h"
17 #include "ui/gfx/geometry/rect.h" 18 #include "ui/gfx/geometry/rect.h"
18 #include "ui/gfx/screen.h"
19 #include "ui/message_center/message_center_style.h" 19 #include "ui/message_center/message_center_style.h"
20 #include "ui/message_center/views/message_popup_collection.h" 20 #include "ui/message_center/views/message_popup_collection.h"
21 21
22 namespace ash { 22 namespace ash {
23 23
24 namespace { 24 namespace {
25 25
26 const int kToastMarginX = 3; 26 const int kToastMarginX = 3;
27 27
28 // If there should be no margin for the first item, this value needs to be 28 // If there should be no margin for the first item, this value needs to be
29 // substracted to flush the message to the shelf (the width of the border + 29 // substracted to flush the message to the shelf (the width of the border +
30 // shadow). 30 // shadow).
31 const int kNoToastMarginBorderAndShadowOffset = 2; 31 const int kNoToastMarginBorderAndShadowOffset = 2;
32 32
33 } 33 }
34 34
35 AshPopupAlignmentDelegate::AshPopupAlignmentDelegate(ShelfLayoutManager* shelf) 35 AshPopupAlignmentDelegate::AshPopupAlignmentDelegate(ShelfLayoutManager* shelf)
36 : screen_(NULL), shelf_(shelf), system_tray_height_(0) { 36 : screen_(NULL), shelf_(shelf), system_tray_height_(0) {
37 shelf_->AddObserver(this); 37 shelf_->AddObserver(this);
38 } 38 }
39 39
40 AshPopupAlignmentDelegate::~AshPopupAlignmentDelegate() { 40 AshPopupAlignmentDelegate::~AshPopupAlignmentDelegate() {
41 if (screen_) 41 if (screen_)
42 screen_->RemoveObserver(this); 42 screen_->RemoveObserver(this);
43 Shell::GetInstance()->RemoveShellObserver(this); 43 Shell::GetInstance()->RemoveShellObserver(this);
44 shelf_->RemoveObserver(this); 44 shelf_->RemoveObserver(this);
45 } 45 }
46 46
47 void AshPopupAlignmentDelegate::StartObserving(gfx::Screen* screen, 47 void AshPopupAlignmentDelegate::StartObserving(
48 const gfx::Display& display) { 48 display::Screen* screen,
49 const display::Display& display) {
49 screen_ = screen; 50 screen_ = screen;
50 work_area_ = display.work_area(); 51 work_area_ = display.work_area();
51 screen->AddObserver(this); 52 screen->AddObserver(this);
52 Shell::GetInstance()->AddShellObserver(this); 53 Shell::GetInstance()->AddShellObserver(this);
53 if (system_tray_height_ > 0) 54 if (system_tray_height_ > 0)
54 UpdateWorkArea(); 55 UpdateWorkArea();
55 } 56 }
56 57
57 void AshPopupAlignmentDelegate::SetSystemTrayHeight(int height) { 58 void AshPopupAlignmentDelegate::SetSystemTrayHeight(int height) {
58 system_tray_height_ = height; 59 system_tray_height_ = height;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 96
96 bool AshPopupAlignmentDelegate::IsTopDown() const { 97 bool AshPopupAlignmentDelegate::IsTopDown() const {
97 return false; 98 return false;
98 } 99 }
99 100
100 bool AshPopupAlignmentDelegate::IsFromLeft() const { 101 bool AshPopupAlignmentDelegate::IsFromLeft() const {
101 return GetAlignment() == wm::SHELF_ALIGNMENT_LEFT; 102 return GetAlignment() == wm::SHELF_ALIGNMENT_LEFT;
102 } 103 }
103 104
104 void AshPopupAlignmentDelegate::RecomputeAlignment( 105 void AshPopupAlignmentDelegate::RecomputeAlignment(
105 const gfx::Display& display) { 106 const display::Display& display) {
106 // Nothing needs to be done. 107 // Nothing needs to be done.
107 } 108 }
108 109
109 wm::ShelfAlignment AshPopupAlignmentDelegate::GetAlignment() const { 110 wm::ShelfAlignment AshPopupAlignmentDelegate::GetAlignment() const {
110 return shelf_->GetAlignment(); 111 return shelf_->GetAlignment();
111 } 112 }
112 113
113 gfx::Display AshPopupAlignmentDelegate::GetCurrentDisplay() const { 114 display::Display AshPopupAlignmentDelegate::GetCurrentDisplay() const {
114 return gfx::Screen::GetScreen()->GetDisplayNearestWindow( 115 return display::Screen::GetScreen()->GetDisplayNearestWindow(
115 shelf_->shelf_widget()->GetNativeView()); 116 shelf_->shelf_widget()->GetNativeView());
116 } 117 }
117 118
118 void AshPopupAlignmentDelegate::UpdateWorkArea() { 119 void AshPopupAlignmentDelegate::UpdateWorkArea() {
119 work_area_ = shelf_->user_work_area_bounds(); 120 work_area_ = shelf_->user_work_area_bounds();
120 DoUpdateIfPossible(); 121 DoUpdateIfPossible();
121 } 122 }
122 123
123 void AshPopupAlignmentDelegate::OnDisplayWorkAreaInsetsChanged() { 124 void AshPopupAlignmentDelegate::OnDisplayWorkAreaInsetsChanged() {
124 UpdateWorkArea(); 125 UpdateWorkArea();
125 } 126 }
126 127
127 void AshPopupAlignmentDelegate::WillChangeVisibilityState( 128 void AshPopupAlignmentDelegate::WillChangeVisibilityState(
128 ShelfVisibilityState new_state) { 129 ShelfVisibilityState new_state) {
129 UpdateWorkArea(); 130 UpdateWorkArea();
130 } 131 }
131 132
132 void AshPopupAlignmentDelegate::OnAutoHideStateChanged( 133 void AshPopupAlignmentDelegate::OnAutoHideStateChanged(
133 ShelfAutoHideState new_state) { 134 ShelfAutoHideState new_state) {
134 UpdateWorkArea(); 135 UpdateWorkArea();
135 } 136 }
136 137
137 void AshPopupAlignmentDelegate::OnDisplayAdded( 138 void AshPopupAlignmentDelegate::OnDisplayAdded(
138 const gfx::Display& new_display) { 139 const display::Display& new_display) {}
139 }
140 140
141 void AshPopupAlignmentDelegate::OnDisplayRemoved( 141 void AshPopupAlignmentDelegate::OnDisplayRemoved(
142 const gfx::Display& old_display) { 142 const display::Display& old_display) {}
143 }
144 143
145 void AshPopupAlignmentDelegate::OnDisplayMetricsChanged( 144 void AshPopupAlignmentDelegate::OnDisplayMetricsChanged(
146 const gfx::Display& display, 145 const display::Display& display,
147 uint32_t metrics) { 146 uint32_t metrics) {
148 if (GetCurrentDisplay().id() == display.id()) 147 if (GetCurrentDisplay().id() == display.id())
149 UpdateWorkArea(); 148 UpdateWorkArea();
150 } 149 }
151 150
152 } // namespace ash 151 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698