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

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: clicking out of the app list widget will now close the widget 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"
9 #include "ui/app_list/presenter/app_list_presenter.h"
mfomitchev 2016/09/29 18:38:26 You already forward declare this, why do you also
thanhph 2016/09/29 19:43:05 I'm not sure where I forward declare this. Can you
mfomitchev 2016/09/29 20:00:36 Put the include in the .cc. Forward declaration is
thanhph 2016/09/29 20:42:51 I understand. Thanks!
8 #include "ui/app_list/presenter/app_list_presenter_delegate.h" 10 #include "ui/app_list/presenter/app_list_presenter_delegate.h"
9 11 #include "ui/views/mus/pointer_watcher_event_router.h"
mfomitchev 2016/09/29 18:38:26 Why do we need this?
thanhph 2016/09/29 19:43:04 We need this for receiving mouse/touch callback ev
mfomitchev 2016/09/29 20:00:36 Oh, ok, I see we are using PointerWatcherEventRout
thanhph 2016/09/29 20:42:51 Ok. Done!
10 #include "base/macros.h" 12 #include "ui/views/pointer_watcher.h"
11 13
12 namespace app_list { 14 namespace app_list {
13 class AppListView; 15 class AppListView;
16 class AppListPresenter;
14 class AppListViewDelegateFactory; 17 class AppListViewDelegateFactory;
15 } 18 }
16 19
17 // Mus+ash implementation of AppListPresetnerDelegate. 20 // Mus+ash implementation of AppListPresetnerDelegate.
18 // Responsible for laying out the app list UI as well as dismissing the app list 21 // 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 22 // on in response to certain events (e.g. on mouse/touch gesture outside of the
20 // app list bounds). 23 // app list bounds).
21 class AppListPresenterDelegateMus : public app_list::AppListPresenterDelegate { 24 class AppListPresenterDelegateMus : public app_list::AppListPresenterDelegate,
25 public views::PointerWatcher {
22 public: 26 public:
23 explicit AppListPresenterDelegateMus( 27 explicit AppListPresenterDelegateMus(
28 app_list::AppListPresenter* presenter,
24 app_list::AppListViewDelegateFactory* view_delegate_factory); 29 app_list::AppListViewDelegateFactory* view_delegate_factory);
30
25 ~AppListPresenterDelegateMus() override; 31 ~AppListPresenterDelegateMus() override;
26 32
27 // app_list::AppListPresenterDelegate: 33 // app_list::AppListPresenterDelegate:
28 app_list::AppListViewDelegate* GetViewDelegate() override; 34 app_list::AppListViewDelegate* GetViewDelegate() override;
29 void Init(app_list::AppListView* view, 35 void Init(app_list::AppListView* view,
30 int64_t display_id, 36 int64_t display_id,
31 int current_apps_page) override; 37 int current_apps_page) override;
32 void OnShown(int64_t display_id) override; 38 void OnShown(int64_t display_id) override;
33 void OnDismissed() override; 39 void OnDismissed() override;
34 void UpdateBounds() override; 40 void UpdateBounds() override;
41
35 gfx::Vector2d GetVisibilityAnimationOffset( 42 gfx::Vector2d GetVisibilityAnimationOffset(
36 aura::Window* root_window) override; 43 aura::Window* root_window) override;
37 44
45 void OnPointerEventObserved(const ui::PointerEvent& event,
mfomitchev 2016/09/29 18:38:26 // views::PointerWatcher: Also move to private.
thanhph 2016/09/29 19:43:04 done. thanks!
mfomitchev 2016/09/29 20:00:36 You forgot the comment.
thanhph 2016/09/29 20:42:51 My bad. Comment is added!
46 const gfx::Point& location_in_screen,
47 views::Widget* target) override;
48
38 private: 49 private:
39 // Whether the app list is visible (or in the process of being shown). 50 // Whether the app list is visible (or in the process of being shown).
40 bool is_visible_ = false; 51 bool is_visible_ = false;
41 52
42 // Not owned. Pointer is guaranteed to be valid while this object is alive. 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
59 app_list::AppListPresenter* presenter_;
mfomitchev 2016/09/29 18:38:26 // Not owned. Pointer is guaranteed to be valid wh
thanhph 2016/09/29 19:43:05 done. thanks!
60
48 DISALLOW_COPY_AND_ASSIGN(AppListPresenterDelegateMus); 61 DISALLOW_COPY_AND_ASSIGN(AppListPresenterDelegateMus);
49 }; 62 };
50 63
51 #endif // CHROME_BROWSER_UI_ASH_APP_LIST_APP_LIST_PRESENTER_DELEGATE_MUS_H_ 64 #endif // CHROME_BROWSER_UI_ASH_APP_LIST_APP_LIST_PRESENTER_DELEGATE_MUS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698