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

Side by Side Diff: components/exo/shell_surface.cc

Issue 2248773002: Use MD-ash's auto hide behavior for arc++ windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/exo/shell_surface.h" 5 #include "components/exo/shell_surface.h"
6 6
7 #include "ash/aura/wm_window_aura.h" 7 #include "ash/aura/wm_window_aura.h"
8 #include "ash/common/shell_window_ids.h" 8 #include "ash/common/shell_window_ids.h"
9 #include "ash/common/wm/window_resizer.h" 9 #include "ash/common/wm/window_resizer.h"
10 #include "ash/common/wm/window_state.h" 10 #include "ash/common/wm/window_state.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 43
44 // This is a struct for accelerator keys used to close ShellSurfaces. 44 // This is a struct for accelerator keys used to close ShellSurfaces.
45 const struct Accelerator { 45 const struct Accelerator {
46 ui::KeyboardCode keycode; 46 ui::KeyboardCode keycode;
47 int modifiers; 47 int modifiers;
48 } kCloseWindowAccelerators[] = { 48 } kCloseWindowAccelerators[] = {
49 {ui::VKEY_W, ui::EF_CONTROL_DOWN}, 49 {ui::VKEY_W, ui::EF_CONTROL_DOWN},
50 {ui::VKEY_W, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN}, 50 {ui::VKEY_W, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN},
51 {ui::VKEY_F4, ui::EF_ALT_DOWN}}; 51 {ui::VKEY_F4, ui::EF_ALT_DOWN}};
52 52
53 void UpdateShelfStateForFullscreenChange(views::Widget* widget) {
54 ash::wm::WindowState* window_state =
55 ash::wm::GetWindowState(widget->GetNativeWindow());
56 // TODO(oshima): Use SHELF_AUTOHIDE_VISIBLE for SYSTEM_UI_VISIBLE case.
reveman 2016/08/15 17:28:01 nit: SHELF_AUTO_HIDE_VISIBLE
oshima 2016/08/15 17:34:34 I removed it because new MD auto hide does not hav
57 window_state->set_shelf_mode_in_fullscreen(
58 ash::wm::WindowState::SHELF_AUTO_HIDE_INVISIBLE);
59 ash::Shell::GetInstance()->UpdateShelfVisibility();
60 }
61
53 class CustomFrameView : public views::NonClientFrameView { 62 class CustomFrameView : public views::NonClientFrameView {
54 public: 63 public:
55 explicit CustomFrameView(views::Widget* widget) : widget_(widget) {} 64 explicit CustomFrameView(views::Widget* widget) : widget_(widget) {}
56 ~CustomFrameView() override {} 65 ~CustomFrameView() override {}
57 66
58 // Overridden from views::NonClientFrameView: 67 // Overridden from views::NonClientFrameView:
59 gfx::Rect GetBoundsForClientView() const override { return bounds(); } 68 gfx::Rect GetBoundsForClientView() const override { return bounds(); }
60 gfx::Rect GetWindowBoundsForClientBounds( 69 gfx::Rect GetWindowBoundsForClientBounds(
61 const gfx::Rect& client_bounds) const override { 70 const gfx::Rect& client_bounds) const override {
62 return client_bounds; 71 return client_bounds;
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 ~CustomWindowStateDelegate() override { 120 ~CustomWindowStateDelegate() override {
112 if (widget_) 121 if (widget_)
113 widget_->RemoveObserver(this); 122 widget_->RemoveObserver(this);
114 } 123 }
115 124
116 // Overridden from ash::wm::WindowStateDelegate: 125 // Overridden from ash::wm::WindowStateDelegate:
117 bool ToggleFullscreen(ash::wm::WindowState* window_state) override { 126 bool ToggleFullscreen(ash::wm::WindowState* window_state) override {
118 if (widget_) { 127 if (widget_) {
119 bool enter_fullscreen = !window_state->IsFullscreen(); 128 bool enter_fullscreen = !window_state->IsFullscreen();
120 widget_->SetFullscreen(enter_fullscreen); 129 widget_->SetFullscreen(enter_fullscreen);
130 UpdateShelfStateForFullscreenChange(widget_);
121 } 131 }
122 return true; 132 return true;
123 } 133 }
124 134
125 // Overridden from views::WidgetObserver: 135 // Overridden from views::WidgetObserver:
126 void OnWidgetDestroying(views::Widget* widget) override { 136 void OnWidgetDestroying(views::Widget* widget) override {
127 widget_->RemoveObserver(this); 137 widget_->RemoveObserver(this);
128 widget_ = nullptr; 138 widget_ = nullptr;
129 } 139 }
130 140
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 void ShellSurface::SetFullscreen(bool fullscreen) { 393 void ShellSurface::SetFullscreen(bool fullscreen) {
384 TRACE_EVENT1("exo", "ShellSurface::SetFullscreen", "fullscreen", fullscreen); 394 TRACE_EVENT1("exo", "ShellSurface::SetFullscreen", "fullscreen", fullscreen);
385 395
386 if (!widget_) 396 if (!widget_)
387 CreateShellSurfaceWidget(ui::SHOW_STATE_FULLSCREEN); 397 CreateShellSurfaceWidget(ui::SHOW_STATE_FULLSCREEN);
388 398
389 // Note: This will ask client to configure its surface even if fullscreen 399 // Note: This will ask client to configure its surface even if fullscreen
390 // state doesn't change. 400 // state doesn't change.
391 ScopedConfigure scoped_configure(this, true); 401 ScopedConfigure scoped_configure(this, true);
392 widget_->SetFullscreen(fullscreen); 402 widget_->SetFullscreen(fullscreen);
403 UpdateShelfStateForFullscreenChange(widget_);
393 } 404 }
394 405
395 void ShellSurface::SetPinned(bool pinned) { 406 void ShellSurface::SetPinned(bool pinned) {
396 TRACE_EVENT1("exo", "ShellSurface::SetPinned", "pinned", pinned); 407 TRACE_EVENT1("exo", "ShellSurface::SetPinned", "pinned", pinned);
397 408
398 if (!widget_) 409 if (!widget_)
399 CreateShellSurfaceWidget(ui::SHOW_STATE_NORMAL); 410 CreateShellSurfaceWidget(ui::SHOW_STATE_NORMAL);
400 411
401 // Note: This will ask client to configure its surface even if pinned 412 // Note: This will ask client to configure its surface even if pinned
402 // state doesn't change. 413 // state doesn't change.
(...skipping 839 matching lines...) Expand 10 before | Expand all | Expand 10 after
1242 shadow_overlay_->layer()->Add(shadow->layer()); 1253 shadow_overlay_->layer()->Add(shadow->layer());
1243 window->AddChild(shadow_overlay_); 1254 window->AddChild(shadow_overlay_);
1244 shadow_overlay_->Show(); 1255 shadow_overlay_->Show();
1245 } 1256 }
1246 shadow_overlay_->SetBounds(shadow_bounds); 1257 shadow_overlay_->SetBounds(shadow_bounds);
1247 shadow->SetContentBounds(gfx::Rect(shadow_bounds.size())); 1258 shadow->SetContentBounds(gfx::Rect(shadow_bounds.size()));
1248 } 1259 }
1249 } 1260 }
1250 1261
1251 } // namespace exo 1262 } // namespace exo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698