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

Side by Side Diff: athena/home/athena_start_page_view.h

Issue 478293004: Refactor the home card structure and introduce animation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rease Created 6 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
« no previous file with comments | « no previous file | athena/home/athena_start_page_view.cc » ('j') | athena/home/minimized_home.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/memory/weak_ptr.h" 8 #include "base/memory/weak_ptr.h"
9 #include "ui/app_list/views/search_box_view_delegate.h" 9 #include "ui/app_list/views/search_box_view_delegate.h"
10 #include "ui/views/view.h" 10 #include "ui/views/view.h"
11 11
12 namespace app_list { 12 namespace app_list {
13 class AppListViewDelegate; 13 class AppListViewDelegate;
14 class SearchBoxView; 14 class SearchBoxView;
15 class SearchResultListView; 15 class SearchResultListView;
16 } 16 }
17 17
18 namespace athena { 18 namespace athena {
19 19
20 // It will replace app_list::StartPageView in Athena UI in the future.
21 // Right now it's simply used for VISIBLE_BOTTOM state.
22 class AthenaStartPageView : public views::View, 20 class AthenaStartPageView : public views::View,
23 public app_list::SearchBoxViewDelegate { 21 public app_list::SearchBoxViewDelegate {
24 public: 22 public:
25 explicit AthenaStartPageView(app_list::AppListViewDelegate* delegate); 23 explicit AthenaStartPageView(app_list::AppListViewDelegate* delegate);
26 virtual ~AthenaStartPageView(); 24 virtual ~AthenaStartPageView();
27 25
28 // Requests the focus on the search box in the start page view. 26 // Requests the focus on the search box in the start page view.
29 void RequestFocusOnSearchBox(); 27 void RequestFocusOnSearchBox();
30 28
29 // Updates the layout state. See the comment of |layout_state_| field.
30 void SetLayoutState(float layout_state);
31
32 // Updates the layout state and move the subviews to the target location with
33 // animation.
34 void SetLayoutStateWithAnimation(float layout_state);
35
31 private: 36 private:
37 static const char kViewClassName[];
38
39 // A struct which bundles the layout data of subviews.
40 struct LayoutData {
41 gfx::Rect search_box;
42 gfx::Rect icons;
43 gfx::Rect controls;
44 float logo_opacity;
45 float background_opacity;
46
47 LayoutData();
48 };
49
50 // Returns the bounds for |VISIBLE_BOTTOM|.
51 LayoutData CreateBottomBounds(int width);
52
53 // Returns the bounds for |VISIBLE_CENTERED|.
54 LayoutData CreateCenteredBounds(int width);
55
32 // Schedules the animation for the layout the search box and the search 56 // Schedules the animation for the layout the search box and the search
33 // results. 57 // results.
34 void LayoutSearchResults(bool should_show_search_results); 58 void LayoutSearchResults(bool should_show_search_results);
35 59
36 // Called when the animation of search box / search results layout has 60 // Called when the animation of search box / search results layout has
37 // completed. 61 // completed.
38 void OnSearchResultLayoutAnimationCompleted(bool should_show_search_results); 62 void OnSearchResultLayoutAnimationCompleted(bool should_show_search_results);
39 63
40 // views::View: 64 // views::View:
41 virtual void Layout() OVERRIDE; 65 virtual void Layout() OVERRIDE;
42 virtual bool OnKeyPressed(const ui::KeyEvent& key_event) OVERRIDE; 66 virtual bool OnKeyPressed(const ui::KeyEvent& key_event) OVERRIDE;
43 67
44 // app_list::SearchBoxViewDelegate: 68 // app_list::SearchBoxViewDelegate:
45 virtual void QueryChanged(app_list::SearchBoxView* sender) OVERRIDE; 69 virtual void QueryChanged(app_list::SearchBoxView* sender) OVERRIDE;
46 70
47 // Not owned. 71 // Not owned.
48 app_list::AppListViewDelegate* delegate_; 72 app_list::AppListViewDelegate* delegate_;
49 73
50 // Views are owned through its hierarchy. 74 // Views are owned through its hierarchy.
51 views::View* app_icon_container_; 75 views::View* app_icon_container_;
52 views::View* search_box_container_; 76 views::View* search_box_container_;
53 views::View* control_icon_container_; 77 views::View* control_icon_container_;
54 views::View* logo_; 78 views::View* logo_;
55 app_list::SearchBoxView* search_box_view_; 79 app_list::SearchBoxView* search_box_view_;
56 app_list::SearchResultListView* search_results_view_; 80 app_list::SearchResultListView* search_results_view_;
57 81
82 // Do not use views::Background but a views::View with ui::Layer for gradient
83 // background opacity update and animation.
84 views::View* background_;
85
58 // The expected height of |search_results_view_| 86 // The expected height of |search_results_view_|
59 int search_results_height_; 87 int search_results_height_;
60 88
89 // The state to specify how each of the subviews should be laid out, in the
90 // range of [0, 1]. 0 means fully BOTTOM state, and 1 is fully CENTERED state.
91 float layout_state_;
92
61 base::WeakPtrFactory<AthenaStartPageView> weak_factory_; 93 base::WeakPtrFactory<AthenaStartPageView> weak_factory_;
62 94
63 DISALLOW_COPY_AND_ASSIGN(AthenaStartPageView); 95 DISALLOW_COPY_AND_ASSIGN(AthenaStartPageView);
64 }; 96 };
65 97
66 } // namespace athena 98 } // namespace athena
67 99
68 #endif // ATHENA_HOME_ATHENA_START_PAGE_VIEW_H_ 100 #endif // ATHENA_HOME_ATHENA_START_PAGE_VIEW_H_
OLDNEW
« no previous file with comments | « no previous file | athena/home/athena_start_page_view.cc » ('j') | athena/home/minimized_home.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698