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

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

Issue 1608053002: Remove now-unnecessary wrappers around gfx::Screen::GetScreen() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@metro-mode-5
Patch Set: cros Created 4 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 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 <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "ash/display/display_manager.h" 10 #include "ash/display/display_manager.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 BOTTOM_RIGHT, 53 BOTTOM_RIGHT,
54 OUTSIDE 54 OUTSIDE
55 }; 55 };
56 56
57 AshPopupAlignmentDelegate* alignment_delegate() { 57 AshPopupAlignmentDelegate* alignment_delegate() {
58 return alignment_delegate_.get(); 58 return alignment_delegate_.get();
59 } 59 }
60 60
61 void UpdateWorkArea(AshPopupAlignmentDelegate* alignment_delegate, 61 void UpdateWorkArea(AshPopupAlignmentDelegate* alignment_delegate,
62 const gfx::Display& display) { 62 const gfx::Display& display) {
63 alignment_delegate->StartObserving(Shell::GetScreen(), display); 63 alignment_delegate->StartObserving(gfx::Screen::GetScreen(), display);
64 // Update the layout 64 // Update the layout
65 alignment_delegate->OnDisplayWorkAreaInsetsChanged(); 65 alignment_delegate->OnDisplayWorkAreaInsetsChanged();
66 } 66 }
67 67
68 void SetAlignmentDelegate(scoped_ptr<AshPopupAlignmentDelegate> delegate) { 68 void SetAlignmentDelegate(scoped_ptr<AshPopupAlignmentDelegate> delegate) {
69 if (!delegate.get()) { 69 if (!delegate.get()) {
70 alignment_delegate_.reset(); 70 alignment_delegate_.reset();
71 return; 71 return;
72 } 72 }
73 alignment_delegate_ = std::move(delegate); 73 alignment_delegate_ = std::move(delegate);
74 UpdateWorkArea(alignment_delegate_.get(), 74 UpdateWorkArea(alignment_delegate_.get(),
75 Shell::GetScreen()->GetPrimaryDisplay()); 75 gfx::Screen::GetScreen()->GetPrimaryDisplay());
76 } 76 }
77 77
78 Position GetPositionInDisplay(const gfx::Point& point) { 78 Position GetPositionInDisplay(const gfx::Point& point) {
79 const gfx::Rect& work_area = 79 const gfx::Rect& work_area =
80 Shell::GetScreen()->GetPrimaryDisplay().work_area(); 80 gfx::Screen::GetScreen()->GetPrimaryDisplay().work_area();
81 const gfx::Point center_point = work_area.CenterPoint(); 81 const gfx::Point center_point = work_area.CenterPoint();
82 if (work_area.x() > point.x() || work_area.y() > point.y() || 82 if (work_area.x() > point.x() || work_area.y() > point.y() ||
83 work_area.right() < point.x() || work_area.bottom() < point.y()) { 83 work_area.right() < point.x() || work_area.bottom() < point.y()) {
84 return OUTSIDE; 84 return OUTSIDE;
85 } 85 }
86 86
87 if (center_point.x() < point.x()) 87 if (center_point.x() < point.x())
88 return (center_point.y() < point.y()) ? BOTTOM_RIGHT : TOP_RIGHT; 88 return (center_point.y() < point.y()) ? BOTTOM_RIGHT : TOP_RIGHT;
89 else 89 else
90 return (center_point.y() < point.y()) ? BOTTOM_LEFT : TOP_LEFT; 90 return (center_point.y() < point.y()) ? BOTTOM_LEFT : TOP_LEFT;
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 SetKeyboardBounds(keyboard_bounds); 306 SetKeyboardBounds(keyboard_bounds);
307 int keyboard_baseline = alignment_delegate()->GetBaseLine(); 307 int keyboard_baseline = alignment_delegate()->GetBaseLine();
308 EXPECT_NE(baseline, keyboard_baseline); 308 EXPECT_NE(baseline, keyboard_baseline);
309 EXPECT_GT(keyboard_bounds.y(), keyboard_baseline); 309 EXPECT_GT(keyboard_bounds.y(), keyboard_baseline);
310 310
311 SetKeyboardBounds(gfx::Rect()); 311 SetKeyboardBounds(gfx::Rect());
312 EXPECT_EQ(baseline, alignment_delegate()->GetBaseLine()); 312 EXPECT_EQ(baseline, alignment_delegate()->GetBaseLine());
313 } 313 }
314 314
315 } // namespace ash 315 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/web_notification/ash_popup_alignment_delegate.cc ('k') | ash/system/web_notification/web_notification_tray.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698