Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef UI_APP_LIST_CONTENTS_VIEW_H_ | |
| 6 #define UI_APP_LIST_CONTENTS_VIEW_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include "base/basictypes.h" | |
| 10 #include "base/compiler_specific.h" | |
| 11 #include "base/memory/scoped_ptr.h" | |
| 12 #include "ui/views/view.h" | |
| 13 | |
| 14 namespace views { | |
| 15 class BoundsAnimator; | |
| 16 class ViewModel; | |
| 17 } | |
| 18 | |
| 19 namespace app_list { | |
| 20 | |
| 21 class AppListModel; | |
| 22 class AppListView; | |
| 23 class PaginationModel; | |
| 24 | |
| 25 // A view to manage sub views under the search box (apps grid view + page | |
| 26 // switcher and search results). The two sets of sub views are mutually | |
| 27 // exclusive. ContentsView manages a show state to choose one set to show | |
| 28 // and animates the transition between show states. | |
| 29 class ContentsView : public views::View { | |
| 30 public: | |
| 31 ContentsView(AppListView* app_list_view, | |
| 32 PaginationModel* pagination_model); | |
| 33 virtual ~ContentsView(); | |
| 34 | |
| 35 void SetModel(AppListModel* model); | |
| 36 | |
| 37 void ShowSearchResults(bool show); | |
| 38 | |
| 39 private: | |
| 40 enum ShowState { | |
| 41 SHOW_APPS, | |
| 42 SHOW_SEARCH_RESULTS, | |
| 43 }; | |
| 44 | |
| 45 // Sets show state. | |
| 46 void SetShowState(ShowState show_state); | |
| 47 | |
| 48 // Invoked when show state is changed. | |
| 49 void ShowStateChanged(); | |
| 50 | |
| 51 void CalculateIdealBounds(); | |
| 52 void AnimateToIdealBounds(); | |
| 53 | |
| 54 // Overridden from views::View: | |
| 55 virtual gfx::Size GetPreferredSize() OVERRIDE; | |
| 56 virtual void Layout() OVERRIDE; | |
| 57 virtual bool OnKeyPressed(const views::KeyEvent& event) OVERRIDE; | |
| 58 | |
| 59 ShowState show_state_; | |
| 60 | |
| 61 scoped_ptr<views::ViewModel> view_model_; | |
|
sky
2012/06/08 02:57:25
Since you create these in the constructor make the
tfarina
2012/06/08 04:18:51
By making them values, means that we will need to
xiyuan
2012/06/08 16:16:54
Exactly. :)
| |
| 62 scoped_ptr<views::BoundsAnimator> bounds_animator_; | |
| 63 | |
| 64 DISALLOW_COPY_AND_ASSIGN(ContentsView); | |
| 65 }; | |
| 66 | |
| 67 } // namespace app_list | |
| 68 | |
| 69 #endif // UI_APP_LIST_CONTENTS_VIEW_H_ | |
| OLD | NEW |