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

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

Issue 8432001: Tweaks whether Show activates the window or not. I'm pretty sure this (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
« no previous file with comments | « views/widget/native_widget_aura.h ('k') | 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) 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/desktop.h" 8 #include "ui/aura/desktop.h"
9 #include "ui/aura/event.h" 9 #include "ui/aura/event.h"
10 #include "ui/aura/window.h" 10 #include "ui/aura/window.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 window_->Init(params.create_texture_for_layer ? 79 window_->Init(params.create_texture_for_layer ?
80 ui::Layer::LAYER_HAS_TEXTURE : ui::Layer::LAYER_HAS_NO_TEXTURE); 80 ui::Layer::LAYER_HAS_TEXTURE : ui::Layer::LAYER_HAS_NO_TEXTURE);
81 // TODO(beng): respect |params| authoritah wrt transparency. 81 // TODO(beng): respect |params| authoritah wrt transparency.
82 window_->layer()->SetFillsBoundsOpaquely(false); 82 window_->layer()->SetFillsBoundsOpaquely(false);
83 delegate_->OnNativeWidgetCreated(); 83 delegate_->OnNativeWidgetCreated();
84 window_->set_minimum_size(delegate_->GetMinimumSize()); 84 window_->set_minimum_size(delegate_->GetMinimumSize());
85 window_->SetBounds(params.bounds); 85 window_->SetBounds(params.bounds);
86 if (params.type == Widget::InitParams::TYPE_CONTROL) { 86 if (params.type == Widget::InitParams::TYPE_CONTROL) {
87 window_->SetParent(params.GetParent()); 87 window_->SetParent(params.GetParent());
88 } else { 88 } else {
89 window_->SetParent(NULL);
90 gfx::NativeView parent = params.GetParent(); 89 gfx::NativeView parent = params.GetParent();
91 if (parent) 90 if (parent)
92 parent->AddTransientChild(window_); 91 parent->AddTransientChild(window_);
92 window_->SetParent(NULL);
93 } 93 }
94 // TODO(beng): do this some other way. 94 // TODO(beng): do this some other way.
95 delegate_->OnNativeWidgetSizeChanged(params.bounds.size()); 95 delegate_->OnNativeWidgetSizeChanged(params.bounds.size());
96 can_activate_ = params.can_activate; 96 can_activate_ = params.can_activate;
97 if (params.type != Widget::InitParams::TYPE_TOOLTIP && !params.child) { 97 if (params.type != Widget::InitParams::TYPE_TOOLTIP && !params.child) {
98 DCHECK(GetWidget()->GetRootView()); 98 DCHECK(GetWidget()->GetRootView());
99 views::TooltipManagerViews* manager = new views::TooltipManagerViews( 99 views::TooltipManagerViews* manager = new views::TooltipManagerViews(
100 GetWidget()->GetRootView()); 100 GetWidget()->GetRootView());
101 tooltip_manager_.reset(manager); 101 tooltip_manager_.reset(manager);
102 } 102 }
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 303
304 void NativeWidgetAura::CloseNow() { 304 void NativeWidgetAura::CloseNow() {
305 delete window_; 305 delete window_;
306 } 306 }
307 307
308 void NativeWidgetAura::EnableClose(bool enable) { 308 void NativeWidgetAura::EnableClose(bool enable) {
309 NOTIMPLEMENTED(); 309 NOTIMPLEMENTED();
310 } 310 }
311 311
312 void NativeWidgetAura::Show() { 312 void NativeWidgetAura::Show() {
313 window_->Show(); 313 ShowWithWindowState(ui::SHOW_STATE_INACTIVE);
314 } 314 }
315 315
316 void NativeWidgetAura::Hide() { 316 void NativeWidgetAura::Hide() {
317 window_->Hide(); 317 window_->Hide();
318 } 318 }
319 319
320 void NativeWidgetAura::ShowMaximizedWithBounds( 320 void NativeWidgetAura::ShowMaximizedWithBounds(
321 const gfx::Rect& restored_bounds) { 321 const gfx::Rect& restored_bounds) {
322 window_->SetBounds(restored_bounds); 322 window_->SetBounds(restored_bounds);
323 window_->Maximize(); 323 ShowWithWindowState(ui::SHOW_STATE_MAXIMIZED);
324 window_->Show();
325 } 324 }
326 325
327 void NativeWidgetAura::ShowWithWindowState(ui::WindowShowState state) { 326 void NativeWidgetAura::ShowWithWindowState(ui::WindowShowState state) {
328 switch(state) { 327 switch (state) {
329 case ui::SHOW_STATE_MAXIMIZED: 328 case ui::SHOW_STATE_MAXIMIZED:
330 window_->Maximize(); 329 window_->Maximize();
331 break; 330 break;
332 case ui::SHOW_STATE_FULLSCREEN: 331 case ui::SHOW_STATE_FULLSCREEN:
333 window_->Fullscreen(); 332 window_->Fullscreen();
334 break; 333 break;
335 default: 334 default:
336 break; 335 break;
337 } 336 }
338 window_->Show(); 337 window_->Show();
338 if (can_activate_ && (state != ui::SHOW_STATE_INACTIVE ||
339 !GetWidget()->SetInitialFocus()))
340 window_->Activate();
Ben Goodger (Google) 2011/10/31 18:31:39 braces around this block
339 } 341 }
340 342
341 bool NativeWidgetAura::IsVisible() const { 343 bool NativeWidgetAura::IsVisible() const {
342 return window_->IsVisible(); 344 return window_->IsVisible();
343 } 345 }
344 346
345 void NativeWidgetAura::Activate() { 347 void NativeWidgetAura::Activate() {
346 window_->Activate(); 348 window_->Activate();
347 } 349 }
348 350
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 void NativeWidgetAura::SetFullscreen(bool fullscreen) { 383 void NativeWidgetAura::SetFullscreen(bool fullscreen) {
382 fullscreen ? window_->Fullscreen() : window_->Restore(); 384 fullscreen ? window_->Fullscreen() : window_->Restore();
383 } 385 }
384 386
385 bool NativeWidgetAura::IsFullscreen() const { 387 bool NativeWidgetAura::IsFullscreen() const {
386 return window_->show_state() == ui::SHOW_STATE_FULLSCREEN; 388 return window_->show_state() == ui::SHOW_STATE_FULLSCREEN;
387 } 389 }
388 390
389 void NativeWidgetAura::SetOpacity(unsigned char opacity) { 391 void NativeWidgetAura::SetOpacity(unsigned char opacity) {
390 window_->layer()->SetOpacity(opacity / 255.0); 392 window_->layer()->SetOpacity(opacity / 255.0);
393 window_->layer()->ScheduleDraw();
391 } 394 }
392 395
393 void NativeWidgetAura::SetUseDragFrame(bool use_drag_frame) { 396 void NativeWidgetAura::SetUseDragFrame(bool use_drag_frame) {
394 NOTIMPLEMENTED(); 397 NOTIMPLEMENTED();
395 } 398 }
396 399
397 bool NativeWidgetAura::IsAccessibleWidget() const { 400 bool NativeWidgetAura::IsAccessibleWidget() const {
398 NOTIMPLEMENTED(); 401 NOTIMPLEMENTED();
399 return false; 402 return false;
400 } 403 }
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
646 } 649 }
647 650
648 // static 651 // static
649 bool NativeWidgetPrivate::IsMouseButtonDown() { 652 bool NativeWidgetPrivate::IsMouseButtonDown() {
650 NOTIMPLEMENTED(); 653 NOTIMPLEMENTED();
651 return false; 654 return false;
652 } 655 }
653 656
654 } // namespace internal 657 } // namespace internal
655 } // namespace views 658 } // namespace views
OLDNEW
« no previous file with comments | « views/widget/native_widget_aura.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698