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
ash / fast_ink / view_tree_host_widget.cc [blame]
// 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 "ash/fast_ink/view_tree_host_widget.h"
#include "ash/fast_ink/view_tree_host_root_view.h"
#include "ui/compositor/layer_type.h"
namespace ash {
namespace {
class ViewTreeHostWidget : public views::Widget {
public:
ViewTreeHostWidget() = default;
~ViewTreeHostWidget() override = default;
ViewTreeHostWidget(const ViewTreeHostWidget&) = delete;
ViewTreeHostWidget& operator=(const ViewTreeHostWidget&) = delete;
// views::Widget:
views::internal::RootView* CreateRootView() override {
return new ViewTreeHostRootView(this);
}
void SchedulePaintInRect(const gfx::Rect& rect) override {
static_cast<ViewTreeHostRootView*>(GetRootView())
->SchedulePaintInRect(rect);
}
};
} // namespace
views::Widget* CreateViewTreeHostWidget(views::Widget::InitParams params) {
views::Widget* widget = new ViewTreeHostWidget();
params.layer_type = ui::LAYER_SOLID_COLOR;
params.opacity = views::Widget::InitParams::WindowOpacity::kTranslucent;
// ViewTreeHostWidget shouldn't use shadow.
params.shadow_type = views::Widget::InitParams::ShadowType::kNone;
widget->Init(std::move(params));
return widget;
}
} // namespace ash