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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
|
// Copyright (c) 2011 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.
#ifndef VIEWS_WIDGET_NATIVE_WIDGET_AURA_H_
#define VIEWS_WIDGET_NATIVE_WIDGET_AURA_H_
#pragma once
#include <map>
#include "ui/aura/window_delegate.h"
#include "views/views_export.h"
#include "views/widget/native_widget_private.h"
namespace aura {
class Window;
}
namespace gfx {
class Font;
}
namespace views {
class VIEWS_EXPORT NativeWidgetAura : public internal::NativeWidgetPrivate,
public aura::WindowDelegate {
public:
explicit NativeWidgetAura(internal::NativeWidgetDelegate* delegate);
virtual ~NativeWidgetAura();
// TODO(beng): Find a better place for this, and the similar method on
// NativeWidgetWin.
static gfx::Font GetWindowTitleFont();
// Overridden from internal::NativeWidgetPrivate:
virtual void InitNativeWidget(const Widget::InitParams& params) OVERRIDE;
virtual NonClientFrameView* CreateNonClientFrameView() OVERRIDE;
virtual void UpdateFrameAfterFrameChange() OVERRIDE;
virtual bool ShouldUseNativeFrame() const OVERRIDE;
virtual void FrameTypeChanged() OVERRIDE;
virtual Widget* GetWidget() OVERRIDE;
virtual const Widget* GetWidget() const OVERRIDE;
virtual gfx::NativeView GetNativeView() const OVERRIDE;
virtual gfx::NativeWindow GetNativeWindow() const OVERRIDE;
virtual Widget* GetTopLevelWidget() OVERRIDE;
virtual const ui::Compositor* GetCompositor() const OVERRIDE;
virtual ui::Compositor* GetCompositor() OVERRIDE;
virtual void CalculateOffsetToAncestorWithLayer(
gfx::Point* offset,
ui::Layer** layer_parent) OVERRIDE;
virtual void ViewRemoved(View* view) OVERRIDE;
virtual void SetNativeWindowProperty(const char* name, void* value) OVERRIDE;
virtual void* GetNativeWindowProperty(const char* name) const OVERRIDE;
virtual TooltipManager* GetTooltipManager() const OVERRIDE;
virtual bool IsScreenReaderActive() const OVERRIDE;
virtual void SendNativeAccessibilityEvent(
View* view,
ui::AccessibilityTypes::Event event_type) OVERRIDE;
virtual void SetMouseCapture() OVERRIDE;
virtual void ReleaseMouseCapture() OVERRIDE;
virtual bool HasMouseCapture() const OVERRIDE;
virtual InputMethod* CreateInputMethod() OVERRIDE;
virtual void CenterWindow(const gfx::Size& size) OVERRIDE;
virtual void GetWindowPlacement(
gfx::Rect* bounds,
ui::WindowShowState* maximized) const OVERRIDE;
virtual void SetWindowTitle(const string16& title) OVERRIDE;
virtual void SetWindowIcons(const SkBitmap& window_icon,
const SkBitmap& app_icon) OVERRIDE;
virtual void SetAccessibleName(const string16& name) OVERRIDE;
virtual void SetAccessibleRole(ui::AccessibilityTypes::Role role) OVERRIDE;
virtual void SetAccessibleState(ui::AccessibilityTypes::State state) OVERRIDE;
virtual void BecomeModal() OVERRIDE;
virtual gfx::Rect GetWindowScreenBounds() const OVERRIDE;
virtual gfx::Rect GetClientAreaScreenBounds() const OVERRIDE;
virtual gfx::Rect GetRestoredBounds() const OVERRIDE;
virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE;
virtual void SetSize(const gfx::Size& size) OVERRIDE;
virtual void SetBoundsConstrained(const gfx::Rect& bounds,
Widget* other_widget) OVERRIDE;
virtual void MoveAbove(gfx::NativeView native_view) OVERRIDE;
virtual void MoveToTop() OVERRIDE;
virtual void SetShape(gfx::NativeRegion shape) OVERRIDE;
virtual void Close() OVERRIDE;
virtual void CloseNow() OVERRIDE;
virtual void EnableClose(bool enable) OVERRIDE;
virtual void Show() OVERRIDE;
virtual void Hide() OVERRIDE;
virtual void ShowMaximizedWithBounds(
const gfx::Rect& restored_bounds) OVERRIDE;
virtual void ShowWithWindowState(ui::WindowShowState state) OVERRIDE;
virtual bool IsVisible() const OVERRIDE;
virtual void Activate() OVERRIDE;
virtual void Deactivate() OVERRIDE;
virtual bool IsActive() const OVERRIDE;
virtual void SetAlwaysOnTop(bool always_on_top) OVERRIDE;
virtual void Maximize() OVERRIDE;
virtual void Minimize() OVERRIDE;
virtual bool IsMaximized() const OVERRIDE;
virtual bool IsMinimized() const OVERRIDE;
virtual void Restore() OVERRIDE;
virtual void SetFullscreen(bool fullscreen) OVERRIDE;
virtual bool IsFullscreen() const OVERRIDE;
virtual void SetOpacity(unsigned char opacity) OVERRIDE;
virtual void SetUseDragFrame(bool use_drag_frame) OVERRIDE;
virtual bool IsAccessibleWidget() const OVERRIDE;
virtual void RunShellDrag(View* view,
const ui::OSExchangeData& data,
int operation) OVERRIDE;
virtual void SchedulePaintInRect(const gfx::Rect& rect) OVERRIDE;
virtual void SetCursor(gfx::NativeCursor cursor) OVERRIDE;
virtual void ClearNativeFocus() OVERRIDE;
virtual void FocusNativeView(gfx::NativeView native_view) OVERRIDE;
virtual bool ConvertPointFromAncestor(
const Widget* ancestor, gfx::Point* point) const OVERRIDE;
virtual gfx::Rect GetWorkAreaBoundsInScreen() const OVERRIDE;
// Overridden from views::InputMethodDelegate:
virtual void DispatchKeyEventPostIME(const KeyEvent& key) OVERRIDE;
// Overridden from aura::WindowDelegate:
virtual void OnBoundsChanged(const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds) OVERRIDE;
virtual void OnFocus() OVERRIDE;
virtual void OnBlur() OVERRIDE;
virtual bool OnKeyEvent(aura::KeyEvent* event) OVERRIDE;
virtual int GetNonClientComponent(const gfx::Point& point) const OVERRIDE;
virtual bool OnMouseEvent(aura::MouseEvent* event) OVERRIDE;
virtual bool ShouldActivate(aura::MouseEvent* event) OVERRIDE;
virtual void OnActivated() OVERRIDE;
virtual void OnLostActive() OVERRIDE;
virtual void OnCaptureLost() OVERRIDE;
virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
virtual void OnWindowDestroying() OVERRIDE;
virtual void OnWindowDestroyed() OVERRIDE;
private:
typedef std::map<const char*, void*> PropsMap;
internal::NativeWidgetDelegate* delegate_;
aura::Window* window_;
// See class documentation for Widget in widget.h for a note about ownership.
Widget::InitParams::Ownership ownership_;
// The following factory is used for calls to close the NativeWidgetAura
// instance.
ScopedRunnableMethodFactory<NativeWidgetAura> close_widget_factory_;
bool can_activate_;
// Map used by Set/GetNativeWindowProperty.
PropsMap props_map_;
DISALLOW_COPY_AND_ASSIGN(NativeWidgetAura);
};
} // namespace views
#endif // VIEWS_WIDGET_NATIVE_WIDGET_AURA_H_
|