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 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 void NativeWidgetAura::ShowMaximizedWithBounds( | 474 void NativeWidgetAura::ShowMaximizedWithBounds( |
475 const gfx::Rect& restored_bounds) { | 475 const gfx::Rect& restored_bounds) { |
476 SetRestoreBounds(window_, restored_bounds); | 476 SetRestoreBounds(window_, restored_bounds); |
477 ShowWithWindowState(ui::SHOW_STATE_MAXIMIZED); | 477 ShowWithWindowState(ui::SHOW_STATE_MAXIMIZED); |
478 } | 478 } |
479 | 479 |
480 void NativeWidgetAura::ShowWithWindowState(ui::WindowShowState state) { | 480 void NativeWidgetAura::ShowWithWindowState(ui::WindowShowState state) { |
481 if (!window_) | 481 if (!window_) |
482 return; | 482 return; |
483 | 483 |
484 if (state == ui::SHOW_STATE_MAXIMIZED || state == ui::SHOW_STATE_FULLSCREEN || | 484 window_->SetProperty(aura::client::kShowStateKey, state); |
485 state == ui::SHOW_STATE_DOCKED) { | |
486 window_->SetProperty(aura::client::kShowStateKey, state); | |
487 } | |
488 window_->Show(); | 485 window_->Show(); |
489 if (delegate_->CanActivate()) { | 486 if (delegate_->CanActivate()) { |
490 if (state != ui::SHOW_STATE_INACTIVE) | 487 if (state != ui::SHOW_STATE_INACTIVE) |
491 Activate(); | 488 Activate(); |
492 // SetInitialFocus() should be always be called, even for | 489 // SetInitialFocus() should be always be called, even for |
493 // SHOW_STATE_INACTIVE. If the window has to stay inactive, the method will | 490 // SHOW_STATE_INACTIVE. If the window has to stay inactive, the method will |
494 // do the right thing. | 491 // do the right thing. |
495 SetInitialFocus(state); | 492 SetInitialFocus(state); |
496 } | 493 } |
| 494 |
| 495 // On desktop aura, a window is activated first even when it is shown as |
| 496 // minimized. Do the same for consistency. |
| 497 if (state == ui::SHOW_STATE_MINIMIZED) |
| 498 Minimize(); |
497 } | 499 } |
498 | 500 |
499 bool NativeWidgetAura::IsVisible() const { | 501 bool NativeWidgetAura::IsVisible() const { |
500 return window_ && window_->IsVisible(); | 502 return window_ && window_->IsVisible(); |
501 } | 503 } |
502 | 504 |
503 void NativeWidgetAura::Activate() { | 505 void NativeWidgetAura::Activate() { |
504 if (!window_) | 506 if (!window_) |
505 return; | 507 return; |
506 | 508 |
(...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1163 l10n_util::AdjustUIFont(&(ncm.lfCaptionFont)); | 1165 l10n_util::AdjustUIFont(&(ncm.lfCaptionFont)); |
1164 base::win::ScopedHFONT caption_font(CreateFontIndirect(&(ncm.lfCaptionFont))); | 1166 base::win::ScopedHFONT caption_font(CreateFontIndirect(&(ncm.lfCaptionFont))); |
1165 return gfx::FontList(gfx::Font(caption_font)); | 1167 return gfx::FontList(gfx::Font(caption_font)); |
1166 #else | 1168 #else |
1167 return gfx::FontList(); | 1169 return gfx::FontList(); |
1168 #endif | 1170 #endif |
1169 } | 1171 } |
1170 | 1172 |
1171 } // namespace internal | 1173 } // namespace internal |
1172 } // namespace views | 1174 } // namespace views |
OLD | NEW |