| 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 | 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/chromeos/arc/arc_session_manager.h" |
| 14 #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" |
| 15 #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" |
| 16 | 16 |
| 17 class ArcAppDeferredLauncherItemController; | 17 class ArcAppDeferredLauncherItemController; |
| 18 class ChromeLauncherControllerImpl; | 18 class ChromeLauncherControllerImpl; |
| 19 | 19 |
| 20 class ArcAppDeferredLauncherController : public ArcAppListPrefs::Observer, | 20 class ArcAppDeferredLauncherController |
| 21 public arc::ArcAuthService::Observer { | 21 : public ArcAppListPrefs::Observer, |
| 22 public arc::ArcSessionManager::Observer { |
| 22 public: | 23 public: |
| 23 explicit ArcAppDeferredLauncherController( | 24 explicit ArcAppDeferredLauncherController( |
| 24 ChromeLauncherControllerImpl* owner); | 25 ChromeLauncherControllerImpl* owner); |
| 25 ~ArcAppDeferredLauncherController() override; | 26 ~ArcAppDeferredLauncherController() override; |
| 26 | 27 |
| 27 bool HasApp(const std::string& app_id) const; | 28 bool HasApp(const std::string& app_id) const; |
| 28 | 29 |
| 29 base::TimeDelta GetActiveTime(const std::string& app_id) const; | 30 base::TimeDelta GetActiveTime(const std::string& app_id) const; |
| 30 | 31 |
| 31 // Registers deferred Arc app launch. | 32 // Registers deferred Arc app launch. |
| 32 void RegisterDeferredLaunch(const std::string& app_id); | 33 void RegisterDeferredLaunch(const std::string& app_id); |
| 33 | 34 |
| 34 // Applies spinning effect if requested app is handled by deferred controller. | 35 // Applies spinning effect if requested app is handled by deferred controller. |
| 35 void MaybeApplySpinningEffect(const std::string& app_id, | 36 void MaybeApplySpinningEffect(const std::string& app_id, |
| 36 gfx::ImageSkia* image); | 37 gfx::ImageSkia* image); |
| 37 | 38 |
| 38 // ArcAppListPrefs::Observer: | 39 // ArcAppListPrefs::Observer: |
| 39 void OnAppReadyChanged(const std::string& app_id, bool ready) override; | 40 void OnAppReadyChanged(const std::string& app_id, bool ready) override; |
| 40 void OnAppRemoved(const std::string& app_id) override; | 41 void OnAppRemoved(const std::string& app_id) override; |
| 41 | 42 |
| 42 // arc::ArcAuthService::Observer: | 43 // arc::ArcSessionManager::Observer: |
| 43 void OnOptInEnabled(bool enabled) override; | 44 void OnOptInEnabled(bool enabled) override; |
| 44 | 45 |
| 45 // Removes entry from the list of tracking items. | 46 // Removes entry from the list of tracking items. |
| 46 void Remove(const std::string& app_id); | 47 void Remove(const std::string& app_id); |
| 47 | 48 |
| 48 // Closes Shelf item if it has ArcAppDeferredLauncherItemController controller | 49 // Closes Shelf item if it has ArcAppDeferredLauncherItemController controller |
| 49 // and removes entry from the list of tracking items. | 50 // and removes entry from the list of tracking items. |
| 50 void Close(const std::string& app_id); | 51 void Close(const std::string& app_id); |
| 51 | 52 |
| 52 private: | 53 private: |
| (...skipping 11 matching lines...) Expand all Loading... |
| 64 | 65 |
| 65 AppControllerMap app_controller_map_; | 66 AppControllerMap app_controller_map_; |
| 66 | 67 |
| 67 // Always keep this the last member of this class. | 68 // Always keep this the last member of this class. |
| 68 base::WeakPtrFactory<ArcAppDeferredLauncherController> weak_ptr_factory_; | 69 base::WeakPtrFactory<ArcAppDeferredLauncherController> weak_ptr_factory_; |
| 69 | 70 |
| 70 DISALLOW_COPY_AND_ASSIGN(ArcAppDeferredLauncherController); | 71 DISALLOW_COPY_AND_ASSIGN(ArcAppDeferredLauncherController); |
| 71 }; | 72 }; |
| 72 | 73 |
| 73 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_ARC_APP_DEFERRED_LAUNCHER_CONTROLLER_H
_ | 74 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_ARC_APP_DEFERRED_LAUNCHER_CONTROLLER_H
_ |
| OLD | NEW |