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

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

Issue 1951523002: Add basic support for launching mash shelf pinned apps. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Only LaunchItem with no windows; otherwise kNoAction (for CreateApplicationMenu). Created 4 years, 7 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_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 "chrome/browser/ui/app_icon_loader.h" 13 #include "chrome/browser/ui/app_icon_loader.h"
14 #include "chrome/browser/ui/ash/launcher/launcher_controller_helper.h"
14 #include "mash/shelf/public/interfaces/shelf.mojom.h" 15 #include "mash/shelf/public/interfaces/shelf.mojom.h"
15 #include "mojo/public/cpp/bindings/associated_binding.h" 16 #include "mojo/public/cpp/bindings/associated_binding.h"
16 17
17 class ChromeShelfItemDelegate; 18 class ChromeShelfItemDelegate;
18 19
19 // ChromeMashShelfController manages chrome's interaction with the mash shelf. 20 // ChromeMashShelfController manages chrome's interaction with the mash shelf.
20 class ChromeMashShelfController : public mash::shelf::mojom::ShelfObserver, 21 class ChromeMashShelfController : public mash::shelf::mojom::ShelfObserver,
21 public AppIconLoaderDelegate { 22 public AppIconLoaderDelegate {
22 public: 23 public:
23 ~ChromeMashShelfController() override; 24 ~ChromeMashShelfController() override;
24 25
25 // Creates an instance. 26 // Creates an instance.
26 static ChromeMashShelfController* CreateInstance(); 27 static ChromeMashShelfController* CreateInstance();
27 28
28 // Returns the single ChromeMashShelfController instance. 29 // Returns the single ChromeMashShelfController instance.
29 static ChromeMashShelfController* instance() { return instance_; } 30 static ChromeMashShelfController* instance() { return instance_; }
30 31
32 void LaunchItem(const std::string& app_id);
33
31 private: 34 private:
32 ChromeMashShelfController(); 35 ChromeMashShelfController();
33 36
34 void Init(); 37 void Init();
35 38
36 void PinAppsFromPrefs(); 39 void PinAppsFromPrefs();
37 40
38 AppIconLoader* GetAppIconLoaderForApp(const std::string& app_id); 41 AppIconLoader* GetAppIconLoaderForApp(const std::string& app_id);
39 42
40 // mash::shelf::mojom::ShelfObserver: 43 // mash::shelf::mojom::ShelfObserver:
41 void OnAlignmentChanged(mash::shelf::mojom::Alignment alignment) override; 44 void OnAlignmentChanged(mash::shelf::mojom::Alignment alignment) override;
42 void OnAutoHideBehaviorChanged( 45 void OnAutoHideBehaviorChanged(
43 mash::shelf::mojom::AutoHideBehavior auto_hide) override; 46 mash::shelf::mojom::AutoHideBehavior auto_hide) override;
44 47
45 // AppIconLoaderDelegate: 48 // AppIconLoaderDelegate:
46 void OnAppImageUpdated(const std::string& app_id, 49 void OnAppImageUpdated(const std::string& app_id,
47 const gfx::ImageSkia& image) override; 50 const gfx::ImageSkia& image) override;
48 51
49 static ChromeMashShelfController* instance_; 52 static ChromeMashShelfController* instance_;
50 53
54 LauncherControllerHelper helper_;
51 mash::shelf::mojom::ShelfControllerPtr shelf_controller_; 55 mash::shelf::mojom::ShelfControllerPtr shelf_controller_;
52 mojo::AssociatedBinding<mash::shelf::mojom::ShelfObserver> observer_binding_; 56 mojo::AssociatedBinding<mash::shelf::mojom::ShelfObserver> observer_binding_;
53 std::map<std::string, std::unique_ptr<ChromeShelfItemDelegate>> 57 std::map<std::string, std::unique_ptr<ChromeShelfItemDelegate>>
54 app_id_to_item_delegate_; 58 app_id_to_item_delegate_;
55 59
56 // Used to load the images for app items. 60 // Used to load the images for app items.
57 std::vector<std::unique_ptr<AppIconLoader>> app_icon_loaders_; 61 std::vector<std::unique_ptr<AppIconLoader>> app_icon_loaders_;
58 62
59 DISALLOW_COPY_AND_ASSIGN(ChromeMashShelfController); 63 DISALLOW_COPY_AND_ASSIGN(ChromeMashShelfController);
60 }; 64 };
61 65
62 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_MASH_SHELF_CONTROLLER_H_ 66 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_MASH_SHELF_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698