Chromium Code Reviews| 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/widget.h" | 5 #include "ui/views/widget/widget.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 348 SetContentsView(non_client_view_); | 348 SetContentsView(non_client_view_); |
| 349 // Initialize the window's icon and title before setting the window's | 349 // Initialize the window's icon and title before setting the window's |
| 350 // initial bounds; the frame view's preferred height may depend on the | 350 // initial bounds; the frame view's preferred height may depend on the |
| 351 // presence of an icon or a title. | 351 // presence of an icon or a title. |
| 352 UpdateWindowIcon(); | 352 UpdateWindowIcon(); |
| 353 UpdateWindowTitle(); | 353 UpdateWindowTitle(); |
| 354 non_client_view_->ResetWindowControls(); | 354 non_client_view_->ResetWindowControls(); |
| 355 SetInitialBounds(params.bounds); | 355 SetInitialBounds(params.bounds); |
| 356 if (params.show_state == ui::SHOW_STATE_MAXIMIZED) | 356 if (params.show_state == ui::SHOW_STATE_MAXIMIZED) |
| 357 Maximize(); | 357 Maximize(); |
| 358 else if (params.show_state == ui::SHOW_STATE_MINIMIZED) | 358 else if (params.show_state == ui::SHOW_STATE_MINIMIZED) { |
| 359 Minimize(); | 359 Minimize(); |
| 360 saved_show_state_ = ui::SHOW_STATE_MINIMIZED; | |
| 361 } | |
| 360 } else if (params.delegate) { | 362 } else if (params.delegate) { |
| 361 SetContentsView(params.delegate->GetContentsView()); | 363 SetContentsView(params.delegate->GetContentsView()); |
| 362 SetInitialBoundsForFramelessWindow(params.bounds); | 364 SetInitialBoundsForFramelessWindow(params.bounds); |
| 363 } | 365 } |
| 364 // This must come after SetContentsView() or it might not be able to find | 366 // This must come after SetContentsView() or it might not be able to find |
| 365 // the correct NativeTheme (on Linux). See http://crbug.com/384492 | 367 // the correct NativeTheme (on Linux). See http://crbug.com/384492 |
| 366 observer_manager_.Add(GetNativeTheme()); | 368 observer_manager_.Add(GetNativeTheme()); |
| 367 native_widget_initialized_ = true; | 369 native_widget_initialized_ = true; |
| 368 native_widget_->OnWidgetInitDone(); | 370 native_widget_->OnWidgetInitDone(); |
| 369 } | 371 } |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 599 layer ? layer->name() : "none"); | 601 layer ? layer->name() : "none"); |
| 600 if (non_client_view_) { | 602 if (non_client_view_) { |
| 601 // While initializing, the kiosk mode will go to full screen before the | 603 // While initializing, the kiosk mode will go to full screen before the |
| 602 // widget gets shown. In that case we stay in full screen mode, regardless | 604 // widget gets shown. In that case we stay in full screen mode, regardless |
| 603 // of the |saved_show_state_| member. | 605 // of the |saved_show_state_| member. |
| 604 if (saved_show_state_ == ui::SHOW_STATE_MAXIMIZED && | 606 if (saved_show_state_ == ui::SHOW_STATE_MAXIMIZED && |
| 605 !initial_restored_bounds_.IsEmpty() && | 607 !initial_restored_bounds_.IsEmpty() && |
| 606 !IsFullscreen()) { | 608 !IsFullscreen()) { |
| 607 native_widget_->ShowMaximizedWithBounds(initial_restored_bounds_); | 609 native_widget_->ShowMaximizedWithBounds(initial_restored_bounds_); |
| 608 } else { | 610 } else { |
| 609 ui::WindowShowState show_state = | 611 native_widget_->ShowWithWindowState( |
| 610 IsFullscreen() ? ui::SHOW_STATE_FULLSCREEN : | 612 IsFullscreen() ? ui::SHOW_STATE_FULLSCREEN : saved_show_state_); |
|
varkha
2016/04/22 19:06:41
This reverts part of the change from the breaking
| |
| 611 IsMinimized() ? ui::SHOW_STATE_MINIMIZED : saved_show_state_; | |
| 612 native_widget_->ShowWithWindowState(show_state); | |
| 613 } | 613 } |
| 614 // |saved_show_state_| only applies the first time the window is shown. | 614 // |saved_show_state_| only applies the first time the window is shown. |
| 615 // If we don't reset the value the window may be shown maximized every time | 615 // If we don't reset the value the window may be shown maximized every time |
| 616 // it is subsequently shown after being hidden. | 616 // it is subsequently shown after being hidden. |
| 617 saved_show_state_ = ui::SHOW_STATE_NORMAL; | 617 saved_show_state_ = ui::SHOW_STATE_NORMAL; |
| 618 } else { | 618 } else { |
| 619 CanActivate() | 619 CanActivate() |
| 620 ? native_widget_->Show() | 620 ? native_widget_->Show() |
| 621 : native_widget_->ShowWithWindowState(ui::SHOW_STATE_INACTIVE); | 621 : native_widget_->ShowWithWindowState(ui::SHOW_STATE_INACTIVE); |
| 622 } | 622 } |
| (...skipping 855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1478 | 1478 |
| 1479 //////////////////////////////////////////////////////////////////////////////// | 1479 //////////////////////////////////////////////////////////////////////////////// |
| 1480 // internal::NativeWidgetPrivate, NativeWidget implementation: | 1480 // internal::NativeWidgetPrivate, NativeWidget implementation: |
| 1481 | 1481 |
| 1482 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { | 1482 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { |
| 1483 return this; | 1483 return this; |
| 1484 } | 1484 } |
| 1485 | 1485 |
| 1486 } // namespace internal | 1486 } // namespace internal |
| 1487 } // namespace views | 1487 } // namespace views |
| OLD | NEW |