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" | |
24 #include "ui/gfx/screen.h" | 23 #include "ui/gfx/screen.h" |
25 | 24 |
26 namespace aura { | 25 namespace aura { |
27 | 26 |
28 Window::Window(WindowDelegate* delegate) | 27 Window::Window(WindowDelegate* delegate) |
29 : type_(kWindowType_None), | 28 : type_(kWindowType_None), |
30 delegate_(delegate), | 29 delegate_(delegate), |
31 show_state_(ui::SHOW_STATE_NORMAL), | 30 show_state_(ui::SHOW_STATE_NORMAL), |
32 parent_(NULL), | 31 parent_(NULL), |
33 transient_parent_(NULL), | 32 transient_parent_(NULL), |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 if (value) | 429 if (value) |
431 prop_map_[name] = new ui::ViewProp(this, name, value); | 430 prop_map_[name] = new ui::ViewProp(this, name, value); |
432 else | 431 else |
433 prop_map_.erase(name); | 432 prop_map_.erase(name); |
434 } | 433 } |
435 | 434 |
436 void* Window::GetProperty(const char* name) const { | 435 void* Window::GetProperty(const char* name) const { |
437 return ui::ViewProp::GetValue(const_cast<gfx::NativeView>(this), name); | 436 return ui::ViewProp::GetValue(const_cast<gfx::NativeView>(this), name); |
438 } | 437 } |
439 | 438 |
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 | |
449 Desktop* Window::GetDesktop() { | 439 Desktop* Window::GetDesktop() { |
450 return parent_ ? parent_->GetDesktop() : NULL; | 440 return parent_ ? parent_->GetDesktop() : NULL; |
451 } | 441 } |
452 | 442 |
453 void Window::SetBoundsInternal(const gfx::Rect& new_bounds) { | 443 void Window::SetBoundsInternal(const gfx::Rect& new_bounds) { |
454 const gfx::Rect old_bounds = bounds(); | 444 const gfx::Rect old_bounds = bounds(); |
455 bool was_move = old_bounds.size() == new_bounds.size(); | 445 bool was_move = old_bounds.size() == new_bounds.size(); |
456 layer_->SetBounds(new_bounds); | 446 layer_->SetBounds(new_bounds); |
457 | 447 |
458 if (layout_manager_.get()) | 448 if (layout_manager_.get()) |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 break; | 524 break; |
535 } | 525 } |
536 | 526 |
537 return delegate_ ? this : NULL; | 527 return delegate_ ? this : NULL; |
538 } | 528 } |
539 | 529 |
540 void Window::OnPaintLayer(gfx::Canvas* canvas) { | 530 void Window::OnPaintLayer(gfx::Canvas* canvas) { |
541 delegate_->OnPaint(canvas); | 531 delegate_->OnPaint(canvas); |
542 } | 532 } |
543 | 533 |
544 void Window::OnLayerAnimationEnded(const ui::Animation* animation) { | 534 void Window::OnLayerAnimationEnded( |
| 535 const ui::LayerAnimationSequence* animation) { |
545 } | 536 } |
546 | 537 |
547 } // namespace aura | 538 } // namespace aura |
OLD | NEW |