| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 ATHENA_HOME_ATHENA_START_PAGE_VIEW_H_ | 5 #ifndef ATHENA_HOME_ATHENA_START_PAGE_VIEW_H_ |
| 6 #define ATHENA_HOME_ATHENA_START_PAGE_VIEW_H_ | 6 #define ATHENA_HOME_ATHENA_START_PAGE_VIEW_H_ |
| 7 | 7 |
| 8 #include "athena/athena_export.h" | 8 #include "athena/athena_export.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "base/observer_list.h" |
| 10 #include "ui/app_list/views/search_box_view_delegate.h" | 11 #include "ui/app_list/views/search_box_view_delegate.h" |
| 11 #include "ui/gfx/animation/tween.h" | 12 #include "ui/gfx/animation/tween.h" |
| 12 #include "ui/views/view.h" | 13 #include "ui/views/view.h" |
| 13 | 14 |
| 14 namespace app_list { | 15 namespace app_list { |
| 15 class AppListViewDelegate; | 16 class AppListViewDelegate; |
| 16 class SearchBoxView; | 17 class SearchBoxView; |
| 17 class SearchResultListView; | 18 class SearchResultListView; |
| 18 } | 19 } |
| 19 | 20 |
| 20 namespace athena { | 21 namespace athena { |
| 21 | 22 |
| 22 class ATHENA_EXPORT AthenaStartPageView | 23 class ATHENA_EXPORT AthenaStartPageView |
| 23 : public views::View, | 24 : public views::View, |
| 24 public app_list::SearchBoxViewDelegate { | 25 public app_list::SearchBoxViewDelegate { |
| 25 public: | 26 public: |
| 27 class Observer { |
| 28 public: |
| 29 virtual void OnLayoutStateChanged(float new_state) = 0; |
| 30 }; |
| 31 |
| 26 explicit AthenaStartPageView(app_list::AppListViewDelegate* delegate); | 32 explicit AthenaStartPageView(app_list::AppListViewDelegate* delegate); |
| 27 virtual ~AthenaStartPageView(); | 33 virtual ~AthenaStartPageView(); |
| 28 | 34 |
| 29 // Requests the focus on the search box in the start page view. | 35 // Requests the focus on the search box in the start page view. |
| 30 void RequestFocusOnSearchBox(); | 36 void RequestFocusOnSearchBox(); |
| 31 | 37 |
| 32 // Updates the layout state. See the comment of |layout_state_| field. | 38 // Updates the layout state. See the comment of |layout_state_| field. |
| 33 void SetLayoutState(float layout_state); | 39 void SetLayoutState(float layout_state); |
| 34 | 40 |
| 35 // Updates the layout state and move the subviews to the target location with | 41 // Updates the layout state and move the subviews to the target location with |
| 36 // animation. | 42 // animation. |
| 37 void SetLayoutStateWithAnimation(float layout_state, | 43 void SetLayoutStateWithAnimation(float layout_state, |
| 38 gfx::Tween::Type tween_type); | 44 gfx::Tween::Type tween_type); |
| 39 | 45 |
| 46 void AddObserver(Observer* observer); |
| 47 void RemoveObserver(Observer* observer); |
| 48 |
| 40 private: | 49 private: |
| 41 friend class AthenaStartPageViewTest; | 50 friend class AthenaStartPageViewTest; |
| 42 | 51 |
| 43 static const char kViewClassName[]; | 52 static const char kViewClassName[]; |
| 44 | 53 |
| 45 // A struct which bundles the layout data of subviews. | 54 // A struct which bundles the layout data of subviews. |
| 46 struct LayoutData { | 55 struct LayoutData { |
| 47 gfx::Rect search_box; | 56 gfx::Rect search_box; |
| 48 gfx::Rect icons; | 57 gfx::Rect icons; |
| 49 gfx::Rect controls; | 58 gfx::Rect controls; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 // background opacity update and animation. | 100 // background opacity update and animation. |
| 92 views::View* background_; | 101 views::View* background_; |
| 93 | 102 |
| 94 // The expected height of |search_results_view_| | 103 // The expected height of |search_results_view_| |
| 95 int search_results_height_; | 104 int search_results_height_; |
| 96 | 105 |
| 97 // The state to specify how each of the subviews should be laid out, in the | 106 // The state to specify how each of the subviews should be laid out, in the |
| 98 // range of [0, 1]. 0 means fully BOTTOM state, and 1 is fully CENTERED state. | 107 // range of [0, 1]. 0 means fully BOTTOM state, and 1 is fully CENTERED state. |
| 99 float layout_state_; | 108 float layout_state_; |
| 100 | 109 |
| 110 ObserverList<Observer> observers_; |
| 111 |
| 101 base::WeakPtrFactory<AthenaStartPageView> weak_factory_; | 112 base::WeakPtrFactory<AthenaStartPageView> weak_factory_; |
| 102 | 113 |
| 103 DISALLOW_COPY_AND_ASSIGN(AthenaStartPageView); | 114 DISALLOW_COPY_AND_ASSIGN(AthenaStartPageView); |
| 104 }; | 115 }; |
| 105 | 116 |
| 106 } // namespace athena | 117 } // namespace athena |
| 107 | 118 |
| 108 #endif // ATHENA_HOME_ATHENA_START_PAGE_VIEW_H_ | 119 #endif // ATHENA_HOME_ATHENA_START_PAGE_VIEW_H_ |
| OLD | NEW |