OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #ifndef CHROME_BROWSER_UI_VIEWS_FRAME_CONTENTS_CONTAINER_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_FRAME_CONTENTS_CONTAINER_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_FRAME_CONTENTS_CONTAINER_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_FRAME_CONTENTS_CONTAINER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "app/animation_delegate.h" | |
10 #include "base/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
| 10 #include "ui/base/animation/animation_delegate.h" |
11 #include "views/view.h" | 11 #include "views/view.h" |
12 | 12 |
| 13 class TabContents; |
| 14 |
| 15 namespace ui { |
13 class SlideAnimation; | 16 class SlideAnimation; |
14 class TabContents; | 17 } |
15 | 18 |
16 namespace views { | 19 namespace views { |
17 class Widget; | 20 class Widget; |
18 } | 21 } |
19 | 22 |
20 // ContentsContainer is responsible for managing the TabContents views. | 23 // ContentsContainer is responsible for managing the TabContents views. |
21 // ContentsContainer has up to two children: one for the currently active | 24 // ContentsContainer has up to two children: one for the currently active |
22 // TabContents and one for instant's TabContents. | 25 // TabContents and one for instant's TabContents. |
23 class ContentsContainer : public views::View, public AnimationDelegate { | 26 class ContentsContainer : public views::View, public ui::AnimationDelegate { |
24 public: | 27 public: |
25 explicit ContentsContainer(views::View* active); | 28 explicit ContentsContainer(views::View* active); |
26 virtual ~ContentsContainer(); | 29 virtual ~ContentsContainer(); |
27 | 30 |
28 // Makes the preview view the active view and nulls out the old active view. | 31 // Makes the preview view the active view and nulls out the old active view. |
29 // It's assumed the caller will delete or remove the old active view | 32 // It's assumed the caller will delete or remove the old active view |
30 // separately. | 33 // separately. |
31 void MakePreviewContentsActiveContents(); | 34 void MakePreviewContentsActiveContents(); |
32 | 35 |
33 // Sets the preview view. This does not delete the old. | 36 // Sets the preview view. This does not delete the old. |
(...skipping 13 matching lines...) Expand all Loading... |
47 | 50 |
48 // Shows the fade. This is similiar to |FadeActiveContents|, but is immediate. | 51 // Shows the fade. This is similiar to |FadeActiveContents|, but is immediate. |
49 void ShowFade(); | 52 void ShowFade(); |
50 | 53 |
51 // Removes the fade. This is done implicitly when the preview is made active. | 54 // Removes the fade. This is done implicitly when the preview is made active. |
52 void RemoveFade(); | 55 void RemoveFade(); |
53 | 56 |
54 // View overrides: | 57 // View overrides: |
55 virtual void Layout(); | 58 virtual void Layout(); |
56 | 59 |
57 // AnimationDelegate overrides: | 60 // ui::AnimationDelegate overrides: |
58 virtual void AnimationProgressed(const Animation* animation); | 61 virtual void AnimationProgressed(const ui::Animation* animation); |
59 | 62 |
60 private: | 63 private: |
61 class OverlayContentView; | 64 class OverlayContentView; |
62 | 65 |
63 // Creates the overlay widget. The opacity is set at |initial_opacity|. | 66 // Creates the overlay widget. The opacity is set at |initial_opacity|. |
64 void CreateOverlay(int initial_opacity); | 67 void CreateOverlay(int initial_opacity); |
65 | 68 |
66 // Invoked when the contents view of the overlay is destroyed. | 69 // Invoked when the contents view of the overlay is destroyed. |
67 void OverlayViewDestroyed(); | 70 void OverlayViewDestroyed(); |
68 | 71 |
69 views::View* active_; | 72 views::View* active_; |
70 | 73 |
71 views::View* preview_; | 74 views::View* preview_; |
72 | 75 |
73 TabContents* preview_tab_contents_; | 76 TabContents* preview_tab_contents_; |
74 | 77 |
75 // Translucent Widget positioned right above the active view that is used to | 78 // Translucent Widget positioned right above the active view that is used to |
76 // make the active view appear faded out. | 79 // make the active view appear faded out. |
77 views::Widget* active_overlay_; | 80 views::Widget* active_overlay_; |
78 | 81 |
79 // Content view of active_overlay. Used to track when the widget is destroyed. | 82 // Content view of active_overlay. Used to track when the widget is destroyed. |
80 OverlayContentView* overlay_view_; | 83 OverlayContentView* overlay_view_; |
81 | 84 |
82 // Animation used to vary the opacity of active_overlay. | 85 // Animation used to vary the opacity of active_overlay. |
83 scoped_ptr<SlideAnimation> overlay_animation_; | 86 scoped_ptr<ui::SlideAnimation> overlay_animation_; |
84 | 87 |
85 // The margin between the top and the active view. This is used to make the | 88 // The margin between the top and the active view. This is used to make the |
86 // preview overlap the bookmark bar on the new tab page. | 89 // preview overlap the bookmark bar on the new tab page. |
87 int active_top_margin_; | 90 int active_top_margin_; |
88 | 91 |
89 DISALLOW_COPY_AND_ASSIGN(ContentsContainer); | 92 DISALLOW_COPY_AND_ASSIGN(ContentsContainer); |
90 }; | 93 }; |
91 | 94 |
92 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_CONTENTS_CONTAINER_H_ | 95 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_CONTENTS_CONTAINER_H_ |
OLD | NEW |