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 "ui/aura/window.h" | 5 #include "ui/aura/window.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
11 #include "ui/aura/desktop.h" | 11 #include "ui/aura/desktop.h" |
12 #include "ui/aura/desktop_delegate.h" | 12 #include "ui/aura/desktop_delegate.h" |
13 #include "ui/aura/event.h" | 13 #include "ui/aura/event.h" |
14 #include "ui/aura/event_filter.h" | 14 #include "ui/aura/event_filter.h" |
15 #include "ui/aura/layout_manager.h" | 15 #include "ui/aura/layout_manager.h" |
16 #include "ui/aura/window_delegate.h" | 16 #include "ui/aura/window_delegate.h" |
17 #include "ui/aura/window_observer.h" | 17 #include "ui/aura/window_observer.h" |
18 #include "ui/aura/window_types.h" | 18 #include "ui/aura/window_types.h" |
19 #include "ui/base/animation/multi_animation.h" | 19 #include "ui/base/animation/multi_animation.h" |
20 #include "ui/base/view_prop.h" | 20 #include "ui/base/view_prop.h" |
21 #include "ui/gfx/canvas_skia.h" | 21 #include "ui/gfx/canvas_skia.h" |
22 #include "ui/gfx/compositor/compositor.h" | 22 #include "ui/gfx/compositor/compositor.h" |
| 23 #include "ui/gfx/compositor/layer.h" |
23 #include "ui/gfx/screen.h" | 24 #include "ui/gfx/screen.h" |
24 | 25 |
25 namespace aura { | 26 namespace aura { |
26 | 27 |
27 Window::Window(WindowDelegate* delegate) | 28 Window::Window(WindowDelegate* delegate) |
28 : type_(kWindowType_None), | 29 : type_(kWindowType_None), |
29 delegate_(delegate), | 30 delegate_(delegate), |
30 show_state_(ui::SHOW_STATE_NORMAL), | 31 show_state_(ui::SHOW_STATE_NORMAL), |
31 parent_(NULL), | 32 parent_(NULL), |
32 transient_parent_(NULL), | 33 transient_parent_(NULL), |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 if (value) | 430 if (value) |
430 prop_map_[name] = new ui::ViewProp(this, name, value); | 431 prop_map_[name] = new ui::ViewProp(this, name, value); |
431 else | 432 else |
432 prop_map_.erase(name); | 433 prop_map_.erase(name); |
433 } | 434 } |
434 | 435 |
435 void* Window::GetProperty(const char* name) const { | 436 void* Window::GetProperty(const char* name) const { |
436 return ui::ViewProp::GetValue(const_cast<gfx::NativeView>(this), name); | 437 return ui::ViewProp::GetValue(const_cast<gfx::NativeView>(this), name); |
437 } | 438 } |
438 | 439 |
| 440 // static |
| 441 ui::Animation* Window::CreateDefaultAnimation() { |
| 442 std::vector<ui::MultiAnimation::Part> parts; |
| 443 parts.push_back(ui::MultiAnimation::Part(200, ui::Tween::LINEAR)); |
| 444 ui::MultiAnimation* multi_animation = new ui::MultiAnimation(parts); |
| 445 multi_animation->set_continuous(false); |
| 446 return multi_animation; |
| 447 } |
| 448 |
439 Desktop* Window::GetDesktop() { | 449 Desktop* Window::GetDesktop() { |
440 return parent_ ? parent_->GetDesktop() : NULL; | 450 return parent_ ? parent_->GetDesktop() : NULL; |
441 } | 451 } |
442 | 452 |
443 void Window::SetBoundsInternal(const gfx::Rect& new_bounds) { | 453 void Window::SetBoundsInternal(const gfx::Rect& new_bounds) { |
444 const gfx::Rect old_bounds = bounds(); | 454 const gfx::Rect old_bounds = bounds(); |
445 bool was_move = old_bounds.size() == new_bounds.size(); | 455 bool was_move = old_bounds.size() == new_bounds.size(); |
446 layer_->SetBounds(new_bounds); | 456 layer_->SetBounds(new_bounds); |
447 | 457 |
448 if (layout_manager_.get()) | 458 if (layout_manager_.get()) |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
524 break; | 534 break; |
525 } | 535 } |
526 | 536 |
527 return delegate_ ? this : NULL; | 537 return delegate_ ? this : NULL; |
528 } | 538 } |
529 | 539 |
530 void Window::OnPaintLayer(gfx::Canvas* canvas) { | 540 void Window::OnPaintLayer(gfx::Canvas* canvas) { |
531 delegate_->OnPaint(canvas); | 541 delegate_->OnPaint(canvas); |
532 } | 542 } |
533 | 543 |
534 void Window::OnLayerAnimationEnded( | 544 void Window::OnLayerAnimationEnded(const ui::Animation* animation) { |
535 const ui::LayerAnimationSequence* animation) { | |
536 } | 545 } |
537 | 546 |
538 } // namespace aura | 547 } // namespace aura |
OLD | NEW |