Add new certificateProvider extension API.
[chromium-blink-merge.git] / chrome / browser / extensions / api / tabs / app_base_window.cc
blobcb89db4cb6128d9fdcb5df5383e7e80a1c9b7210
1 // Copyright 2015 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 "chrome/browser/extensions/api/tabs/app_base_window.h"
6 #include "extensions/browser/app_window/app_window.h"
7 #include "extensions/browser/app_window/native_app_window.h"
8 #include "extensions/browser/app_window/size_constraints.h"
10 namespace extensions {
12 AppBaseWindow::AppBaseWindow(AppWindow* app_window) : app_window_(app_window) {}
14 AppBaseWindow::~AppBaseWindow() {}
16 bool AppBaseWindow::IsActive() const {
17 return GetBaseWindow()->IsActive();
20 bool AppBaseWindow::IsMaximized() const {
21 return GetBaseWindow()->IsMaximized();
24 bool AppBaseWindow::IsMinimized() const {
25 return GetBaseWindow()->IsMinimized();
28 bool AppBaseWindow::IsFullscreen() const {
29 return GetBaseWindow()->IsFullscreen();
32 gfx::NativeWindow AppBaseWindow::GetNativeWindow() const {
33 return GetBaseWindow()->GetNativeWindow();
36 gfx::Rect AppBaseWindow::GetRestoredBounds() const {
37 return GetBaseWindow()->GetRestoredBounds();
40 ui::WindowShowState AppBaseWindow::GetRestoredState() const {
41 return GetBaseWindow()->GetRestoredState();
44 gfx::Rect AppBaseWindow::GetBounds() const {
45 return GetBaseWindow()->GetBounds();
48 void AppBaseWindow::Show() {
49 GetBaseWindow()->Show();
52 void AppBaseWindow::Hide() {
53 GetBaseWindow()->Hide();
56 void AppBaseWindow::ShowInactive() {
57 GetBaseWindow()->ShowInactive();
60 void AppBaseWindow::Close() {
61 GetBaseWindow()->Close();
64 void AppBaseWindow::Activate() {
65 GetBaseWindow()->Activate();
68 void AppBaseWindow::Deactivate() {
69 GetBaseWindow()->Deactivate();
72 void AppBaseWindow::Maximize() {
73 GetBaseWindow()->Maximize();
76 void AppBaseWindow::Minimize() {
77 GetBaseWindow()->Minimize();
80 void AppBaseWindow::Restore() {
81 GetBaseWindow()->Restore();
84 void AppBaseWindow::SetBounds(const gfx::Rect& bounds) {
85 // We constrain the given size to the min/max sizes of the
86 // application window.
87 gfx::Rect original_window_bounds = GetBaseWindow()->GetBounds();
88 gfx::Insets frame_insets = GetBaseWindow()->GetFrameInsets();
89 SizeConstraints constraints(
90 SizeConstraints::AddFrameToConstraints(
91 GetBaseWindow()->GetContentMinimumSize(), frame_insets),
92 SizeConstraints::AddFrameToConstraints(
93 GetBaseWindow()->GetContentMaximumSize(), frame_insets));
95 gfx::Rect new_bounds = bounds;
96 new_bounds.set_size(constraints.ClampSize(bounds.size()));
98 GetBaseWindow()->SetBounds(new_bounds);
101 void AppBaseWindow::FlashFrame(bool flash) {
102 GetBaseWindow()->FlashFrame(flash);
105 bool AppBaseWindow::IsAlwaysOnTop() const {
106 return GetBaseWindow()->IsAlwaysOnTop();
109 void AppBaseWindow::SetAlwaysOnTop(bool always_on_top) {
110 GetBaseWindow()->SetAlwaysOnTop(always_on_top);
113 NativeAppWindow* AppBaseWindow::GetBaseWindow() const {
114 return app_window_->GetBaseWindow();
117 } // namespace extensions