| OLD | NEW |
| 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/common/system/web_notification/ash_popup_alignment_delegate.h" | 5 #include "ash/common/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/common/shelf/shelf_types.h" | 10 #include "ash/common/shelf/shelf_types.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 enum Position { TOP_LEFT, TOP_RIGHT, BOTTOM_LEFT, BOTTOM_RIGHT, OUTSIDE }; | 49 enum Position { TOP_LEFT, TOP_RIGHT, BOTTOM_LEFT, BOTTOM_RIGHT, OUTSIDE }; |
| 50 | 50 |
| 51 AshPopupAlignmentDelegate* alignment_delegate() { | 51 AshPopupAlignmentDelegate* alignment_delegate() { |
| 52 return alignment_delegate_.get(); | 52 return alignment_delegate_.get(); |
| 53 } | 53 } |
| 54 | 54 |
| 55 void UpdateWorkArea(AshPopupAlignmentDelegate* alignment_delegate, | 55 void UpdateWorkArea(AshPopupAlignmentDelegate* alignment_delegate, |
| 56 const display::Display& display) { | 56 const display::Display& display) { |
| 57 alignment_delegate->StartObserving(display::Screen::GetScreen(), display); | 57 alignment_delegate->StartObserving(display::Screen::GetScreen(), display); |
| 58 // Update the layout | 58 // Update the layout |
| 59 alignment_delegate->OnDisplayWorkAreaInsetsChanged(); | 59 alignment_delegate->UpdateWorkArea(); |
| 60 } | 60 } |
| 61 | 61 |
| 62 void SetAlignmentDelegate( | 62 void SetAlignmentDelegate( |
| 63 std::unique_ptr<AshPopupAlignmentDelegate> delegate) { | 63 std::unique_ptr<AshPopupAlignmentDelegate> delegate) { |
| 64 if (!delegate.get()) { | 64 if (!delegate.get()) { |
| 65 alignment_delegate_.reset(); | 65 alignment_delegate_.reset(); |
| 66 return; | 66 return; |
| 67 } | 67 } |
| 68 alignment_delegate_ = std::move(delegate); | 68 alignment_delegate_ = std::move(delegate); |
| 69 UpdateWorkArea(alignment_delegate_.get(), | 69 UpdateWorkArea(alignment_delegate_.get(), |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 shelf->SetKeyboardBoundsForTesting(keyboard_bounds); | 307 shelf->SetKeyboardBoundsForTesting(keyboard_bounds); |
| 308 int keyboard_baseline = alignment_delegate()->GetBaseLine(); | 308 int keyboard_baseline = alignment_delegate()->GetBaseLine(); |
| 309 EXPECT_NE(baseline, keyboard_baseline); | 309 EXPECT_NE(baseline, keyboard_baseline); |
| 310 EXPECT_GT(keyboard_bounds.y(), keyboard_baseline); | 310 EXPECT_GT(keyboard_bounds.y(), keyboard_baseline); |
| 311 | 311 |
| 312 shelf->SetKeyboardBoundsForTesting(gfx::Rect()); | 312 shelf->SetKeyboardBoundsForTesting(gfx::Rect()); |
| 313 EXPECT_EQ(baseline, alignment_delegate()->GetBaseLine()); | 313 EXPECT_EQ(baseline, alignment_delegate()->GetBaseLine()); |
| 314 } | 314 } |
| 315 | 315 |
| 316 } // namespace ash | 316 } // namespace ash |
| OLD | NEW |