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