| 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_CHROME_MASH_SHELF_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_MASH_SHELF_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_MASH_SHELF_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_MASH_SHELF_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "ash/public/interfaces/shelf.mojom.h" |
| 13 #include "chrome/browser/ui/app_icon_loader.h" | 14 #include "chrome/browser/ui/app_icon_loader.h" |
| 14 #include "chrome/browser/ui/ash/launcher/launcher_controller_helper.h" | 15 #include "chrome/browser/ui/ash/launcher/launcher_controller_helper.h" |
| 15 #include "mash/shelf/public/interfaces/shelf.mojom.h" | |
| 16 #include "mojo/public/cpp/bindings/associated_binding.h" | 16 #include "mojo/public/cpp/bindings/associated_binding.h" |
| 17 | 17 |
| 18 class ChromeShelfItemDelegate; | 18 class ChromeShelfItemDelegate; |
| 19 | 19 |
| 20 // ChromeMashShelfController manages chrome's interaction with the mash shelf. | 20 // ChromeMashShelfController manages chrome's interaction with the mash shelf. |
| 21 class ChromeMashShelfController : public mash::shelf::mojom::ShelfObserver, | 21 class ChromeMashShelfController : public ash::mojom::ShelfObserver, |
| 22 public AppIconLoaderDelegate { | 22 public AppIconLoaderDelegate { |
| 23 public: | 23 public: |
| 24 ChromeMashShelfController(); | 24 ChromeMashShelfController(); |
| 25 ~ChromeMashShelfController() override; | 25 ~ChromeMashShelfController() override; |
| 26 | 26 |
| 27 void LaunchItem(const std::string& app_id); | 27 void LaunchItem(const std::string& app_id); |
| 28 | 28 |
| 29 private: | 29 private: |
| 30 void Init(); | 30 void Init(); |
| 31 | 31 |
| 32 void PinAppsFromPrefs(); | 32 void PinAppsFromPrefs(); |
| 33 | 33 |
| 34 AppIconLoader* GetAppIconLoaderForApp(const std::string& app_id); | 34 AppIconLoader* GetAppIconLoaderForApp(const std::string& app_id); |
| 35 | 35 |
| 36 // mash::shelf::mojom::ShelfObserver: | 36 // ash::mojom::ShelfObserver: |
| 37 void OnAlignmentChanged(mash::shelf::mojom::Alignment alignment) override; | 37 void OnShelfCreated(int64_t display_id) override; |
| 38 void OnAutoHideBehaviorChanged( | 38 void OnAlignmentChanged(ash::ShelfAlignment alignment, |
| 39 mash::shelf::mojom::AutoHideBehavior auto_hide) override; | 39 int64_t display_id) override; |
| 40 void OnAutoHideBehaviorChanged(ash::ShelfAutoHideBehavior auto_hide, |
| 41 int64_t display_id) override; |
| 40 | 42 |
| 41 // AppIconLoaderDelegate: | 43 // AppIconLoaderDelegate: |
| 42 void OnAppImageUpdated(const std::string& app_id, | 44 void OnAppImageUpdated(const std::string& app_id, |
| 43 const gfx::ImageSkia& image) override; | 45 const gfx::ImageSkia& image) override; |
| 44 | 46 |
| 45 LauncherControllerHelper helper_; | 47 LauncherControllerHelper helper_; |
| 46 mash::shelf::mojom::ShelfControllerPtr shelf_controller_; | 48 ash::mojom::ShelfControllerPtr shelf_controller_; |
| 47 mojo::AssociatedBinding<mash::shelf::mojom::ShelfObserver> observer_binding_; | 49 mojo::AssociatedBinding<ash::mojom::ShelfObserver> observer_binding_; |
| 48 std::map<std::string, std::unique_ptr<ChromeShelfItemDelegate>> | 50 std::map<std::string, std::unique_ptr<ChromeShelfItemDelegate>> |
| 49 app_id_to_item_delegate_; | 51 app_id_to_item_delegate_; |
| 50 | 52 |
| 51 // Used to load the images for app items. | 53 // Used to load the images for app items. |
| 52 std::vector<std::unique_ptr<AppIconLoader>> app_icon_loaders_; | 54 std::vector<std::unique_ptr<AppIconLoader>> app_icon_loaders_; |
| 53 | 55 |
| 54 DISALLOW_COPY_AND_ASSIGN(ChromeMashShelfController); | 56 DISALLOW_COPY_AND_ASSIGN(ChromeMashShelfController); |
| 55 }; | 57 }; |
| 56 | 58 |
| 57 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_MASH_SHELF_CONTROLLER_H_ | 59 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_MASH_SHELF_CONTROLLER_H_ |
| OLD | NEW |