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

Side by Side Diff: chrome/browser/ui/ash/launcher/arc_app_deferred_launcher_controller.h

Issue 2052013002: Adding ChromeLauncherController interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@chrome_launcher_smaller_api
Patch Set: Rebase Created 4 years, 6 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_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 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
12 #include "base/time/time.h" 12 #include "base/time/time.h"
13 #include "chrome/browser/ui/app_list/arc/arc_app_icon_loader.h" 13 #include "chrome/browser/ui/app_list/arc/arc_app_icon_loader.h"
14 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" 14 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h"
15 15
16 class ArcAppDeferredLauncherItemController; 16 class ArcAppDeferredLauncherItemController;
17 class ChromeLauncherController; 17 class ChromeLauncherControllerImpl;
18 18
19 class ArcAppDeferredLauncherController : public ArcAppListPrefs::Observer, 19 class ArcAppDeferredLauncherController : public ArcAppListPrefs::Observer,
20 public ArcAppIconLoader::PostEffect { 20 public ArcAppIconLoader::PostEffect {
21 public: 21 public:
22 explicit ArcAppDeferredLauncherController(ChromeLauncherController* owner); 22 explicit ArcAppDeferredLauncherController(
23 ChromeLauncherControllerImpl* owner);
23 ~ArcAppDeferredLauncherController() override; 24 ~ArcAppDeferredLauncherController() override;
24 25
25 base::TimeDelta GetActiveTime(const std::string& app_id) const; 26 base::TimeDelta GetActiveTime(const std::string& app_id) const;
26 27
27 // Register deferred Arc app launch. 28 // Register deferred Arc app launch.
28 void RegisterDeferredLaunch(const std::string& app_id); 29 void RegisterDeferredLaunch(const std::string& app_id);
29 30
30 // ArcAppIconLoader::PostEffect: 31 // ArcAppIconLoader::PostEffect:
31 void Apply(const std::string& app_id, gfx::ImageSkia* image) override; 32 void Apply(const std::string& app_id, gfx::ImageSkia* image) override;
32 33
33 // ArcAppListPrefs::Observer: 34 // ArcAppListPrefs::Observer:
34 void OnAppReadyChanged(const std::string& app_id, bool ready) override; 35 void OnAppReadyChanged(const std::string& app_id, bool ready) override;
35 void OnAppRemoved(const std::string& app_id) override; 36 void OnAppRemoved(const std::string& app_id) override;
36 37
37 // Close Shelf item if it has ArcAppDeferredLauncherItemController controller 38 // Close Shelf item if it has ArcAppDeferredLauncherItemController controller
38 // and remove entry from the list of tracking items. 39 // and remove entry from the list of tracking items.
39 void Close(const std::string& app_id); 40 void Close(const std::string& app_id);
40 41
41 private: 42 private:
42 using AppControllerMap = 43 using AppControllerMap =
43 std::map<std::string, ArcAppDeferredLauncherItemController*>; 44 std::map<std::string, ArcAppDeferredLauncherItemController*>;
44 45
45 void UpdateApps(); 46 void UpdateApps();
46 void RegisterNextUpdate(); 47 void RegisterNextUpdate();
47 48
48 // Unowned pointers. 49 // Unowned pointers.
49 ChromeLauncherController* owner_; 50 ChromeLauncherControllerImpl* owner_;
50 Profile* observed_profile_ = nullptr; 51 Profile* observed_profile_ = nullptr;
51 52
52 AppControllerMap app_controller_map_; 53 AppControllerMap app_controller_map_;
53 54
54 // Always keep this the last member of this class. 55 // Always keep this the last member of this class.
55 base::WeakPtrFactory<ArcAppDeferredLauncherController> weak_ptr_factory_; 56 base::WeakPtrFactory<ArcAppDeferredLauncherController> weak_ptr_factory_;
56 57
57 DISALLOW_COPY_AND_ASSIGN(ArcAppDeferredLauncherController); 58 DISALLOW_COPY_AND_ASSIGN(ArcAppDeferredLauncherController);
58 }; 59 };
59 60
60 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_ARC_APP_DEFERRED_LAUNCHER_CONTROLLER_H _ 61 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_ARC_APP_DEFERRED_LAUNCHER_CONTROLLER_H _
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698