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

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

Issue 2322353002: [Merge-M53] arc: Add support of default and OEM apps. (Closed)
Patch Set: Created 4 years, 3 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/chromeos/arc/arc_auth_service.h"
13 #include "chrome/browser/ui/app_list/arc/arc_app_icon_loader.h" 14 #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" 15 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h"
15 16
16 class ArcAppDeferredLauncherItemController; 17 class ArcAppDeferredLauncherItemController;
17 class ChromeLauncherControllerImpl; 18 class ChromeLauncherControllerImpl;
18 19
19 class ArcAppDeferredLauncherController : public ArcAppListPrefs::Observer { 20 class ArcAppDeferredLauncherController : public ArcAppListPrefs::Observer,
21 public arc::ArcAuthService::Observer {
20 public: 22 public:
21 explicit ArcAppDeferredLauncherController( 23 explicit ArcAppDeferredLauncherController(
22 ChromeLauncherControllerImpl* owner); 24 ChromeLauncherControllerImpl* owner);
23 ~ArcAppDeferredLauncherController() override; 25 ~ArcAppDeferredLauncherController() override;
24 26
27 bool HasApp(const std::string& app_id) const;
28
25 base::TimeDelta GetActiveTime(const std::string& app_id) const; 29 base::TimeDelta GetActiveTime(const std::string& app_id) const;
26 30
27 // Registers deferred Arc app launch. 31 // Registers deferred Arc app launch.
28 void RegisterDeferredLaunch(const std::string& app_id); 32 void RegisterDeferredLaunch(const std::string& app_id);
29 33
30 // Applies spinning effect if requested app is handled by deferred controller. 34 // Applies spinning effect if requested app is handled by deferred controller.
31 void MaybeApplySpinningEffect(const std::string& app_id, 35 void MaybeApplySpinningEffect(const std::string& app_id,
32 gfx::ImageSkia* image); 36 gfx::ImageSkia* image);
33 37
34 // ArcAppListPrefs::Observer: 38 // ArcAppListPrefs::Observer:
35 void OnAppReadyChanged(const std::string& app_id, bool ready) override; 39 void OnAppReadyChanged(const std::string& app_id, bool ready) override;
36 void OnAppRemoved(const std::string& app_id) override; 40 void OnAppRemoved(const std::string& app_id) override;
37 41
38 // Close Shelf item if it has ArcAppDeferredLauncherItemController controller 42 // arc::ArcAuthService::Observer:
39 // and remove entry from the list of tracking items. 43 void OnOptInEnabled(bool enabled) override;
44
45 // Removes entry from the list of tracking items.
46 void Remove(const std::string& app_id);
47
48 // Closes Shelf item if it has ArcAppDeferredLauncherItemController controller
49 // and removes entry from the list of tracking items.
40 void Close(const std::string& app_id); 50 void Close(const std::string& app_id);
41 51
42 private: 52 private:
43 using AppControllerMap = 53 using AppControllerMap =
44 std::map<std::string, ArcAppDeferredLauncherItemController*>; 54 std::map<std::string, ArcAppDeferredLauncherItemController*>;
45 55
46 void UpdateApps(); 56 void UpdateApps();
47 void RegisterNextUpdate(); 57 void RegisterNextUpdate();
48 58
49 // Unowned pointers. 59 // Unowned pointers.
50 ChromeLauncherControllerImpl* owner_; 60 ChromeLauncherControllerImpl* owner_;
51 Profile* observed_profile_ = nullptr; 61 Profile* observed_profile_ = nullptr;
52 62
53 AppControllerMap app_controller_map_; 63 AppControllerMap app_controller_map_;
54 64
55 // Always keep this the last member of this class. 65 // Always keep this the last member of this class.
56 base::WeakPtrFactory<ArcAppDeferredLauncherController> weak_ptr_factory_; 66 base::WeakPtrFactory<ArcAppDeferredLauncherController> weak_ptr_factory_;
57 67
58 DISALLOW_COPY_AND_ASSIGN(ArcAppDeferredLauncherController); 68 DISALLOW_COPY_AND_ASSIGN(ArcAppDeferredLauncherController);
59 }; 69 };
60 70
61 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_ARC_APP_DEFERRED_LAUNCHER_CONTROLLER_H _ 71 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_ARC_APP_DEFERRED_LAUNCHER_CONTROLLER_H _
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698