blob: d984c00494ce9b512c74dd42b5bf36c3066e1f23 [file] [log] [blame]
Avi Drissman8ba1bad2022-09-13 19:22:361// Copyright 2020 The Chromium Authors
Toshiki Kikuchi87e95102020-07-09 03:32:582// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "components/exo/toast_surface.h"
6
7#include "ash/public/cpp/shell_window_ids.h"
8#include "components/exo/toast_surface_manager.h"
9#include "components/exo/wm_helper.h"
10#include "ui/base/class_property.h"
11#include "ui/gfx/geometry/dip_util.h"
12#include "ui/gfx/geometry/rect.h"
13#include "ui/views/accessibility/view_accessibility.h"
14
15namespace exo {
16
17ToastSurface::ToastSurface(ToastSurfaceManager* manager,
18 Surface* surface,
Prabir Pradhan875083e2020-07-22 20:06:2719 bool default_scale_cancellation)
Toshiki Kikuchi87e95102020-07-09 03:32:5820 : ClientControlledShellSurface(surface,
21 false /* can_minimize */,
Prabir Pradhan875083e2020-07-22 20:06:2722 ash::kShellWindowId_OverlayContainer,
23 default_scale_cancellation),
Toshiki Kikuchi87e95102020-07-09 03:32:5824 manager_(manager) {
Toshiki Kikuchi87e95102020-07-09 03:32:5825 SetActivatable(false);
26 DisableMovement();
27 host_window()->SetName("ExoToastSurface");
28}
29
30ToastSurface::~ToastSurface() {
31 if (added_to_manager_)
32 manager_->RemoveSurface(this);
33}
34
35void ToastSurface::OnSurfaceCommit() {
36 ClientControlledShellSurface::OnSurfaceCommit();
37
38 if (!added_to_manager_) {
39 added_to_manager_ = true;
40 manager_->AddSurface(this);
41 }
42}
43
44} // namespace exo