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

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

Issue 2791803002: mash: Move LauncherItemController to ash, rename ShelfItemDelegate. (Closed)
Patch Set: Move shelf_item_delegate to ash/public/cpp, cleanup. Created 3 years, 8 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_LAUNCHER_CONTROLLER_H_ 5 #ifndef CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_H_ 6 #define CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "ash/public/cpp/app_launch_id.h" 12 #include "ash/public/cpp/app_launch_id.h"
13 #include "ash/public/cpp/shelf_item.h" 13 #include "ash/public/cpp/shelf_item.h"
14 #include "ash/public/cpp/shelf_item_delegate.h"
14 #include "ash/public/interfaces/shelf.mojom.h" 15 #include "ash/public/interfaces/shelf.mojom.h"
15 #include "base/auto_reset.h" 16 #include "base/auto_reset.h"
16 #include "chrome/browser/ui/app_icon_loader.h" 17 #include "chrome/browser/ui/app_icon_loader.h"
17 #include "chrome/browser/ui/app_icon_loader_delegate.h" 18 #include "chrome/browser/ui/app_icon_loader_delegate.h"
18 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" 19 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h"
19 #include "chrome/browser/ui/ash/launcher/launcher_item_controller.h"
20 #include "chrome/browser/ui/ash/launcher/settings_window_observer.h" 20 #include "chrome/browser/ui/ash/launcher/settings_window_observer.h"
21 #include "mojo/public/cpp/bindings/associated_binding.h" 21 #include "mojo/public/cpp/bindings/associated_binding.h"
22 22
23 class AccountId; 23 class AccountId;
24 class ArcAppDeferredLauncherController; 24 class ArcAppDeferredLauncherController;
25 class BrowserShortcutLauncherItemController; 25 class BrowserShortcutLauncherItemController;
26 class GURL; 26 class GURL;
27 class LauncherControllerHelper; 27 class LauncherControllerHelper;
28 28
29 namespace ash { 29 namespace ash {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 LauncherControllerHelper* launcher_controller_helper() { 68 LauncherControllerHelper* launcher_controller_helper() {
69 return launcher_controller_helper_.get(); 69 return launcher_controller_helper_.get();
70 } 70 }
71 71
72 ~ChromeLauncherController() override; 72 ~ChromeLauncherController() override;
73 73
74 // Initializes this ChromeLauncherController and calls OnInit. 74 // Initializes this ChromeLauncherController and calls OnInit.
75 void Init(); 75 void Init();
76 76
77 // Creates a new app item on the shelf for |controller|. 77 // Creates a new app item on the shelf for |controller|.
78 virtual ash::ShelfID CreateAppLauncherItem(LauncherItemController* controller, 78 virtual ash::ShelfID CreateAppLauncherItem(ash::ShelfItemDelegate* controller,
James Cook 2017/04/04 15:34:45 kinda weird that these item delegates are named "c
msw 2017/04/04 18:53:09 Done.
79 ash::ShelfItemStatus status) = 0; 79 ash::ShelfItemStatus status) = 0;
80 80
81 // Returns the shelf item with the given id, or null if |id| isn't found. 81 // Returns the shelf item with the given id, or null if |id| isn't found.
82 virtual const ash::ShelfItem* GetItem(ash::ShelfID id) const = 0; 82 virtual const ash::ShelfItem* GetItem(ash::ShelfID id) const = 0;
83 83
84 // Updates the type of an item. 84 // Updates the type of an item.
85 virtual void SetItemType(ash::ShelfID id, ash::ShelfItemType type) = 0; 85 virtual void SetItemType(ash::ShelfID id, ash::ShelfItemType type) = 0;
86 86
87 // Updates the running status of an item. It will also update the status of 87 // Updates the running status of an item. It will also update the status of
88 // browsers shelf item if needed. 88 // browsers shelf item if needed.
89 virtual void SetItemStatus(ash::ShelfID id, ash::ShelfItemStatus status) = 0; 89 virtual void SetItemStatus(ash::ShelfID id, ash::ShelfItemStatus status) = 0;
90 90
91 // Updates the controller associated with id (which should be a shortcut). 91 // Updates the controller associated with id (which should be a shortcut).
92 // Takes ownership of |controller|. 92 // Takes ownership of |controller|.
93 // TODO(skuhne): Pass in scoped_ptr to make ownership clear. 93 // TODO(skuhne): Pass in scoped_ptr to make ownership clear.
James Cook 2017/04/04 15:34:45 Is now a good time to resolve this TODO?
msw 2017/04/04 18:53:09 Done, but what a pain... this wasn't simple.
James Cook 2017/04/04 23:57:26 Thanks for doing it.
94 virtual void SetItemController(ash::ShelfID id, 94 virtual void SetItemController(ash::ShelfID id,
95 LauncherItemController* controller) = 0; 95 ash::ShelfItemDelegate* controller) = 0;
96 96
97 // Closes or unpins the shelf item. 97 // Closes or unpins the shelf item.
98 virtual void CloseLauncherItem(ash::ShelfID id) = 0; 98 virtual void CloseLauncherItem(ash::ShelfID id) = 0;
99 99
100 // Returns true if the item identified by |id| is pinned. 100 // Returns true if the item identified by |id| is pinned.
101 virtual bool IsPinned(ash::ShelfID id) = 0; 101 virtual bool IsPinned(ash::ShelfID id) = 0;
102 102
103 // Set the shelf item status for the V1 application with the given |app_id|. 103 // Set the shelf item status for the V1 application with the given |app_id|.
104 // Adds or removes an item as needed to respect the running and pinned state. 104 // Adds or removes an item as needed to respect the running and pinned state.
105 virtual void SetV1AppStatus(const std::string& app_id, 105 virtual void SetV1AppStatus(const std::string& app_id,
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 ui::BaseWindow* window, 158 ui::BaseWindow* window,
159 bool allow_minimize) = 0; 159 bool allow_minimize) = 0;
160 160
161 // Called when the active user has changed. 161 // Called when the active user has changed.
162 virtual void ActiveUserChanged(const std::string& user_email) = 0; 162 virtual void ActiveUserChanged(const std::string& user_email) = 0;
163 163
164 // Called when a user got added to the session. 164 // Called when a user got added to the session.
165 virtual void AdditionalUserAddedToSession(Profile* profile) = 0; 165 virtual void AdditionalUserAddedToSession(Profile* profile) = 0;
166 166
167 // Get the list of all running incarnations of this item. 167 // Get the list of all running incarnations of this item.
168 virtual MenuItemList GetAppMenuItemsForTesting( 168 virtual ash::MenuItemList GetAppMenuItemsForTesting(
169 const ash::ShelfItem& item) = 0; 169 const ash::ShelfItem& item) = 0;
170 170
171 // Get the list of all tabs which belong to a certain application type. 171 // Get the list of all tabs which belong to a certain application type.
172 virtual std::vector<content::WebContents*> GetV1ApplicationsFromAppId( 172 virtual std::vector<content::WebContents*> GetV1ApplicationsFromAppId(
173 const std::string& app_id) = 0; 173 const std::string& app_id) = 0;
174 174
175 // Activates a specified shell application by app id and window index. 175 // Activates a specified shell application by app id and window index.
176 virtual void ActivateShellApp(const std::string& app_id, 176 virtual void ActivateShellApp(const std::string& app_id,
177 int window_index) = 0; 177 int window_index) = 0;
178 178
(...skipping 12 matching lines...) Expand all
191 // Note that for incognito windows the incognito icon will be returned. 191 // Note that for incognito windows the incognito icon will be returned.
192 // If |web_contents| has not loaded, returns the default favicon. 192 // If |web_contents| has not loaded, returns the default favicon.
193 virtual gfx::Image GetAppListIcon( 193 virtual gfx::Image GetAppListIcon(
194 content::WebContents* web_contents) const = 0; 194 content::WebContents* web_contents) const = 0;
195 195
196 // Get the title for the applicatoin list entry for |web_contents|. 196 // Get the title for the applicatoin list entry for |web_contents|.
197 // If |web_contents| has not loaded, returns "Net Tab". 197 // If |web_contents| has not loaded, returns "Net Tab".
198 virtual base::string16 GetAppListTitle( 198 virtual base::string16 GetAppListTitle(
199 content::WebContents* web_contents) const = 0; 199 content::WebContents* web_contents) const = 0;
200 200
201 // Returns the LauncherItemController of BrowserShortcut. 201 // Returns the ash::ShelfItemDelegate of BrowserShortcut.
202 virtual BrowserShortcutLauncherItemController* 202 virtual BrowserShortcutLauncherItemController*
203 GetBrowserShortcutLauncherItemController() = 0; 203 GetBrowserShortcutLauncherItemController() = 0;
204 204
205 virtual LauncherItemController* GetLauncherItemController( 205 virtual ash::ShelfItemDelegate* GetLauncherItemController(
James Cook 2017/04/04 15:34:45 Likewise, continuing to call this GetLauncherItemC
msw 2017/04/04 18:53:09 Done. Sadly, these renames take time...
206 const ash::ShelfID id) = 0; 206 const ash::ShelfID id) = 0;
207 207
208 // Check if the shelf visibility (location, visibility) will change with a new 208 // Check if the shelf visibility (location, visibility) will change with a new
209 // user profile or not. However, since the full visibility calculation of the 209 // user profile or not. However, since the full visibility calculation of the
210 // shelf cannot be performed here, this is only a probability used for 210 // shelf cannot be performed here, this is only a probability used for
211 // animation predictions. 211 // animation predictions.
212 virtual bool ShelfBoundsChangesProbablyWithUser( 212 virtual bool ShelfBoundsChangesProbablyWithUser(
213 ash::WmShelf* shelf, 213 ash::WmShelf* shelf,
214 const AccountId& account_id) const = 0; 214 const AccountId& account_id) const = 0;
215 215
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 // An observer that manages the shelf title and icon for settings windows. 300 // An observer that manages the shelf title and icon for settings windows.
301 SettingsWindowObserver settings_window_observer_; 301 SettingsWindowObserver settings_window_observer_;
302 302
303 // Used to load the images for app items. 303 // Used to load the images for app items.
304 std::vector<std::unique_ptr<AppIconLoader>> app_icon_loaders_; 304 std::vector<std::unique_ptr<AppIconLoader>> app_icon_loaders_;
305 305
306 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherController); 306 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherController);
307 }; 307 };
308 308
309 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_H_ 309 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698