| 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/public/cpp/ash_typography.h" | 7 #include "ash/public/cpp/ash_typography.h" |
| 8 #include "ash/public/cpp/shell_window_ids.h" | 8 #include "ash/public/cpp/shell_window_ids.h" |
| 9 #include "ash/root_window_controller.h" | 9 #include "ash/root_window_controller.h" |
| 10 #include "ash/shelf/shelf.h" | 10 #include "ash/shelf/shelf.h" |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 views::Widget::InitParams params; | 208 views::Widget::InitParams params; |
| 209 params.type = views::Widget::InitParams::TYPE_POPUP; | 209 params.type = views::Widget::InitParams::TYPE_POPUP; |
| 210 params.name = "ToastOverlay"; | 210 params.name = "ToastOverlay"; |
| 211 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; | 211 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; |
| 212 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; | 212 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
| 213 params.accept_events = true; | 213 params.accept_events = true; |
| 214 params.keep_on_top = true; | 214 params.keep_on_top = true; |
| 215 params.remove_standard_frame = true; | 215 params.remove_standard_frame = true; |
| 216 params.bounds = CalculateOverlayBounds(); | 216 params.bounds = CalculateOverlayBounds(); |
| 217 // Show toasts above the app list and below the lock screen. | 217 // Show toasts above the app list and below the lock screen. |
| 218 GetRootWindowController(Shell::GetRootWindowForNewWindows()) | 218 RootWindowController::ForWindow(Shell::GetRootWindowForNewWindows()) |
| 219 ->ConfigureWidgetInitParamsForContainer( | 219 ->ConfigureWidgetInitParamsForContainer( |
| 220 overlay_widget_.get(), kShellWindowId_SystemModalContainer, ¶ms); | 220 overlay_widget_.get(), kShellWindowId_SystemModalContainer, ¶ms); |
| 221 overlay_widget_->Init(params); | 221 overlay_widget_->Init(params); |
| 222 overlay_widget_->SetVisibilityChangedAnimationsEnabled(true); | 222 overlay_widget_->SetVisibilityChangedAnimationsEnabled(true); |
| 223 overlay_widget_->SetContentsView(overlay_view_.get()); | 223 overlay_widget_->SetContentsView(overlay_view_.get()); |
| 224 overlay_widget_->SetBounds(CalculateOverlayBounds()); | 224 overlay_widget_->SetBounds(CalculateOverlayBounds()); |
| 225 | 225 |
| 226 aura::Window* overlay_window = overlay_widget_->GetNativeWindow(); | 226 aura::Window* overlay_window = overlay_widget_->GetNativeWindow(); |
| 227 ::wm::SetWindowVisibilityAnimationType( | 227 ::wm::SetWindowVisibilityAnimationType( |
| 228 overlay_window, ::wm::WINDOW_VISIBILITY_ANIMATION_TYPE_VERTICAL); | 228 overlay_window, ::wm::WINDOW_VISIBILITY_ANIMATION_TYPE_VERTICAL); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 ToastOverlayButton* ToastOverlay::dismiss_button_for_testing() { | 289 ToastOverlayButton* ToastOverlay::dismiss_button_for_testing() { |
| 290 return overlay_view_->button(); | 290 return overlay_view_->button(); |
| 291 } | 291 } |
| 292 | 292 |
| 293 void ToastOverlay::ClickDismissButtonForTesting(const ui::Event& event) { | 293 void ToastOverlay::ClickDismissButtonForTesting(const ui::Event& event) { |
| 294 DCHECK(overlay_view_->button()); | 294 DCHECK(overlay_view_->button()); |
| 295 overlay_view_->button()->NotifyClick(event); | 295 overlay_view_->button()->NotifyClick(event); |
| 296 } | 296 } |
| 297 | 297 |
| 298 } // namespace ash | 298 } // namespace ash |
| OLD | NEW |