blob: d5ae5906c443c5e3f0768bba3fdf2bcf0385459f [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,
Toshiki Kikuchibfd314bb2023-04-20 03:52:1423 default_scale_cancellation,
24 /*supports_floated_state=*/false),
Toshiki Kikuchi87e95102020-07-09 03:32:5825 manager_(manager) {
Toshiki Kikuchi87e95102020-07-09 03:32:5826 SetActivatable(false);
27 DisableMovement();
28 host_window()->SetName("ExoToastSurface");
29}
30
31ToastSurface::~ToastSurface() {
32 if (added_to_manager_)
33 manager_->RemoveSurface(this);
34}
35
36void ToastSurface::OnSurfaceCommit() {
37 ClientControlledShellSurface::OnSurfaceCommit();
38
39 if (!added_to_manager_) {
40 added_to_manager_ = true;
41 manager_->AddSurface(this);
42 }
43}
44
45} // namespace exo