| OLD | NEW |
| 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 #include "ash/system/toast/toast_overlay.h" | 5 #include "ash/system/toast/toast_overlay.h" |
| 6 | 6 |
| 7 #include "ash/screen_util.h" | 7 #include "ash/screen_util.h" |
| 8 #include "ash/shelf/shelf.h" | 8 #include "ash/shelf/shelf.h" |
| 9 #include "ash/shelf/shelf_layout_manager.h" | 9 #include "ash/shelf/shelf_layout_manager.h" |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 params.parent = Shell::GetContainer(Shell::GetTargetRootWindow(), | 182 params.parent = Shell::GetContainer(Shell::GetTargetRootWindow(), |
| 183 kShellWindowId_SystemModalContainer); | 183 kShellWindowId_SystemModalContainer); |
| 184 overlay_widget_.reset(new views::Widget); | 184 overlay_widget_.reset(new views::Widget); |
| 185 overlay_widget_->Init(params); | 185 overlay_widget_->Init(params); |
| 186 overlay_widget_->SetVisibilityChangedAnimationsEnabled(true); | 186 overlay_widget_->SetVisibilityChangedAnimationsEnabled(true); |
| 187 overlay_widget_->SetContentsView(overlay_view_.get()); | 187 overlay_widget_->SetContentsView(overlay_view_.get()); |
| 188 overlay_widget_->SetBounds(CalculateOverlayBounds()); | 188 overlay_widget_->SetBounds(CalculateOverlayBounds()); |
| 189 overlay_widget_->GetNativeView()->SetName("ToastOverlay"); | 189 overlay_widget_->GetNativeView()->SetName("ToastOverlay"); |
| 190 | 190 |
| 191 gfx::NativeWindow native_view = overlay_widget_->GetNativeView(); | 191 gfx::NativeWindow native_view = overlay_widget_->GetNativeView(); |
| 192 wm::SetWindowVisibilityAnimationType( | 192 ::wm::SetWindowVisibilityAnimationType( |
| 193 native_view, wm::WINDOW_VISIBILITY_ANIMATION_TYPE_VERTICAL); | 193 native_view, ::wm::WINDOW_VISIBILITY_ANIMATION_TYPE_VERTICAL); |
| 194 wm::SetWindowVisibilityAnimationDuration( | 194 ::wm::SetWindowVisibilityAnimationDuration( |
| 195 native_view, | 195 native_view, |
| 196 base::TimeDelta::FromMilliseconds(kSlideAnimationDurationMs)); | 196 base::TimeDelta::FromMilliseconds(kSlideAnimationDurationMs)); |
| 197 } | 197 } |
| 198 | 198 |
| 199 ToastOverlay::~ToastOverlay() { | 199 ToastOverlay::~ToastOverlay() { |
| 200 overlay_widget_->Close(); | 200 overlay_widget_->Close(); |
| 201 } | 201 } |
| 202 | 202 |
| 203 void ToastOverlay::Show(bool visible) { | 203 void ToastOverlay::Show(bool visible) { |
| 204 if (overlay_widget_->GetLayer()->GetTargetVisibility() == visible) | 204 if (overlay_widget_->GetLayer()->GetTargetVisibility() == visible) |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 | 242 |
| 243 views::Widget* ToastOverlay::widget_for_testing() { | 243 views::Widget* ToastOverlay::widget_for_testing() { |
| 244 return overlay_widget_.get(); | 244 return overlay_widget_.get(); |
| 245 } | 245 } |
| 246 | 246 |
| 247 void ToastOverlay::ClickDismissButtonForTesting(const ui::Event& event) { | 247 void ToastOverlay::ClickDismissButtonForTesting(const ui::Event& event) { |
| 248 overlay_view_->button()->NotifyClick(event); | 248 overlay_view_->button()->NotifyClick(event); |
| 249 } | 249 } |
| 250 | 250 |
| 251 } // namespace ash | 251 } // namespace ash |
| OLD | NEW |