| OLD | NEW |
| 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 Loading... |
| 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 if (params.keep_on_top) |
| 90 SetAlwaysOnTop(true); |
| 89 window_->SetParent(NULL); | 91 window_->SetParent(NULL); |
| 90 gfx::NativeView parent = params.GetParent(); | 92 gfx::NativeView parent = params.GetParent(); |
| 91 if (parent) | 93 if (parent) |
| 92 parent->AddTransientChild(window_); | 94 parent->AddTransientChild(window_); |
| 93 } | 95 } |
| 94 // TODO(beng): do this some other way. | 96 // TODO(beng): do this some other way. |
| 95 delegate_->OnNativeWidgetSizeChanged(params.bounds.size()); | 97 delegate_->OnNativeWidgetSizeChanged(params.bounds.size()); |
| 96 can_activate_ = params.can_activate; | 98 can_activate_ = params.can_activate; |
| 97 if (params.type != Widget::InitParams::TYPE_TOOLTIP && !params.child) { | 99 if (params.type != Widget::InitParams::TYPE_TOOLTIP && !params.child) { |
| 98 DCHECK(GetWidget()->GetRootView()); | 100 DCHECK(GetWidget()->GetRootView()); |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 | 350 |
| 349 void NativeWidgetAura::Deactivate() { | 351 void NativeWidgetAura::Deactivate() { |
| 350 window_->Deactivate(); | 352 window_->Deactivate(); |
| 351 } | 353 } |
| 352 | 354 |
| 353 bool NativeWidgetAura::IsActive() const { | 355 bool NativeWidgetAura::IsActive() const { |
| 354 return aura::Desktop::GetInstance()->active_window() == window_; | 356 return aura::Desktop::GetInstance()->active_window() == window_; |
| 355 } | 357 } |
| 356 | 358 |
| 357 void NativeWidgetAura::SetAlwaysOnTop(bool on_top) { | 359 void NativeWidgetAura::SetAlwaysOnTop(bool on_top) { |
| 358 NOTIMPLEMENTED(); | 360 SetNativeWindowProperty(aura::Window::kPropAlwaysOnTop, |
| 361 reinterpret_cast<void*>(on_top)); |
| 362 // TODO(xiyuan): Switch containers if window_ is added to desktop already. |
| 359 } | 363 } |
| 360 | 364 |
| 361 void NativeWidgetAura::Maximize() { | 365 void NativeWidgetAura::Maximize() { |
| 362 window_->Maximize(); | 366 window_->Maximize(); |
| 363 } | 367 } |
| 364 | 368 |
| 365 void NativeWidgetAura::Minimize() { | 369 void NativeWidgetAura::Minimize() { |
| 366 NOTIMPLEMENTED(); | 370 NOTIMPLEMENTED(); |
| 367 } | 371 } |
| 368 | 372 |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 646 } | 650 } |
| 647 | 651 |
| 648 // static | 652 // static |
| 649 bool NativeWidgetPrivate::IsMouseButtonDown() { | 653 bool NativeWidgetPrivate::IsMouseButtonDown() { |
| 650 NOTIMPLEMENTED(); | 654 NOTIMPLEMENTED(); |
| 651 return false; | 655 return false; |
| 652 } | 656 } |
| 653 | 657 |
| 654 } // namespace internal | 658 } // namespace internal |
| 655 } // namespace views | 659 } // namespace views |
| OLD | NEW |