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

Side by Side Diff: chrome/browser/ui/search/toolbar_search_animator.h

Issue 10944016: Switch SearchTabHelper to use WebContentsUserData. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: const Created 8 years, 3 months 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_SEARCH_TOOLBAR_SEARCH_ANIMATOR_H_ 5 #ifndef CHROME_BROWSER_UI_SEARCH_TOOLBAR_SEARCH_ANIMATOR_H_
6 #define CHROME_BROWSER_UI_SEARCH_TOOLBAR_SEARCH_ANIMATOR_H_ 6 #define CHROME_BROWSER_UI_SEARCH_TOOLBAR_SEARCH_ANIMATOR_H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/observer_list.h" 9 #include "base/observer_list.h"
10 #include "chrome/browser/ui/search/search_model_observer.h" 10 #include "chrome/browser/ui/search/search_model_observer.h"
11 #include "chrome/browser/ui/search/search_types.h" 11 #include "chrome/browser/ui/search/search_types.h"
12 #include "ui/base/animation/animation_delegate.h" 12 #include "ui/base/animation/animation_delegate.h"
13 13
14 class TabContents;
15 class ToolbarModel; 14 class ToolbarModel;
16 15
16 namespace content {
17 class WebContents;
18 }
19
17 namespace ui { 20 namespace ui {
18 class MultiAnimation; 21 class MultiAnimation;
19 } 22 }
20 23
21 namespace chrome { 24 namespace chrome {
22 namespace search { 25 namespace search {
23 26
24 class SearchModel; 27 class SearchModel;
25 class ToolbarSearchAnimatorObserver; 28 class ToolbarSearchAnimatorObserver;
26 29
(...skipping 19 matching lines...) Expand all
46 bool IsToolbarSeparatorVisible() const; 49 bool IsToolbarSeparatorVisible() const;
47 50
48 // Called from SearchViewController::PopupVisibilityChanged when omnibox popup 51 // Called from SearchViewController::PopupVisibilityChanged when omnibox popup
49 // for native suggestions finish closing. 52 // for native suggestions finish closing.
50 void OnOmniboxPopupClosed(); 53 void OnOmniboxPopupClosed();
51 54
52 // Called from SearchDelegate::StopObservingTab() when a tab is deactivated or 55 // Called from SearchDelegate::StopObservingTab() when a tab is deactivated or
53 // closing or detached, to jump to the end state of the animation. 56 // closing or detached, to jump to the end state of the animation.
54 // This allows a reactivated tab to show the end state of the animation, 57 // This allows a reactivated tab to show the end state of the animation,
55 // rather than the transient state. 58 // rather than the transient state.
56 void FinishAnimation(TabContents* tab_contents); 59 void FinishAnimation(content::WebContents* web_contents);
57 60
58 // Add and remove observers. 61 // Add and remove observers.
59 void AddObserver(ToolbarSearchAnimatorObserver* observer); 62 void AddObserver(ToolbarSearchAnimatorObserver* observer);
60 void RemoveObserver(ToolbarSearchAnimatorObserver* observer); 63 void RemoveObserver(ToolbarSearchAnimatorObserver* observer);
61 64
62 // Overridden from SearchModelObserver: 65 // Overridden from SearchModelObserver:
63 virtual void ModeChanged(const Mode& old_mode, const Mode& new_mode) OVERRIDE; 66 virtual void ModeChanged(const Mode& old_mode, const Mode& new_mode) OVERRIDE;
64 67
65 // Overridden from ui::AnimationDelegate: 68 // Overridden from ui::AnimationDelegate:
66 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; 69 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE;
67 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; 70 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE;
68 71
69 private: 72 private:
70 friend class ToolbarSearchAnimatorTest; 73 friend class ToolbarSearchAnimatorTest;
71 friend class ToolbarSearchAnimatorTestObserver; 74 friend class ToolbarSearchAnimatorTestObserver;
72 75
73 // Helper function to initialize background animation with its parts. 76 // Helper function to initialize background animation with its parts.
74 void InitBackgroundAnimation(); 77 void InitBackgroundAnimation();
75 78
76 // Helper function to start animation for gradient background change. 79 // Helper function to start animation for gradient background change.
77 void StartBackgroundChange(); 80 void StartBackgroundChange();
78 81
79 // Reset animations by stopping them. 82 // Reset animations by stopping them.
80 // If we're animating background or separator, we'll notify observers via 83 // If we're animating background or separator, we'll notify observers via
81 // ToolbarSearchAnimatorObserver::OnToolbarBackgroundAnimatorCanceled or 84 // ToolbarSearchAnimatorObserver::OnToolbarBackgroundAnimatorCanceled or
82 // ToolbarSearchAnimatorObserver::OnToolbarSeparatorAnimatorCanceled 85 // ToolbarSearchAnimatorObserver::OnToolbarSeparatorAnimatorCanceled
83 // respectively. 86 // respectively.
84 // Pass in |tab_contents| if animation is canceled because of deactivating or 87 // Pass in |web_contents| if animation is canceled because of deactivating or
85 // detaching or closing a tab. 88 // detaching or closing a tab.
86 void Reset(TabContents* tab_contents); 89 void Reset(content::WebContents* web_contents);
87 90
88 // Weak. Owned by Browser. Non-NULL. 91 // Weak. Owned by Browser. Non-NULL.
89 SearchModel* search_model_; 92 SearchModel* search_model_;
90 93
91 // Weak. Owned by Browser. Non-NULL. 94 // Weak. Owned by Browser. Non-NULL.
92 ToolbarModel* toolbar_model_; 95 ToolbarModel* toolbar_model_;
93 96
94 // The background change animation. 97 // The background change animation.
95 scoped_ptr<ui::MultiAnimation> background_animation_; 98 scoped_ptr<ui::MultiAnimation> background_animation_;
96 99
97 // Time (in ms) of background animation delay and duration. 100 // Time (in ms) of background animation delay and duration.
98 int background_change_delay_ms_; 101 int background_change_delay_ms_;
99 int background_change_duration_ms_; 102 int background_change_duration_ms_;
100 103
101 // True if the omnibox popup is open. 104 // True if the omnibox popup is open.
102 bool is_omnibox_popup_open_; 105 bool is_omnibox_popup_open_;
103 106
104 // Observers. 107 // Observers.
105 ObserverList<ToolbarSearchAnimatorObserver> observers_; 108 ObserverList<ToolbarSearchAnimatorObserver> observers_;
106 109
107 DISALLOW_COPY_AND_ASSIGN(ToolbarSearchAnimator); 110 DISALLOW_COPY_AND_ASSIGN(ToolbarSearchAnimator);
108 }; 111 };
109 112
110 } // namespace chrome 113 } // namespace chrome
111 } // namespace search 114 } // namespace search
112 115
113 #endif // CHROME_BROWSER_UI_SEARCH_TOOLBAR_SEARCH_ANIMATOR_H_ 116 #endif // CHROME_BROWSER_UI_SEARCH_TOOLBAR_SEARCH_ANIMATOR_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/search/search_tab_helper.cc ('k') | chrome/browser/ui/search/toolbar_search_animator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698