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

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

Issue 330873003: Fix first time switching from classic to GTK theme. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: better way Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 ownership_ = params.ownership; 349 ownership_ = params.ownership;
350 native_widget_ = CreateNativeWidget(params.native_widget, this)-> 350 native_widget_ = CreateNativeWidget(params.native_widget, this)->
351 AsNativeWidgetPrivate(); 351 AsNativeWidgetPrivate();
352 root_view_.reset(CreateRootView()); 352 root_view_.reset(CreateRootView());
353 default_theme_provider_.reset(new ui::DefaultThemeProvider); 353 default_theme_provider_.reset(new ui::DefaultThemeProvider);
354 if (params.type == InitParams::TYPE_MENU) { 354 if (params.type == InitParams::TYPE_MENU) {
355 is_mouse_button_pressed_ = 355 is_mouse_button_pressed_ =
356 internal::NativeWidgetPrivate::IsMouseButtonDown(); 356 internal::NativeWidgetPrivate::IsMouseButtonDown();
357 } 357 }
358 native_widget_->InitNativeWidget(params); 358 native_widget_->InitNativeWidget(params);
359 observer_manager_.Add(GetNativeTheme());
360 if (RequiresNonClientView(params.type)) { 359 if (RequiresNonClientView(params.type)) {
361 non_client_view_ = new NonClientView; 360 non_client_view_ = new NonClientView;
362 non_client_view_->SetFrameView(CreateNonClientFrameView()); 361 non_client_view_->SetFrameView(CreateNonClientFrameView());
363 // Create the ClientView, add it to the NonClientView and add the 362 // Create the ClientView, add it to the NonClientView and add the
364 // NonClientView to the RootView. This will cause everything to be parented. 363 // NonClientView to the RootView. This will cause everything to be parented.
365 non_client_view_->set_client_view(widget_delegate_->CreateClientView(this)); 364 non_client_view_->set_client_view(widget_delegate_->CreateClientView(this));
366 non_client_view_->SetOverlayView(widget_delegate_->CreateOverlayView()); 365 non_client_view_->SetOverlayView(widget_delegate_->CreateOverlayView());
367 SetContentsView(non_client_view_); 366 SetContentsView(non_client_view_);
368 // Initialize the window's title before setting the window's initial bounds; 367 // Initialize the window's title before setting the window's initial bounds;
369 // the frame view's preferred height may depend on the presence of a title. 368 // the frame view's preferred height may depend on the presence of a title.
370 UpdateWindowTitle(); 369 UpdateWindowTitle();
371 non_client_view_->ResetWindowControls(); 370 non_client_view_->ResetWindowControls();
372 SetInitialBounds(params.bounds); 371 SetInitialBounds(params.bounds);
373 if (params.show_state == ui::SHOW_STATE_MAXIMIZED) 372 if (params.show_state == ui::SHOW_STATE_MAXIMIZED)
374 Maximize(); 373 Maximize();
375 else if (params.show_state == ui::SHOW_STATE_MINIMIZED) 374 else if (params.show_state == ui::SHOW_STATE_MINIMIZED)
376 Minimize(); 375 Minimize();
377 } else if (params.delegate) { 376 } else if (params.delegate) {
378 SetContentsView(params.delegate->GetContentsView()); 377 SetContentsView(params.delegate->GetContentsView());
379 SetInitialBoundsForFramelessWindow(params.bounds); 378 SetInitialBoundsForFramelessWindow(params.bounds);
380 } 379 }
380 // This must come after SetContentsView(). See http://crbug.com/375545
sky 2014/06/18 03:24:09 Document why, I shouldn't have to chase down a bug
381 observer_manager_.Add(GetNativeTheme());
381 native_widget_initialized_ = true; 382 native_widget_initialized_ = true;
382 } 383 }
383 384
384 // Unconverted methods (see header) -------------------------------------------- 385 // Unconverted methods (see header) --------------------------------------------
385 386
386 gfx::NativeView Widget::GetNativeView() const { 387 gfx::NativeView Widget::GetNativeView() const {
387 return native_widget_->GetNativeView(); 388 return native_widget_->GetNativeView();
388 } 389 }
389 390
390 gfx::NativeWindow Widget::GetNativeWindow() const { 391 gfx::NativeWindow Widget::GetNativeWindow() const {
(...skipping 1113 matching lines...) Expand 10 before | Expand all | Expand 10 after
1504 1505
1505 //////////////////////////////////////////////////////////////////////////////// 1506 ////////////////////////////////////////////////////////////////////////////////
1506 // internal::NativeWidgetPrivate, NativeWidget implementation: 1507 // internal::NativeWidgetPrivate, NativeWidget implementation:
1507 1508
1508 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { 1509 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() {
1509 return this; 1510 return this;
1510 } 1511 }
1511 1512
1512 } // namespace internal 1513 } // namespace internal
1513 } // namespace views 1514 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698