| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 enum Position { TOP_LEFT, TOP_RIGHT, BOTTOM_LEFT, BOTTOM_RIGHT, OUTSIDE }; | 50 enum Position { TOP_LEFT, TOP_RIGHT, BOTTOM_LEFT, BOTTOM_RIGHT, OUTSIDE }; |
| 51 | 51 |
| 52 AshPopupAlignmentDelegate* alignment_delegate() { | 52 AshPopupAlignmentDelegate* alignment_delegate() { |
| 53 return alignment_delegate_.get(); | 53 return alignment_delegate_.get(); |
| 54 } | 54 } |
| 55 | 55 |
| 56 void UpdateWorkArea(AshPopupAlignmentDelegate* alignment_delegate, | 56 void UpdateWorkArea(AshPopupAlignmentDelegate* alignment_delegate, |
| 57 const display::Display& display) { | 57 const display::Display& display) { |
| 58 alignment_delegate->StartObserving(display::Screen::GetScreen(), display); | 58 alignment_delegate->StartObserving(display::Screen::GetScreen(), display); |
| 59 // Update the layout | 59 // Update the layout |
| 60 alignment_delegate->OnDisplayWorkAreaInsetsChanged(); | 60 alignment_delegate->UpdateWorkArea(); |
| 61 } | 61 } |
| 62 | 62 |
| 63 void SetAlignmentDelegate( | 63 void SetAlignmentDelegate( |
| 64 std::unique_ptr<AshPopupAlignmentDelegate> delegate) { | 64 std::unique_ptr<AshPopupAlignmentDelegate> delegate) { |
| 65 if (!delegate.get()) { | 65 if (!delegate.get()) { |
| 66 alignment_delegate_.reset(); | 66 alignment_delegate_.reset(); |
| 67 return; | 67 return; |
| 68 } | 68 } |
| 69 alignment_delegate_ = std::move(delegate); | 69 alignment_delegate_ = std::move(delegate); |
| 70 UpdateWorkArea(alignment_delegate_.get(), | 70 UpdateWorkArea(alignment_delegate_.get(), |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 shelf->SetKeyboardBoundsForTesting(keyboard_bounds); | 323 shelf->SetKeyboardBoundsForTesting(keyboard_bounds); |
| 324 int keyboard_baseline = alignment_delegate()->GetBaseLine(); | 324 int keyboard_baseline = alignment_delegate()->GetBaseLine(); |
| 325 EXPECT_NE(baseline, keyboard_baseline); | 325 EXPECT_NE(baseline, keyboard_baseline); |
| 326 EXPECT_GT(keyboard_bounds.y(), keyboard_baseline); | 326 EXPECT_GT(keyboard_bounds.y(), keyboard_baseline); |
| 327 | 327 |
| 328 shelf->SetKeyboardBoundsForTesting(gfx::Rect()); | 328 shelf->SetKeyboardBoundsForTesting(gfx::Rect()); |
| 329 EXPECT_EQ(baseline, alignment_delegate()->GetBaseLine()); | 329 EXPECT_EQ(baseline, alignment_delegate()->GetBaseLine()); |
| 330 } | 330 } |
| 331 | 331 |
| 332 } // namespace ash | 332 } // namespace ash |
| OLD | NEW |