| 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_ITEM_CONTROLLER
_H_ | 5 #ifndef CHROME_BROWSER_UI_ASH_LAUNCHER_ARC_APP_DEFERRED_LAUNCHER_ITEM_CONTROLLER
_H_ |
| 6 #define CHROME_BROWSER_UI_ASH_LAUNCHER_ARC_APP_DEFERRED_LAUNCHER_ITEM_CONTROLLER
_H_ | 6 #define CHROME_BROWSER_UI_ASH_LAUNCHER_ARC_APP_DEFERRED_LAUNCHER_ITEM_CONTROLLER
_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "ash/public/cpp/shelf_item_delegate.h" |
| 10 #include "base/macros.h" | 11 #include "base/macros.h" |
| 11 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 12 #include "base/time/time.h" | 13 #include "base/time/time.h" |
| 13 #include "chrome/browser/ui/ash/launcher/launcher_item_controller.h" | |
| 14 | 14 |
| 15 class ArcAppDeferredLauncherController; | 15 class ArcAppDeferredLauncherController; |
| 16 class ChromeLauncherController; | |
| 17 | 16 |
| 18 // ArcAppDeferredLauncherItemController displays the icon of the ARC app that | 17 // ArcAppDeferredLauncherItemController displays the icon of the ARC app that |
| 19 // cannot be launched immediately (due to ARC not being ready) on Chrome OS' | 18 // cannot be launched immediately (due to ARC not being ready) on Chrome OS' |
| 20 // shelf, with an overlaid spinner to provide visual feedback. | 19 // shelf, with an overlaid spinner to provide visual feedback. |
| 21 class ArcAppDeferredLauncherItemController : public LauncherItemController { | 20 class ArcAppDeferredLauncherItemController : public ash::ShelfItemDelegate { |
| 22 public: | 21 public: |
| 23 ArcAppDeferredLauncherItemController( | 22 ArcAppDeferredLauncherItemController( |
| 24 const std::string& arc_app_id, | 23 const std::string& arc_app_id, |
| 25 ChromeLauncherController* controller, | |
| 26 int event_flags, | 24 int event_flags, |
| 27 const base::WeakPtr<ArcAppDeferredLauncherController>& host); | 25 const base::WeakPtr<ArcAppDeferredLauncherController>& host); |
| 28 | 26 |
| 29 ~ArcAppDeferredLauncherItemController() override; | 27 ~ArcAppDeferredLauncherItemController() override; |
| 30 | 28 |
| 31 base::TimeDelta GetActiveTime() const; | 29 base::TimeDelta GetActiveTime() const; |
| 32 | 30 |
| 33 int event_flags() const { return event_flags_; } | 31 int event_flags() const { return event_flags_; } |
| 34 | 32 |
| 35 // LauncherItemController: | 33 // ash::ShelfItemDelegate: |
| 36 void ItemSelected(std::unique_ptr<ui::Event> event, | 34 void ItemSelected(std::unique_ptr<ui::Event> event, |
| 37 int64_t display_id, | 35 int64_t display_id, |
| 38 ash::ShelfLaunchSource source, | 36 ash::ShelfLaunchSource source, |
| 39 const ItemSelectedCallback& callback) override; | 37 const ItemSelectedCallback& callback) override; |
| 40 void ExecuteCommand(uint32_t command_id, int32_t event_flags) override; | 38 void ExecuteCommand(uint32_t command_id, int32_t event_flags) override; |
| 41 void Close() override; | 39 void Close() override; |
| 42 | 40 |
| 43 private: | 41 private: |
| 44 // The flags of the event that caused the ARC app to be activated. These will | 42 // The flags of the event that caused the ARC app to be activated. These will |
| 45 // be propagated to the launch event once the app is actually launched. | 43 // be propagated to the launch event once the app is actually launched. |
| 46 const int event_flags_; | 44 const int event_flags_; |
| 47 | 45 |
| 48 base::WeakPtr<ArcAppDeferredLauncherController> host_; | 46 base::WeakPtr<ArcAppDeferredLauncherController> host_; |
| 49 const base::Time start_time_; | 47 const base::Time start_time_; |
| 50 | 48 |
| 51 DISALLOW_COPY_AND_ASSIGN(ArcAppDeferredLauncherItemController); | 49 DISALLOW_COPY_AND_ASSIGN(ArcAppDeferredLauncherItemController); |
| 52 }; | 50 }; |
| 53 | 51 |
| 54 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_ARC_APP_DEFERRED_LAUNCHER_ITEM_CONTROL
LER_H_ | 52 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_ARC_APP_DEFERRED_LAUNCHER_ITEM_CONTROL
LER_H_ |
| OLD | NEW |