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/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "base/logging.h" | 8 #include "base/logging.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 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 } | 341 } |
342 native_widget_->InitNativeWidget(params); | 342 native_widget_->InitNativeWidget(params); |
343 if (RequiresNonClientView(params.type)) { | 343 if (RequiresNonClientView(params.type)) { |
344 non_client_view_ = new NonClientView; | 344 non_client_view_ = new NonClientView; |
345 non_client_view_->SetFrameView(CreateNonClientFrameView()); | 345 non_client_view_->SetFrameView(CreateNonClientFrameView()); |
346 // Create the ClientView, add it to the NonClientView and add the | 346 // Create the ClientView, add it to the NonClientView and add the |
347 // NonClientView to the RootView. This will cause everything to be parented. | 347 // NonClientView to the RootView. This will cause everything to be parented. |
348 non_client_view_->set_client_view(widget_delegate_->CreateClientView(this)); | 348 non_client_view_->set_client_view(widget_delegate_->CreateClientView(this)); |
349 non_client_view_->SetOverlayView(widget_delegate_->CreateOverlayView()); | 349 non_client_view_->SetOverlayView(widget_delegate_->CreateOverlayView()); |
350 SetContentsView(non_client_view_); | 350 SetContentsView(non_client_view_); |
| 351 // Initialize the window's title before setting the window's initial bounds; |
| 352 // the frame view's preferred height may depend on the presence of a title. |
| 353 UpdateWindowTitle(); |
351 SetInitialBounds(params.bounds); | 354 SetInitialBounds(params.bounds); |
352 if (params.show_state == ui::SHOW_STATE_MAXIMIZED) | 355 if (params.show_state == ui::SHOW_STATE_MAXIMIZED) |
353 Maximize(); | 356 Maximize(); |
354 else if (params.show_state == ui::SHOW_STATE_MINIMIZED) | 357 else if (params.show_state == ui::SHOW_STATE_MINIMIZED) |
355 Minimize(); | 358 Minimize(); |
356 UpdateWindowTitle(); | |
357 } else if (params.delegate) { | 359 } else if (params.delegate) { |
358 SetContentsView(params.delegate->GetContentsView()); | 360 SetContentsView(params.delegate->GetContentsView()); |
359 SetInitialBoundsForFramelessWindow(params.bounds); | 361 SetInitialBoundsForFramelessWindow(params.bounds); |
360 } | 362 } |
361 native_widget_initialized_ = true; | 363 native_widget_initialized_ = true; |
362 } | 364 } |
363 | 365 |
364 // Unconverted methods (see header) -------------------------------------------- | 366 // Unconverted methods (see header) -------------------------------------------- |
365 | 367 |
366 gfx::NativeView Widget::GetNativeView() const { | 368 gfx::NativeView Widget::GetNativeView() const { |
(...skipping 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1399 | 1401 |
1400 //////////////////////////////////////////////////////////////////////////////// | 1402 //////////////////////////////////////////////////////////////////////////////// |
1401 // internal::NativeWidgetPrivate, NativeWidget implementation: | 1403 // internal::NativeWidgetPrivate, NativeWidget implementation: |
1402 | 1404 |
1403 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { | 1405 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { |
1404 return this; | 1406 return this; |
1405 } | 1407 } |
1406 | 1408 |
1407 } // namespace internal | 1409 } // namespace internal |
1408 } // namespace views | 1410 } // namespace views |
OLD | NEW |