Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(41)

Unified Diff: ash/wm/window_state.cc

Issue 42353002: Introduce WindowStateDelegate::ToggleFullscreen (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: exclude accelerator_commands_browsertest on win Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/wm/window_state.h ('k') | ash/wm/window_state_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/window_state.cc
diff --git a/ash/wm/window_state.cc b/ash/wm/window_state.cc
index d037a76c5588ed9b09530a388f4e63a7ea32c376..16da9a7ed0bff21012b37a1067eafe35d3e896fd 100644
--- a/ash/wm/window_state.cc
+++ b/ash/wm/window_state.cc
@@ -8,6 +8,7 @@
#include "ash/screen_ash.h"
#include "ash/shell_window_ids.h"
#include "ash/wm/window_properties.h"
+#include "ash/wm/window_state_delegate.h"
#include "ash/wm/window_state_observer.h"
#include "ash/wm/window_util.h"
#include "ash/wm/wm_types.h"
@@ -39,6 +40,7 @@ WindowState::WindowState(aura::Window* window)
window_resizer_(NULL),
always_restores_to_restore_bounds_(false),
hide_shelf_when_fullscreen_(true),
+ animate_to_fullscreen_(true),
window_show_type_(ToWindowShowType(GetShowState())) {
window_->AddObserver(this);
}
@@ -46,6 +48,11 @@ WindowState::WindowState(aura::Window* window)
WindowState::~WindowState() {
}
+void WindowState::SetDelegate(scoped_ptr<WindowStateDelegate> delegate) {
+ DCHECK(!delegate_.get());
+ delegate_ = delegate.Pass();
+}
+
ui::WindowShowState WindowState::GetShowState() const {
return window_->GetProperty(aura::client::kShowStateKey);
}
@@ -156,6 +163,22 @@ void WindowState::ToggleMaximized() {
Maximize();
}
+void WindowState::ToggleFullscreen() {
+ // Window which cannot be maximized should not be fullscreened.
+ // It can, however, be restored if it was fullscreened.
+ bool is_fullscreen = IsFullscreen();
+ if (!is_fullscreen && !CanMaximize())
+ return;
+ if (delegate_ && delegate_->ToggleFullscreen(this))
+ return;
+ if (is_fullscreen) {
+ Restore();
+ } else {
+ window_->SetProperty(aura::client::kShowStateKey,
+ ui::SHOW_STATE_FULLSCREEN);
+ }
+}
+
void WindowState::SetBoundsInScreen(
const gfx::Rect& bounds_in_screen) {
gfx::Rect bounds_in_parent =
« no previous file with comments | « ash/wm/window_state.h ('k') | ash/wm/window_state_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698