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