OLD | NEW |
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_LAUNCHER_ARC_APP_DEFERRED_LAUNCHER_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_ASH_LAUNCHER_ARC_APP_DEFERRED_LAUNCHER_CONTROLLER_H_ |
6 #define CHROME_BROWSER_UI_ASH_LAUNCHER_ARC_APP_DEFERRED_LAUNCHER_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_ASH_LAUNCHER_ARC_APP_DEFERRED_LAUNCHER_CONTROLLER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
14 #include "chrome/browser/chromeos/arc/arc_session_manager.h" | 14 #include "chrome/browser/chromeos/arc/arc_session_manager.h" |
15 #include "chrome/browser/ui/app_list/arc/arc_app_icon_loader.h" | 15 #include "chrome/browser/ui/app_list/arc/arc_app_icon_loader.h" |
16 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" | 16 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" |
17 | 17 |
18 class ArcAppDeferredLauncherItemController; | 18 class ArcAppDeferredLauncherItemController; |
19 class ChromeLauncherControllerImpl; | 19 class ChromeLauncherController; |
20 | 20 |
21 // ArcAppDeferredLauncherController displays visual feedback that the ARC | 21 // ArcAppDeferredLauncherController displays visual feedback that the ARC |
22 // application the user has just activated is waiting for ARC to be ready, and | 22 // application the user has just activated is waiting for ARC to be ready, and |
23 // will be asynchronously launched as soon as it can. | 23 // will be asynchronously launched as soon as it can. |
24 class ArcAppDeferredLauncherController | 24 class ArcAppDeferredLauncherController |
25 : public ArcAppListPrefs::Observer, | 25 : public ArcAppListPrefs::Observer, |
26 public arc::ArcSessionManager::Observer { | 26 public arc::ArcSessionManager::Observer { |
27 public: | 27 public: |
28 explicit ArcAppDeferredLauncherController( | 28 explicit ArcAppDeferredLauncherController(ChromeLauncherController* owner); |
29 ChromeLauncherControllerImpl* owner); | |
30 ~ArcAppDeferredLauncherController() override; | 29 ~ArcAppDeferredLauncherController() override; |
31 | 30 |
32 bool HasApp(const std::string& app_id) const; | 31 bool HasApp(const std::string& app_id) const; |
33 | 32 |
34 base::TimeDelta GetActiveTime(const std::string& app_id) const; | 33 base::TimeDelta GetActiveTime(const std::string& app_id) const; |
35 | 34 |
36 // Registers deferred ARC app launch. |app_id| is the app to be launched, and | 35 // Registers deferred ARC app launch. |app_id| is the app to be launched, and |
37 // |event_flags| describes the original event flags that triggered the app's | 36 // |event_flags| describes the original event flags that triggered the app's |
38 // activation. | 37 // activation. |
39 void RegisterDeferredLaunch(const std::string& app_id, int event_flags); | 38 void RegisterDeferredLaunch(const std::string& app_id, int event_flags); |
(...skipping 19 matching lines...) Expand all Loading... |
59 private: | 58 private: |
60 // Defines mapping of a shelf app id to a corresponded controller. Shelf app | 59 // Defines mapping of a shelf app id to a corresponded controller. Shelf app |
61 // id is optional mapping (for example, Play Store to ARC Host Support). | 60 // id is optional mapping (for example, Play Store to ARC Host Support). |
62 using AppControllerMap = | 61 using AppControllerMap = |
63 std::map<std::string, ArcAppDeferredLauncherItemController*>; | 62 std::map<std::string, ArcAppDeferredLauncherItemController*>; |
64 | 63 |
65 void UpdateApps(); | 64 void UpdateApps(); |
66 void RegisterNextUpdate(); | 65 void RegisterNextUpdate(); |
67 | 66 |
68 // Unowned pointers. | 67 // Unowned pointers. |
69 ChromeLauncherControllerImpl* owner_; | 68 ChromeLauncherController* owner_; |
70 Profile* observed_profile_ = nullptr; | 69 Profile* observed_profile_ = nullptr; |
71 | 70 |
72 AppControllerMap app_controller_map_; | 71 AppControllerMap app_controller_map_; |
73 | 72 |
74 // Always keep this the last member of this class. | 73 // Always keep this the last member of this class. |
75 base::WeakPtrFactory<ArcAppDeferredLauncherController> weak_ptr_factory_; | 74 base::WeakPtrFactory<ArcAppDeferredLauncherController> weak_ptr_factory_; |
76 | 75 |
77 DISALLOW_COPY_AND_ASSIGN(ArcAppDeferredLauncherController); | 76 DISALLOW_COPY_AND_ASSIGN(ArcAppDeferredLauncherController); |
78 }; | 77 }; |
79 | 78 |
80 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_ARC_APP_DEFERRED_LAUNCHER_CONTROLLER_H
_ | 79 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_ARC_APP_DEFERRED_LAUNCHER_CONTROLLER_H
_ |
OLD | NEW |