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

Side by Side Diff: ui/views/widget/native_widget_aura.cc

Issue 2700523004: Remove docked windows entirely in M59. (Closed)
Patch Set: Rebase Created 3 years, 9 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
« no previous file with comments | « ui/views/widget/native_widget_aura.h ('k') | ui/views/widget/native_widget_mac.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ui/views/widget/native_widget_aura.h" 5 #include "ui/views/widget/native_widget_aura.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 // View-to-screen coordinate system transformations depend on this returning 423 // View-to-screen coordinate system transformations depend on this returning
424 // the full window bounds, for example View::ConvertPointToScreen(). 424 // the full window bounds, for example View::ConvertPointToScreen().
425 return window_ ? window_->GetBoundsInScreen() : gfx::Rect(); 425 return window_ ? window_->GetBoundsInScreen() : gfx::Rect();
426 } 426 }
427 427
428 gfx::Rect NativeWidgetAura::GetRestoredBounds() const { 428 gfx::Rect NativeWidgetAura::GetRestoredBounds() const {
429 if (!window_) 429 if (!window_)
430 return gfx::Rect(); 430 return gfx::Rect();
431 431
432 // Restored bounds should only be relevant if the window is minimized, 432 // Restored bounds should only be relevant if the window is minimized,
433 // maximized, fullscreen or docked. However, in some places the code expects 433 // maximized, or fullscreen. However, in some places the code expects
434 // GetRestoredBounds() to return the current window bounds if the window is 434 // GetRestoredBounds() to return the current window bounds if the window is
435 // not in either state. 435 // not in either state.
436 if (IsMinimized() || IsMaximized() || IsFullscreen()) { 436 if (IsMinimized() || IsMaximized() || IsFullscreen()) {
437 // Restore bounds are in screen coordinates, no need to convert. 437 // Restore bounds are in screen coordinates, no need to convert.
438 gfx::Rect* restore_bounds = 438 gfx::Rect* restore_bounds =
439 window_->GetProperty(aura::client::kRestoreBoundsKey); 439 window_->GetProperty(aura::client::kRestoreBoundsKey);
440 if (restore_bounds) 440 if (restore_bounds)
441 return *restore_bounds; 441 return *restore_bounds;
442 } 442 }
443 gfx::Rect bounds = window_->GetBoundsInScreen(); 443 return window_->GetBoundsInScreen();
444 if (IsDocked()) {
445 // Restore bounds are in screen coordinates, no need to convert.
446 gfx::Rect* restore_bounds =
447 window_->GetProperty(aura::client::kRestoreBoundsKey);
448 // Use current window horizontal offset origin in order to preserve docked
449 // alignment but preserve restored size and vertical offset for the time
450 // when the |window_| gets undocked.
451 if (restore_bounds) {
452 bounds.set_size(restore_bounds->size());
453 bounds.set_y(restore_bounds->y());
454 }
455 }
456 return bounds;
457 } 444 }
458 445
459 std::string NativeWidgetAura::GetWorkspace() const { 446 std::string NativeWidgetAura::GetWorkspace() const {
460 return std::string(); 447 return std::string();
461 } 448 }
462 449
463 void NativeWidgetAura::SetBounds(const gfx::Rect& bounds) { 450 void NativeWidgetAura::SetBounds(const gfx::Rect& bounds) {
464 if (!window_) 451 if (!window_)
465 return; 452 return;
466 453
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 void NativeWidgetAura::ShowMaximizedWithBounds( 521 void NativeWidgetAura::ShowMaximizedWithBounds(
535 const gfx::Rect& restored_bounds) { 522 const gfx::Rect& restored_bounds) {
536 SetRestoreBounds(window_, restored_bounds); 523 SetRestoreBounds(window_, restored_bounds);
537 ShowWithWindowState(ui::SHOW_STATE_MAXIMIZED); 524 ShowWithWindowState(ui::SHOW_STATE_MAXIMIZED);
538 } 525 }
539 526
540 void NativeWidgetAura::ShowWithWindowState(ui::WindowShowState state) { 527 void NativeWidgetAura::ShowWithWindowState(ui::WindowShowState state) {
541 if (!window_) 528 if (!window_)
542 return; 529 return;
543 530
544 // TODO(afakhry): Remove Docked Windows in M58. 531 if (state == ui::SHOW_STATE_MAXIMIZED || state == ui::SHOW_STATE_FULLSCREEN)
545 if (state == ui::SHOW_STATE_MAXIMIZED || state == ui::SHOW_STATE_FULLSCREEN ||
546 state == ui::SHOW_STATE_DOCKED) {
547 window_->SetProperty(aura::client::kShowStateKey, state); 532 window_->SetProperty(aura::client::kShowStateKey, state);
548 }
549 window_->Show(); 533 window_->Show();
550 if (delegate_->CanActivate()) { 534 if (delegate_->CanActivate()) {
551 if (state != ui::SHOW_STATE_INACTIVE) 535 if (state != ui::SHOW_STATE_INACTIVE)
552 Activate(); 536 Activate();
553 // SetInitialFocus() should be always be called, even for 537 // SetInitialFocus() should be always be called, even for
554 // SHOW_STATE_INACTIVE. If the window has to stay inactive, the method will 538 // SHOW_STATE_INACTIVE. If the window has to stay inactive, the method will
555 // do the right thing. 539 // do the right thing.
556 // Activate() might fail if the window is non-activatable. In this case, we 540 // Activate() might fail if the window is non-activatable. In this case, we
557 // should pass SHOW_STATE_INACTIVE to SetInitialFocus() to stop the initial 541 // should pass SHOW_STATE_INACTIVE to SetInitialFocus() to stop the initial
558 // focused view from getting focused. See crbug.com/515594 for example. 542 // focused view from getting focused. See crbug.com/515594 for example.
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
993 destroying_ = true; 977 destroying_ = true;
994 if (ownership_ == Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET) 978 if (ownership_ == Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET)
995 delete delegate_; 979 delete delegate_;
996 else 980 else
997 CloseNow(); 981 CloseNow();
998 } 982 }
999 983
1000 //////////////////////////////////////////////////////////////////////////////// 984 ////////////////////////////////////////////////////////////////////////////////
1001 // NativeWidgetAura, private: 985 // NativeWidgetAura, private:
1002 986
1003 // TODO(afakhry): Remove Docked Windows in M58.
1004 bool NativeWidgetAura::IsDocked() const {
1005 return window_ &&
1006 window_->GetProperty(aura::client::kShowStateKey) ==
1007 ui::SHOW_STATE_DOCKED;
1008 }
1009
1010 void NativeWidgetAura::SetInitialFocus(ui::WindowShowState show_state) { 987 void NativeWidgetAura::SetInitialFocus(ui::WindowShowState show_state) {
1011 // The window does not get keyboard messages unless we focus it. 988 // The window does not get keyboard messages unless we focus it.
1012 if (!GetWidget()->SetInitialFocus(show_state)) 989 if (!GetWidget()->SetInitialFocus(show_state))
1013 window_->Focus(); 990 window_->Focus();
1014 } 991 }
1015 992
1016 //////////////////////////////////////////////////////////////////////////////// 993 ////////////////////////////////////////////////////////////////////////////////
1017 // Widget, public: 994 // Widget, public:
1018 995
1019 namespace { 996 namespace {
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
1212 gfx::NativeView native_view) { 1189 gfx::NativeView native_view) {
1213 aura::client::CaptureClient* capture_client = 1190 aura::client::CaptureClient* capture_client =
1214 aura::client::GetCaptureClient(native_view->GetRootWindow()); 1191 aura::client::GetCaptureClient(native_view->GetRootWindow());
1215 if (!capture_client) 1192 if (!capture_client)
1216 return nullptr; 1193 return nullptr;
1217 return capture_client->GetGlobalCaptureWindow(); 1194 return capture_client->GetGlobalCaptureWindow();
1218 } 1195 }
1219 1196
1220 } // namespace internal 1197 } // namespace internal
1221 } // namespace views 1198 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/widget/native_widget_aura.h ('k') | ui/views/widget/native_widget_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698