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

Side by Side Diff: chrome/browser/ui/ash/app_list/app_list_presenter_delegate_mus.h

Issue 2364173002: Add app_list_presenterr pointer in app_list_presenter_delegate_mus to use dismiss function (Closed)
Patch Set: Reduce overhead by adding/removing delegate in OnDismissed and OnShown, flip variable is_visible ac… Created 4 years, 2 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_ASH_APP_LIST_APP_LIST_PRESENTER_DELEGATE_MUS_H_ 5 #ifndef CHROME_BROWSER_UI_ASH_APP_LIST_APP_LIST_PRESENTER_DELEGATE_MUS_H_
6 #define CHROME_BROWSER_UI_ASH_APP_LIST_APP_LIST_PRESENTER_DELEGATE_MUS_H_ 6 #define CHROME_BROWSER_UI_ASH_APP_LIST_APP_LIST_PRESENTER_DELEGATE_MUS_H_
7 7
8 #include "base/macros.h"
8 #include "ui/app_list/presenter/app_list_presenter_delegate.h" 9 #include "ui/app_list/presenter/app_list_presenter_delegate.h"
9 10 #include "ui/views/pointer_watcher.h"
10 #include "base/macros.h"
11 11
12 namespace app_list { 12 namespace app_list {
13 class AppListView; 13 class AppListView;
14 class AppListPresenter;
mfomitchev 2016/09/30 18:41:19 Forward declarations should be ordered alphabetica
thanhph 2016/09/30 19:03:52 good catch. git cl format doesn't catch this i thi
14 class AppListViewDelegateFactory; 15 class AppListViewDelegateFactory;
15 } 16 } // namespace app_list
16 17
17 // Mus+ash implementation of AppListPresetnerDelegate. 18 // Mus+ash implementation of AppListPresetnerDelegate.
18 // Responsible for laying out the app list UI as well as dismissing the app list 19 // Responsible for laying out the app list UI as well as dismissing the app list
19 // on in response to certain events (e.g. on mouse/touch gesture outside of the 20 // on in response to certain events (e.g. on mouse/touch gesture outside of the
20 // app list bounds). 21 // app list bounds).
21 class AppListPresenterDelegateMus : public app_list::AppListPresenterDelegate { 22 class AppListPresenterDelegateMus : public app_list::AppListPresenterDelegate,
23 public views::PointerWatcher {
22 public: 24 public:
23 explicit AppListPresenterDelegateMus( 25 AppListPresenterDelegateMus(
26 app_list::AppListPresenter* presenter,
24 app_list::AppListViewDelegateFactory* view_delegate_factory); 27 app_list::AppListViewDelegateFactory* view_delegate_factory);
25 ~AppListPresenterDelegateMus() override; 28 ~AppListPresenterDelegateMus() override;
26 29
27 // app_list::AppListPresenterDelegate: 30 // app_list::AppListPresenterDelegate:
28 app_list::AppListViewDelegate* GetViewDelegate() override; 31 app_list::AppListViewDelegate* GetViewDelegate() override;
29 void Init(app_list::AppListView* view, 32 void Init(app_list::AppListView* view,
30 int64_t display_id, 33 int64_t display_id,
31 int current_apps_page) override; 34 int current_apps_page) override;
32 void OnShown(int64_t display_id) override; 35 void OnShown(int64_t display_id) override;
33 void OnDismissed() override; 36 void OnDismissed() override;
34 void UpdateBounds() override; 37 void UpdateBounds() override;
35 gfx::Vector2d GetVisibilityAnimationOffset( 38 gfx::Vector2d GetVisibilityAnimationOffset(
36 aura::Window* root_window) override; 39 aura::Window* root_window) override;
37 40
38 private: 41 private:
42 // views::PointerWatcher:
43 void OnPointerEventObserved(const ui::PointerEvent& event,
44 const gfx::Point& location_in_screen,
45 views::Widget* target) override;
46
39 // Whether the app list is visible (or in the process of being shown). 47 // Whether the app list is visible (or in the process of being shown).
40 bool is_visible_ = false; 48 bool is_visible_ = false;
41 49
42 // Not owned. Pointer is guaranteed to be valid while this object is alive. 50 // Not owned. Pointer is guaranteed to be valid while this object is alive.
51 app_list::AppListPresenter* presenter_;
52
53 // Not owned. Pointer is guaranteed to be valid while this object is alive.
43 app_list::AppListViewDelegateFactory* view_delegate_factory_; 54 app_list::AppListViewDelegateFactory* view_delegate_factory_;
44 55
45 // The current AppListView, owned by its widget. 56 // The current AppListView, owned by its widget.
46 app_list::AppListView* view_ = nullptr; 57 app_list::AppListView* view_ = nullptr;
47 58
48 DISALLOW_COPY_AND_ASSIGN(AppListPresenterDelegateMus); 59 DISALLOW_COPY_AND_ASSIGN(AppListPresenterDelegateMus);
49 }; 60 };
50 61
51 #endif // CHROME_BROWSER_UI_ASH_APP_LIST_APP_LIST_PRESENTER_DELEGATE_MUS_H_ 62 #endif // CHROME_BROWSER_UI_ASH_APP_LIST_APP_LIST_PRESENTER_DELEGATE_MUS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698