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

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

Issue 10873094: alternate ntp: fix toolbar separator visibility when query is cleared (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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; 14 class TabContents;
15 class ToolbarModel;
15 16
16 namespace ui { 17 namespace ui {
17 class MultiAnimation; 18 class MultiAnimation;
18 } 19 }
19 20
20 namespace chrome { 21 namespace chrome {
21 namespace search { 22 namespace search {
22 23
23 class SearchModel; 24 class SearchModel;
24 class ToolbarSearchAnimatorObserver; 25 class ToolbarSearchAnimatorObserver;
25 26
26 // ToolbarSearchAnimator is used to track the gradient background state of the 27 // ToolbarSearchAnimator is used to track the gradient background state of the
27 // toolbar and related classes. To use ToolbarSearchAnimator, add a 28 // toolbar and related classes. To use ToolbarSearchAnimator, add a
28 // ToolbarSearchAnimatorObserver. The ToolbarSearchAnimatorObserver is then 29 // ToolbarSearchAnimatorObserver. The ToolbarSearchAnimatorObserver is then
29 // notified appropriately. 30 // notified appropriately.
30 class ToolbarSearchAnimator : public SearchModelObserver, 31 class ToolbarSearchAnimator : public SearchModelObserver,
31 public ui::AnimationDelegate { 32 public ui::AnimationDelegate {
32 public: 33 public:
33 explicit ToolbarSearchAnimator(SearchModel* search_model); 34 ToolbarSearchAnimator(SearchModel* search_model, ToolbarModel* toolbar_model);
34 virtual ~ToolbarSearchAnimator(); 35 virtual ~ToolbarSearchAnimator();
35 36
36 // Get the gradient background opacity to paint for toolbar and active tab, a 37 // Get the gradient background opacity to paint for toolbar and active tab, a
37 // value between 0f and 1f inclusive: 38 // value between 0f and 1f inclusive:
38 // - 0f: only paint flat background 39 // - 0f: only paint flat background
39 // - < 1f: paint flat background at full opacity and gradient background at 40 // - < 1f: paint flat background at full opacity and gradient background at
40 // specified opacity 41 // specified opacity
41 // - 1f: only paint gradient background at full opacity 42 // - 1f: only paint gradient background at full opacity
42 double GetGradientOpacity() const; 43 double GetGradientOpacity() const;
43 44
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 // ToolbarSearchAnimatorObserver::OnToolbarBackgroundAnimatorCanceled or 81 // ToolbarSearchAnimatorObserver::OnToolbarBackgroundAnimatorCanceled or
81 // ToolbarSearchAnimatorObserver::OnToolbarSeparatorAnimatorCanceled 82 // ToolbarSearchAnimatorObserver::OnToolbarSeparatorAnimatorCanceled
82 // respectively. 83 // respectively.
83 // Pass in |tab_contents| if animation is canceled because of deactivating or 84 // Pass in |tab_contents| if animation is canceled because of deactivating or
84 // detaching or closing a tab. 85 // detaching or closing a tab.
85 void Reset(TabContents* tab_contents); 86 void Reset(TabContents* tab_contents);
86 87
87 // Weak. Owned by Browser. Non-NULL. 88 // Weak. Owned by Browser. Non-NULL.
88 SearchModel* search_model_; 89 SearchModel* search_model_;
89 90
91 // Weak. Owned by Browser. Non-NULL.
92 ToolbarModel* toolbar_model_;
93
90 // The background change animation. 94 // The background change animation.
91 scoped_ptr<ui::MultiAnimation> background_animation_; 95 scoped_ptr<ui::MultiAnimation> background_animation_;
92 96
93 // Time (in ms) of background animation delay and duration. 97 // Time (in ms) of background animation delay and duration.
94 int background_change_delay_ms_; 98 int background_change_delay_ms_;
95 int background_change_duration_ms_; 99 int background_change_duration_ms_;
96 100
97 // True if the omnibox popup is open. 101 // True if the omnibox popup is open.
98 bool is_omnibox_popup_open_; 102 bool is_omnibox_popup_open_;
99 103
100 // Observers. 104 // Observers.
101 ObserverList<ToolbarSearchAnimatorObserver> observers_; 105 ObserverList<ToolbarSearchAnimatorObserver> observers_;
102 106
103 DISALLOW_COPY_AND_ASSIGN(ToolbarSearchAnimator); 107 DISALLOW_COPY_AND_ASSIGN(ToolbarSearchAnimator);
104 }; 108 };
105 109
106 } // namespace chrome 110 } // namespace chrome
107 } // namespace search 111 } // namespace search
108 112
109 #endif // CHROME_BROWSER_UI_SEARCH_TOOLBAR_SEARCH_ANIMATOR_H_ 113 #endif // CHROME_BROWSER_UI_SEARCH_TOOLBAR_SEARCH_ANIMATOR_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/search/search_delegate.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