blob: 5db7533ea9f4ad713d2d5046acd7a9dfd37fb8f6 [file] [log] [blame]
// Copyright 2020 The Chromium Authors. All rights reserved.
// 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),
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