| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef ATHENA_HOME_HOME_CARD_VIEW_H_ | |
| 6 #define ATHENA_HOME_HOME_CARD_VIEW_H_ | |
| 7 | |
| 8 #include "athena/athena_export.h" | |
| 9 #include "athena/home/home_card_gesture_manager.h" | |
| 10 #include "base/callback_forward.h" | |
| 11 #include "base/gtest_prod_util.h" | |
| 12 #include "base/memory/scoped_ptr.h" | |
| 13 #include "base/memory/weak_ptr.h" | |
| 14 #include "ui/gfx/animation/tween.h" | |
| 15 #include "ui/views/widget/widget_delegate.h" | |
| 16 | |
| 17 namespace app_list { | |
| 18 class AppListMainView; | |
| 19 class AppListViewDelegate; | |
| 20 class SearchBoxView; | |
| 21 } | |
| 22 | |
| 23 namespace aura { | |
| 24 class Window; | |
| 25 } | |
| 26 | |
| 27 namespace views { | |
| 28 class View; | |
| 29 } | |
| 30 | |
| 31 namespace athena { | |
| 32 | |
| 33 // The container view of home card contents. | |
| 34 class ATHENA_EXPORT HomeCardView : public views::WidgetDelegateView { | |
| 35 public: | |
| 36 HomeCardView(app_list::AppListViewDelegate* view_delegate, | |
| 37 HomeCardGestureManager::Delegate* gesture_delegate); | |
| 38 ~HomeCardView() override; | |
| 39 | |
| 40 void Init(); | |
| 41 | |
| 42 void SetStateProgress(HomeCard::State from_state, | |
| 43 HomeCard::State to_state, | |
| 44 float progress); | |
| 45 | |
| 46 void SetStateWithAnimation(HomeCard::State state, | |
| 47 gfx::Tween::Type tween_type, | |
| 48 const base::Closure& on_animation_ended); | |
| 49 | |
| 50 void ClearGesture(); | |
| 51 | |
| 52 // views::View: | |
| 53 void OnGestureEvent(ui::GestureEvent* event) override; | |
| 54 bool OnMousePressed(const ui::MouseEvent& event) override; | |
| 55 void Layout() override; | |
| 56 | |
| 57 private: | |
| 58 FRIEND_TEST_ALL_PREFIXES(HomeCardTest, AppListStates); | |
| 59 | |
| 60 gfx::Rect GetDragIndicatorBounds(HomeCard::State state); | |
| 61 | |
| 62 gfx::Rect GetMainViewBounds(HomeCard::State state); | |
| 63 | |
| 64 void UpdateMinimizedBackgroundVisibility(); | |
| 65 | |
| 66 // views::WidgetDelegate: | |
| 67 views::View* GetContentsView() override; | |
| 68 | |
| 69 views::View* background_; | |
| 70 app_list::AppListMainView* main_view_; | |
| 71 app_list::SearchBoxView* search_box_view_; | |
| 72 views::View* minimized_background_; | |
| 73 views::View* drag_indicator_; | |
| 74 HomeCard::State state_; | |
| 75 scoped_ptr<HomeCardGestureManager> gesture_manager_; | |
| 76 HomeCardGestureManager::Delegate* gesture_delegate_; | |
| 77 | |
| 78 base::WeakPtrFactory<HomeCardView> weak_factory_; | |
| 79 | |
| 80 DISALLOW_COPY_AND_ASSIGN(HomeCardView); | |
| 81 }; | |
| 82 | |
| 83 } // namespace athena | |
| 84 | |
| 85 #endif // ATHENA_HOME_CARD_VIEW_H_ | |
| OLD | NEW |