summaryrefslogtreecommitdiffstats
path: root/ui/views/test/test_views_delegate.cc
blob: 2b562f478651038ca544c735afbc6ea18eba6e12 (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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
// Copyright (c) 2012 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 "ui/views/test/test_views_delegate.h"

#include "base/logging.h"
#include "ui/base/clipboard/clipboard.h"

#if defined(USE_AURA)
#include "ui/views/widget/desktop_native_widget_helper_aura.h"
#endif

namespace views {

TestViewsDelegate::TestViewsDelegate()
    : use_transparent_windows_(false) {
  DCHECK(!ViewsDelegate::views_delegate);
  ViewsDelegate::views_delegate = this;
}

TestViewsDelegate::~TestViewsDelegate() {
  ViewsDelegate::views_delegate = NULL;
}

void TestViewsDelegate::SetUseTransparentWindows(bool transparent) {
  use_transparent_windows_ = transparent;
}

ui::Clipboard* TestViewsDelegate::GetClipboard() const {
  if (!clipboard_.get()) {
    // Note that we need a MessageLoop for the next call to work.
    clipboard_.reset(new ui::Clipboard);
  }
  return clipboard_.get();
}

void TestViewsDelegate::SaveWindowPlacement(const Widget* window,
                                            const std::string& window_name,
                                            const gfx::Rect& bounds,
                                            ui::WindowShowState show_state) {
}

bool TestViewsDelegate::GetSavedWindowPlacement(
    const std::string& window_name,
    gfx::Rect* bounds,
    ui:: WindowShowState* show_state) const {
  return false;
}

NonClientFrameView* TestViewsDelegate::CreateDefaultNonClientFrameView(
    Widget* widget) {
  return NULL;
}

bool TestViewsDelegate::UseTransparentWindows() const {
  return use_transparent_windows_;
}

int TestViewsDelegate::GetDispositionForEvent(int event_flags) {
  return 0;
}

#if defined(USE_AURA)
views::NativeWidgetHelperAura* TestViewsDelegate::CreateNativeWidgetHelper(
    views::NativeWidgetAura* native_widget) {
  return new views::DesktopNativeWidgetHelperAura(native_widget);
}
#endif

}  // namespace views