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

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

Issue 1130033003: Make the minimize state work when creating a chrome window in CrOS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add widget->Show(), widget->Minimize() calls Created 5 years, 5 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
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 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 void NativeWidgetAura::ShowMaximizedWithBounds( 470 void NativeWidgetAura::ShowMaximizedWithBounds(
471 const gfx::Rect& restored_bounds) { 471 const gfx::Rect& restored_bounds) {
472 SetRestoreBounds(window_, restored_bounds); 472 SetRestoreBounds(window_, restored_bounds);
473 ShowWithWindowState(ui::SHOW_STATE_MAXIMIZED); 473 ShowWithWindowState(ui::SHOW_STATE_MAXIMIZED);
474 } 474 }
475 475
476 void NativeWidgetAura::ShowWithWindowState(ui::WindowShowState state) { 476 void NativeWidgetAura::ShowWithWindowState(ui::WindowShowState state) {
477 if (!window_) 477 if (!window_)
478 return; 478 return;
479 479
480 if (state == ui::SHOW_STATE_MAXIMIZED || state == ui::SHOW_STATE_FULLSCREEN) 480 window_->SetProperty(aura::client::kShowStateKey, state);
481 window_->SetProperty(aura::client::kShowStateKey, state);
482 window_->Show(); 481 window_->Show();
483 if (delegate_->CanActivate()) { 482 if (delegate_->CanActivate()) {
484 if (state != ui::SHOW_STATE_INACTIVE) 483 if (state != ui::SHOW_STATE_INACTIVE)
485 Activate(); 484 Activate();
486 // SetInitialFocus() should be always be called, even for 485 // SetInitialFocus() should be always be called, even for
487 // SHOW_STATE_INACTIVE. If the window has to stay inactive, the method will 486 // SHOW_STATE_INACTIVE. If the window has to stay inactive, the method will
488 // do the right thing. 487 // do the right thing.
489 SetInitialFocus(state); 488 SetInitialFocus(state);
490 } 489 }
490
491 // On desktop aura, a window is activated first even when it is shown as
492 // minimized. Do the same for consistency.
493 if (state == ui::SHOW_STATE_MINIMIZED)
494 Minimize();
491 } 495 }
492 496
493 bool NativeWidgetAura::IsVisible() const { 497 bool NativeWidgetAura::IsVisible() const {
494 return window_ && window_->IsVisible(); 498 return window_ && window_->IsVisible();
495 } 499 }
496 500
497 void NativeWidgetAura::Activate() { 501 void NativeWidgetAura::Activate() {
498 if (!window_) 502 if (!window_)
499 return; 503 return;
500 504
(...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after
1191 l10n_util::AdjustUIFont(&(ncm.lfCaptionFont)); 1195 l10n_util::AdjustUIFont(&(ncm.lfCaptionFont));
1192 base::win::ScopedHFONT caption_font(CreateFontIndirect(&(ncm.lfCaptionFont))); 1196 base::win::ScopedHFONT caption_font(CreateFontIndirect(&(ncm.lfCaptionFont)));
1193 return gfx::FontList(gfx::Font(caption_font)); 1197 return gfx::FontList(gfx::Font(caption_font));
1194 #else 1198 #else
1195 return gfx::FontList(); 1199 return gfx::FontList();
1196 #endif 1200 #endif
1197 } 1201 }
1198 1202
1199 } // namespace internal 1203 } // namespace internal
1200 } // namespace views 1204 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698