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

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

Issue 1489843003: [WIP: Not for review] Simplify and unify widget/window show logic Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 (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/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "third_party/skia/include/core/SkRegion.h" 9 #include "third_party/skia/include/core/SkRegion.h"
10 #include "ui/aura/client/aura_constants.h" 10 #include "ui/aura/client/aura_constants.h"
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 base::Bind(&NativeWidgetAura::CloseNow, 456 base::Bind(&NativeWidgetAura::CloseNow,
457 close_widget_factory_.GetWeakPtr())); 457 close_widget_factory_.GetWeakPtr()));
458 } 458 }
459 } 459 }
460 460
461 void NativeWidgetAura::CloseNow() { 461 void NativeWidgetAura::CloseNow() {
462 delete window_; 462 delete window_;
463 } 463 }
464 464
465 void NativeWidgetAura::Show() { 465 void NativeWidgetAura::Show() {
466 /*
467 if (IsMaximized())
468 ShowWithWindowState(ui::SHOW_STATE_MAXIMIZED);
469 else if (IsFullscreen())
470 ShowWithWindowState(ui::SHOW_STATE_FULLSCREEN);
471 else if (IsMinimized())
472 ShowWithWindowState(ui::SHOW_STATE_MINIMIZED);
473 else
474 */
oshima 2015/12/01 23:00:05 This is alternative way to show the window with th
466 ShowWithWindowState(ui::SHOW_STATE_NORMAL); 475 ShowWithWindowState(ui::SHOW_STATE_NORMAL);
467 } 476 }
468 477
469 void NativeWidgetAura::Hide() { 478 void NativeWidgetAura::Hide() {
470 if (window_) 479 if (window_)
471 window_->Hide(); 480 window_->Hide();
472 } 481 }
473 482
474 void NativeWidgetAura::ShowMaximizedWithBounds( 483 void NativeWidgetAura::ShowMaximizedWithBounds(
475 const gfx::Rect& restored_bounds) { 484 const gfx::Rect& restored_bounds) {
476 SetRestoreBounds(window_, restored_bounds); 485 SetRestoreBounds(window_, restored_bounds);
477 ShowWithWindowState(ui::SHOW_STATE_MAXIMIZED); 486 ShowWithWindowState(ui::SHOW_STATE_MAXIMIZED);
478 } 487 }
479 488
480 void NativeWidgetAura::ShowWithWindowState(ui::WindowShowState state) { 489 void NativeWidgetAura::ShowWithWindowState(ui::WindowShowState state) {
481 if (!window_) 490 if (!window_)
482 return; 491 return;
492 if (state == ui::SHOW_STATE_DEFAULT)
493 state = ui::SHOW_STATE_NORMAL;
494 if (state != ui::SHOW_STATE_MINIMIZED)
495 window_->SetProperty(aura::client::kShowStateKey, state);
483 496
484 if (state == ui::SHOW_STATE_MAXIMIZED || state == ui::SHOW_STATE_FULLSCREEN ||
485 state == ui::SHOW_STATE_DOCKED) {
486 window_->SetProperty(aura::client::kShowStateKey, state);
487 }
488 window_->Show(); 497 window_->Show();
489 if (delegate_->CanActivate()) { 498 if (delegate_->CanActivate()) {
490 if (state != ui::SHOW_STATE_INACTIVE) 499 if (state != ui::SHOW_STATE_INACTIVE)
491 Activate(); 500 Activate();
492 // SetInitialFocus() should be always be called, even for 501 // SetInitialFocus() should be always be called, even for
493 // SHOW_STATE_INACTIVE. If the window has to stay inactive, the method will 502 // SHOW_STATE_INACTIVE. If the window has to stay inactive, the method will
494 // do the right thing. 503 // do the right thing.
495 SetInitialFocus(state); 504 SetInitialFocus(state);
496 } 505 }
497 506
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after
1168 l10n_util::AdjustUIFont(&(ncm.lfCaptionFont)); 1177 l10n_util::AdjustUIFont(&(ncm.lfCaptionFont));
1169 base::win::ScopedHFONT caption_font(CreateFontIndirect(&(ncm.lfCaptionFont))); 1178 base::win::ScopedHFONT caption_font(CreateFontIndirect(&(ncm.lfCaptionFont)));
1170 return gfx::FontList(gfx::Font(caption_font)); 1179 return gfx::FontList(gfx::Font(caption_font));
1171 #else 1180 #else
1172 return gfx::FontList(); 1181 return gfx::FontList();
1173 #endif 1182 #endif
1174 } 1183 }
1175 1184
1176 } // namespace internal 1185 } // namespace internal
1177 } // namespace views 1186 } // namespace views
OLDNEW
« no previous file with comments | « ui/aura/window_tracker.cc ('k') | ui/views/widget/widget.h » ('j') | ui/views/widget/widget.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698