1// Copyright 2014 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "ui/views/test/test_views_delegate.h"
6
7#include "ui/views/widget/native_widget_mac.h"
8
9namespace views {
10
11TestViewsDelegate::TestViewsDelegate() = default;
12
13TestViewsDelegate::~TestViewsDelegate() = default;
14
15void TestViewsDelegate::OnBeforeWidgetInit(
16    Widget::InitParams* params,
17    internal::NativeWidgetDelegate* delegate) {
18  if (params->opacity == Widget::InitParams::WindowOpacity::kInferred) {
19    params->opacity = use_transparent_windows_
20                          ? Widget::InitParams::WindowOpacity::kTranslucent
21                          : Widget::InitParams::WindowOpacity::kOpaque;
22  }
23  // TODO(tapted): This should return a *Desktop*NativeWidgetMac.
24  if (!params->native_widget && use_desktop_native_widgets_)
25    params->native_widget = new NativeWidgetMac(delegate);
26}
27
28ui::ContextFactory* TestViewsDelegate::GetContextFactory() {
29  return context_factory_;
30}
31
32}  // namespace views
33