OLD | NEW |
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 Loading... |
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 ShowWithWindowState(ui::SHOW_STATE_NORMAL); | 466 if (IsMaximized()) |
| 467 ShowWithWindowState(ui::SHOW_STATE_MAXIMIZED); |
| 468 else if (IsFullscreen()) |
| 469 ShowWithWindowState(ui::SHOW_STATE_FULLSCREEN); |
| 470 else if (IsMinimized()) |
| 471 ShowWithWindowState(ui::SHOW_STATE_MINIMIZED); |
| 472 else |
| 473 ShowWithWindowState(ui::SHOW_STATE_NORMAL); |
467 } | 474 } |
468 | 475 |
469 void NativeWidgetAura::Hide() { | 476 void NativeWidgetAura::Hide() { |
470 if (window_) | 477 if (window_) |
471 window_->Hide(); | 478 window_->Hide(); |
472 } | 479 } |
473 | 480 |
474 void NativeWidgetAura::ShowMaximizedWithBounds( | 481 void NativeWidgetAura::ShowMaximizedWithBounds( |
475 const gfx::Rect& restored_bounds) { | 482 const gfx::Rect& restored_bounds) { |
476 SetRestoreBounds(window_, restored_bounds); | 483 SetRestoreBounds(window_, restored_bounds); |
477 ShowWithWindowState(ui::SHOW_STATE_MAXIMIZED); | 484 ShowWithWindowState(ui::SHOW_STATE_MAXIMIZED); |
478 } | 485 } |
479 | 486 |
480 void NativeWidgetAura::ShowWithWindowState(ui::WindowShowState state) { | 487 void NativeWidgetAura::ShowWithWindowState(ui::WindowShowState state) { |
481 if (!window_) | 488 if (!window_) |
482 return; | 489 return; |
| 490 if (state == ui::SHOW_STATE_DEFAULT) |
| 491 state = ui::SHOW_STATE_NORMAL; |
| 492 if (state != ui::SHOW_STATE_MINIMIZED) |
| 493 window_->SetProperty(aura::client::kShowStateKey, state); |
483 | 494 |
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(); | 495 window_->Show(); |
489 if (delegate_->CanActivate()) { | 496 if (delegate_->CanActivate()) { |
490 if (state != ui::SHOW_STATE_INACTIVE) | 497 if (state != ui::SHOW_STATE_INACTIVE) |
491 Activate(); | 498 Activate(); |
492 // SetInitialFocus() should be always be called, even for | 499 // SetInitialFocus() should be always be called, even for |
493 // SHOW_STATE_INACTIVE. If the window has to stay inactive, the method will | 500 // SHOW_STATE_INACTIVE. If the window has to stay inactive, the method will |
494 // do the right thing. | 501 // do the right thing. |
495 SetInitialFocus(state); | 502 SetInitialFocus(state); |
496 } | 503 } |
497 | 504 |
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1168 l10n_util::AdjustUIFont(&(ncm.lfCaptionFont)); | 1175 l10n_util::AdjustUIFont(&(ncm.lfCaptionFont)); |
1169 base::win::ScopedHFONT caption_font(CreateFontIndirect(&(ncm.lfCaptionFont))); | 1176 base::win::ScopedHFONT caption_font(CreateFontIndirect(&(ncm.lfCaptionFont))); |
1170 return gfx::FontList(gfx::Font(caption_font)); | 1177 return gfx::FontList(gfx::Font(caption_font)); |
1171 #else | 1178 #else |
1172 return gfx::FontList(); | 1179 return gfx::FontList(); |
1173 #endif | 1180 #endif |
1174 } | 1181 } |
1175 | 1182 |
1176 } // namespace internal | 1183 } // namespace internal |
1177 } // namespace views | 1184 } // namespace views |
OLD | NEW |