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

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

Issue 8574049: [Aura] Fix HtmlDialogBrowserTest.SizeWindow. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix aura bots Created 9 years, 1 month 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "views/widget/native_widget_aura.h" 5 #include "views/widget/native_widget_aura.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "ui/aura/client/aura_constants.h" 8 #include "ui/aura/client/aura_constants.h"
9 #include "ui/aura/desktop.h" 9 #include "ui/aura/desktop.h"
10 #include "ui/aura/desktop_observer.h" 10 #include "ui/aura/desktop_observer.h"
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 window_->SetType(GetAuraWindowTypeForWidgetType(window_type)); 126 window_->SetType(GetAuraWindowTypeForWidgetType(window_type));
127 window_->SetIntProperty(aura::kShowStateKey, ui::SHOW_STATE_NORMAL); 127 window_->SetIntProperty(aura::kShowStateKey, ui::SHOW_STATE_NORMAL);
128 window_->Init(params.create_texture_for_layer ? 128 window_->Init(params.create_texture_for_layer ?
129 ui::Layer::LAYER_HAS_TEXTURE : 129 ui::Layer::LAYER_HAS_TEXTURE :
130 ui::Layer::LAYER_HAS_NO_TEXTURE); 130 ui::Layer::LAYER_HAS_NO_TEXTURE);
131 if (window_type == Widget::InitParams::TYPE_CONTROL) 131 if (window_type == Widget::InitParams::TYPE_CONTROL)
132 window_->Show(); 132 window_->Show();
133 133
134 window_->layer()->SetFillsBoundsOpaquely(!params.transparent); 134 window_->layer()->SetFillsBoundsOpaquely(!params.transparent);
135 delegate_->OnNativeWidgetCreated(); 135 delegate_->OnNativeWidgetCreated();
136 window_->set_minimum_size(delegate_->GetMinimumSize());
137 window_->SetBounds(params.bounds); 136 window_->SetBounds(params.bounds);
138 if (window_type == Widget::InitParams::TYPE_CONTROL) { 137 if (window_type == Widget::InitParams::TYPE_CONTROL) {
139 window_->SetParent(params.GetParent()); 138 window_->SetParent(params.GetParent());
140 } else { 139 } else {
141 // Set up the transient child before the window is added. This way the 140 // Set up the transient child before the window is added. This way the
142 // LayoutManager knows the window has a transient parent. 141 // LayoutManager knows the window has a transient parent.
143 gfx::NativeView parent = params.GetParent(); 142 gfx::NativeView parent = params.GetParent();
144 if (parent) 143 if (parent)
145 parent->AddTransientChild(window_); 144 parent->AddTransientChild(window_);
146 // SetAlwaysOnTop before SetParent so that always-on-top container is used. 145 // SetAlwaysOnTop before SetParent so that always-on-top container is used.
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 void NativeWidgetAura::CenterWindow(const gfx::Size& size) { 273 void NativeWidgetAura::CenterWindow(const gfx::Size& size) {
275 const gfx::Rect parent_bounds = window_->parent()->bounds(); 274 const gfx::Rect parent_bounds = window_->parent()->bounds();
276 window_->SetBounds(gfx::Rect((parent_bounds.width() - size.width())/2, 275 window_->SetBounds(gfx::Rect((parent_bounds.width() - size.width())/2,
277 (parent_bounds.height() - size.height())/2, 276 (parent_bounds.height() - size.height())/2,
278 size.width(), 277 size.width(),
279 size.height())); 278 size.height()));
280 } 279 }
281 280
282 void NativeWidgetAura::GetWindowPlacement( 281 void NativeWidgetAura::GetWindowPlacement(
283 gfx::Rect* bounds, 282 gfx::Rect* bounds,
284 ui::WindowShowState* maximized) const { 283 ui::WindowShowState* show_state) const {
285 *maximized = static_cast<ui::WindowShowState>( 284 *bounds = window_->GetTargetBounds();
285 *show_state = static_cast<ui::WindowShowState>(
286 window_->GetIntProperty(aura::kShowStateKey)); 286 window_->GetIntProperty(aura::kShowStateKey));
287 } 287 }
288 288
289 void NativeWidgetAura::SetWindowTitle(const string16& title) { 289 void NativeWidgetAura::SetWindowTitle(const string16& title) {
290 window_->set_title(title); 290 window_->set_title(title);
291 } 291 }
292 292
293 void NativeWidgetAura::SetWindowIcons(const SkBitmap& window_icon, 293 void NativeWidgetAura::SetWindowIcons(const SkBitmap& window_icon,
294 const SkBitmap& app_icon) { 294 const SkBitmap& app_icon) {
295 // Aura doesn't have window icons. 295 // Aura doesn't have window icons.
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 void NativeWidgetAura::DispatchKeyEventPostIME(const KeyEvent& key) { 520 void NativeWidgetAura::DispatchKeyEventPostIME(const KeyEvent& key) {
521 if (delegate_->OnKeyEvent(key)) 521 if (delegate_->OnKeyEvent(key))
522 return; 522 return;
523 if (key.type() == ui::ET_KEY_PRESSED && GetWidget()->GetFocusManager()) 523 if (key.type() == ui::ET_KEY_PRESSED && GetWidget()->GetFocusManager())
524 GetWidget()->GetFocusManager()->OnKeyEvent(key); 524 GetWidget()->GetFocusManager()->OnKeyEvent(key);
525 } 525 }
526 526
527 //////////////////////////////////////////////////////////////////////////////// 527 ////////////////////////////////////////////////////////////////////////////////
528 // NativeWidgetAura, aura::WindowDelegate implementation: 528 // NativeWidgetAura, aura::WindowDelegate implementation:
529 529
530 void NativeWidgetAura::OnBoundsChanging(gfx::Rect* new_bounds) {
531 // Enforces a minimum size.
532 const gfx::Size& min_size = delegate_->GetMinimumSize();
533 new_bounds->set_width(std::max(min_size.width(), new_bounds->width()));
534 new_bounds->set_height(std::max(min_size.height(), new_bounds->height()));
535 }
536
530 void NativeWidgetAura::OnBoundsChanged(const gfx::Rect& old_bounds, 537 void NativeWidgetAura::OnBoundsChanged(const gfx::Rect& old_bounds,
531 const gfx::Rect& new_bounds) { 538 const gfx::Rect& new_bounds) {
532 if (old_bounds.origin() != new_bounds.origin()) 539 if (old_bounds.origin() != new_bounds.origin())
533 GetWidget()->widget_delegate()->OnWidgetMove(); 540 GetWidget()->widget_delegate()->OnWidgetMove();
534 if (old_bounds.size() != new_bounds.size()) 541 if (old_bounds.size() != new_bounds.size())
535 delegate_->OnNativeWidgetSizeChanged(new_bounds.size()); 542 delegate_->OnNativeWidgetSizeChanged(new_bounds.size());
536 } 543 }
537 544
538 void NativeWidgetAura::OnFocus() { 545 void NativeWidgetAura::OnFocus() {
539 Widget* widget = GetWidget(); 546 Widget* widget = GetWidget();
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 NOTIMPLEMENTED(); 736 NOTIMPLEMENTED();
730 } 737 }
731 738
732 // static 739 // static
733 bool NativeWidgetPrivate::IsMouseButtonDown() { 740 bool NativeWidgetPrivate::IsMouseButtonDown() {
734 return aura::Desktop::GetInstance()->IsMouseButtonDown(); 741 return aura::Desktop::GetInstance()->IsMouseButtonDown();
735 } 742 }
736 743
737 } // namespace internal 744 } // namespace internal
738 } // namespace views 745 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698