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.
5 #include "extensions/shell/browser/shell_native_app_window.h"
7 #include "extensions/shell/browser/desktop_controller.h"
8 #include "third_party/skia/include/core/SkRegion.h"
9 #include "ui/gfx/geometry/insets.h"
10 #include "ui/gfx/geometry/point.h"
11 #include "ui/gfx/geometry/rect.h"
12 #include "ui/gfx/geometry/size.h"
14 namespace extensions
{
16 ShellNativeAppWindow::ShellNativeAppWindow(
17 AppWindow
* app_window
,
18 const AppWindow::CreateParams
& params
)
19 : app_window_(app_window
) {
22 ShellNativeAppWindow::~ShellNativeAppWindow() {
25 bool ShellNativeAppWindow::IsMaximized() const {
29 bool ShellNativeAppWindow::IsMinimized() const {
33 bool ShellNativeAppWindow::IsFullscreen() const {
34 // The window in app_shell is considered a "restored" window that happens to
35 // fill the display. This avoids special handling of fullscreen or maximized
36 // windows that app_shell doesn't need.
40 gfx::Rect
ShellNativeAppWindow::GetRestoredBounds() const {
41 // app_shell windows cannot be maximized, so the current bounds are the
46 ui::WindowShowState
ShellNativeAppWindow::GetRestoredState() const {
47 return ui::SHOW_STATE_NORMAL
;
50 void ShellNativeAppWindow::ShowInactive() {
54 void ShellNativeAppWindow::Close() {
55 DesktopController::instance()->RemoveAppWindow(app_window_
);
56 app_window_
->OnNativeClose();
59 void ShellNativeAppWindow::Maximize() {
63 void ShellNativeAppWindow::Minimize() {
67 void ShellNativeAppWindow::Restore() {
71 void ShellNativeAppWindow::FlashFrame(bool flash
) {
75 bool ShellNativeAppWindow::IsAlwaysOnTop() const {
79 void ShellNativeAppWindow::SetAlwaysOnTop(bool always_on_top
) {
83 gfx::NativeView
ShellNativeAppWindow::GetHostView() const {
88 gfx::Point
ShellNativeAppWindow::GetDialogPosition(const gfx::Size
& size
) {
93 void ShellNativeAppWindow::AddObserver(
94 web_modal::ModalDialogHostObserver
* observer
) {
98 void ShellNativeAppWindow::RemoveObserver(
99 web_modal::ModalDialogHostObserver
* observer
) {
103 gfx::Size
ShellNativeAppWindow::GetMaximumDialogSize() {
108 void ShellNativeAppWindow::SetFullscreen(int fullscreen_types
) {
112 bool ShellNativeAppWindow::IsFullscreenOrPending() const {
113 // See comment in IsFullscreen().
117 void ShellNativeAppWindow::UpdateWindowIcon() {
118 // No icon to update.
121 void ShellNativeAppWindow::UpdateWindowTitle() {
122 // No window title to update.
125 void ShellNativeAppWindow::UpdateDraggableRegions(
126 const std::vector
<DraggableRegion
>& regions
) {
130 SkRegion
* ShellNativeAppWindow::GetDraggableRegion() {
135 void ShellNativeAppWindow::UpdateShape(scoped_ptr
<SkRegion
> region
) {
139 void ShellNativeAppWindow::SetInterceptAllKeys(bool want_all_keys
) {
143 void ShellNativeAppWindow::HandleKeyboardEvent(
144 const content::NativeWebKeyboardEvent
& event
) {
145 // No special handling. The WebContents will handle it.
148 bool ShellNativeAppWindow::IsFrameless() const {
153 bool ShellNativeAppWindow::HasFrameColor() const {
157 SkColor
ShellNativeAppWindow::ActiveFrameColor() const {
161 SkColor
ShellNativeAppWindow::InactiveFrameColor() const {
165 gfx::Insets
ShellNativeAppWindow::GetFrameInsets() const {
166 return gfx::Insets();
169 void ShellNativeAppWindow::ShowWithApp() {
173 void ShellNativeAppWindow::HideWithApp() {
177 void ShellNativeAppWindow::UpdateShelfMenu() {
178 // app_shell has no shelf, dock, or system-tray to update.
181 gfx::Size
ShellNativeAppWindow::GetContentMinimumSize() const {
182 // Content fills the desktop and cannot be resized.
183 return DesktopController::instance()->GetWindowSize();
186 gfx::Size
ShellNativeAppWindow::GetContentMaximumSize() const {
187 // Content fills the desktop and cannot be resized.
188 return DesktopController::instance()->GetWindowSize();
191 void ShellNativeAppWindow::SetContentSizeConstraints(
192 const gfx::Size
& min_size
,
193 const gfx::Size
& max_size
) {
197 void ShellNativeAppWindow::SetVisibleOnAllWorkspaces(bool always_visible
) {
201 bool ShellNativeAppWindow::CanHaveAlphaEnabled() const {
202 // No background to display if the window was transparent.
206 } // namespace extensions