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 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
477 void NativeWidgetAura::ShowMaximizedWithBounds( | 477 void NativeWidgetAura::ShowMaximizedWithBounds( |
478 const gfx::Rect& restored_bounds) { | 478 const gfx::Rect& restored_bounds) { |
479 SetRestoreBounds(window_, restored_bounds); | 479 SetRestoreBounds(window_, restored_bounds); |
480 ShowWithWindowState(ui::SHOW_STATE_MAXIMIZED); | 480 ShowWithWindowState(ui::SHOW_STATE_MAXIMIZED); |
481 } | 481 } |
482 | 482 |
483 void NativeWidgetAura::ShowWithWindowState(ui::WindowShowState state) { | 483 void NativeWidgetAura::ShowWithWindowState(ui::WindowShowState state) { |
484 if (!window_) | 484 if (!window_) |
485 return; | 485 return; |
486 | 486 |
487 if (state == ui::SHOW_STATE_MAXIMIZED || state == ui::SHOW_STATE_FULLSCREEN) | 487 switch (state) { |
488 window_->SetProperty(aura::client::kShowStateKey, state); | 488 case ui::SHOW_STATE_NORMAL: |
489 Restore(); | |
490 break; | |
491 case ui::SHOW_STATE_MAXIMIZED: | |
492 Maximize(); | |
493 break; | |
494 case ui::SHOW_STATE_MINIMIZED: | |
495 Minimize(); | |
496 return; | |
497 case ui::SHOW_STATE_FULLSCREEN: | |
498 SetFullscreen(true); | |
499 break; | |
500 default: | |
501 break; | |
502 } | |
503 | |
sadrul
2015/05/15 20:30:54
Looks like you can just do window_->SetProperty()
oshima
2015/05/15 20:45:52
Yes, that should be sufficient. One caveat: IIRC,
| |
489 window_->Show(); | 504 window_->Show(); |
490 if (delegate_->CanActivate()) { | 505 if (delegate_->CanActivate()) { |
491 if (state != ui::SHOW_STATE_INACTIVE) | 506 if (state != ui::SHOW_STATE_INACTIVE) |
492 Activate(); | 507 Activate(); |
493 // SetInitialFocus() should be always be called, even for | 508 // SetInitialFocus() should be always be called, even for |
494 // SHOW_STATE_INACTIVE. If the window has to stay inactive, the method will | 509 // SHOW_STATE_INACTIVE. If the window has to stay inactive, the method will |
495 // do the right thing. | 510 // do the right thing. |
496 SetInitialFocus(state); | 511 SetInitialFocus(state); |
497 } | 512 } |
498 } | 513 } |
(...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1205 l10n_util::AdjustUIFont(&(ncm.lfCaptionFont)); | 1220 l10n_util::AdjustUIFont(&(ncm.lfCaptionFont)); |
1206 base::win::ScopedHFONT caption_font(CreateFontIndirect(&(ncm.lfCaptionFont))); | 1221 base::win::ScopedHFONT caption_font(CreateFontIndirect(&(ncm.lfCaptionFont))); |
1207 return gfx::FontList(gfx::Font(caption_font)); | 1222 return gfx::FontList(gfx::Font(caption_font)); |
1208 #else | 1223 #else |
1209 return gfx::FontList(); | 1224 return gfx::FontList(); |
1210 #endif | 1225 #endif |
1211 } | 1226 } |
1212 | 1227 |
1213 } // namespace internal | 1228 } // namespace internal |
1214 } // namespace views | 1229 } // namespace views |
OLD | NEW |