summaryrefslogtreecommitdiffstats
path: root/views/window/window_delegate.cc
blob: b39d5fb81b56510bbe501c38037205c304fe79fe (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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
// Copyright (c) 2006-2008 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 "views/window/window_delegate.h"
#include "views/views_delegate.h"
#include "views/window/client_view.h"
#include "views/window/window.h"
#include "third_party/skia/include/core/SkBitmap.h"

namespace views {

WindowDelegate::WindowDelegate() : window_(NULL) {
}

WindowDelegate::~WindowDelegate() {
}

DialogDelegate* WindowDelegate::AsDialogDelegate() {
  return NULL;
}

bool WindowDelegate::CanResize() const {
  return false;
}

bool WindowDelegate::CanMaximize() const {
  return false;
}

bool WindowDelegate::CanActivate() const {
  return true;
}

bool WindowDelegate::IsModal() const {
  return false;
}

ui::AccessibilityTypes::Role WindowDelegate::GetAccessibleWindowRole() const {
  return ui::AccessibilityTypes::ROLE_WINDOW;
}

ui::AccessibilityTypes::State WindowDelegate::GetAccessibleWindowState() const {
  return 0;
}

std::wstring WindowDelegate::GetAccessibleWindowTitle() const {
  return GetWindowTitle();
}

std::wstring WindowDelegate::GetWindowTitle() const {
  return L"";
}

View* WindowDelegate::GetInitiallyFocusedView() {
  return NULL;
}

bool WindowDelegate::ShouldShowWindowTitle() const {
  return true;
}

bool WindowDelegate::ShouldShowClientEdge() const {
  return true;
}

SkBitmap WindowDelegate::GetWindowAppIcon() {
  // Use the window icon as app icon by default.
  return GetWindowIcon();
}

// Returns the icon to be displayed in the window.
SkBitmap WindowDelegate::GetWindowIcon() {
  return SkBitmap();
}

bool WindowDelegate::ShouldShowWindowIcon() const {
  return false;
}

bool WindowDelegate::ExecuteWindowsCommand(int command_id) {
  return false;
}

std::wstring WindowDelegate::GetWindowName() const {
  return std::wstring();
}

void WindowDelegate::SaveWindowPlacement(const gfx::Rect& bounds,
                                         bool maximized) {
  std::wstring window_name = GetWindowName();
  if (!ViewsDelegate::views_delegate || window_name.empty())
    return;

  ViewsDelegate::views_delegate->SaveWindowPlacement(
      window_, window_name, bounds, maximized);
}

bool WindowDelegate::GetSavedWindowBounds(gfx::Rect* bounds) const {
  std::wstring window_name = GetWindowName();
  if (!ViewsDelegate::views_delegate || window_name.empty())
    return false;

  return ViewsDelegate::views_delegate->GetSavedWindowBounds(
      window_, window_name, bounds);
}

bool WindowDelegate::GetSavedMaximizedState(bool* maximized) const {
  std::wstring window_name = GetWindowName();
  if (!ViewsDelegate::views_delegate || window_name.empty())
    return false;

  return ViewsDelegate::views_delegate->GetSavedMaximizedState(
      window_, window_name, maximized);
}

bool WindowDelegate::ShouldRestoreWindowSize() const {
  return true;
}

View* WindowDelegate::GetContentsView() {
  return NULL;
}

ClientView* WindowDelegate::CreateClientView(Window* window) {
  return new ClientView(window, GetContentsView());
}

}  // namespace views