| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_PER_BROWSER_H_ | 5 #ifndef CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_PER_BROWSER_H_ |
| 6 #define CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_PER_BROWSER_H_ | 6 #define CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_PER_BROWSER_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 #include "content/public/browser/notification_observer.h" | 25 #include "content/public/browser/notification_observer.h" |
| 26 #include "content/public/browser/notification_registrar.h" | 26 #include "content/public/browser/notification_registrar.h" |
| 27 #include "ui/aura/window_observer.h" | 27 #include "ui/aura/window_observer.h" |
| 28 | 28 |
| 29 class AppSyncUIState; | 29 class AppSyncUIState; |
| 30 class Browser; | 30 class Browser; |
| 31 class BrowserLauncherItemControllerTest; | 31 class BrowserLauncherItemControllerTest; |
| 32 class LauncherItemController; | 32 class LauncherItemController; |
| 33 class Profile; | 33 class Profile; |
| 34 class ShellWindowLauncherController; | 34 class ShellWindowLauncherController; |
| 35 class TabContents; | |
| 36 | 35 |
| 37 namespace ash { | 36 namespace ash { |
| 38 class LauncherModel; | 37 class LauncherModel; |
| 39 } | 38 } |
| 40 | 39 |
| 41 namespace aura { | 40 namespace aura { |
| 42 class Window; | 41 class Window; |
| 43 } | 42 } |
| 44 | 43 |
| 45 namespace content { | 44 namespace content { |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 // behavior on |root_window|. | 198 // behavior on |root_window|. |
| 200 virtual bool CanUserModifyShelfAutoHideBehavior( | 199 virtual bool CanUserModifyShelfAutoHideBehavior( |
| 201 aura::RootWindow* root_window) const OVERRIDE; | 200 aura::RootWindow* root_window) const OVERRIDE; |
| 202 | 201 |
| 203 // Toggles the shelf auto-hide behavior on |root_window|. Does nothing if the | 202 // Toggles the shelf auto-hide behavior on |root_window|. Does nothing if the |
| 204 // user is not allowed to modify the auto-hide behavior. | 203 // user is not allowed to modify the auto-hide behavior. |
| 205 virtual void ToggleShelfAutoHideBehavior( | 204 virtual void ToggleShelfAutoHideBehavior( |
| 206 aura::RootWindow* root_window) OVERRIDE; | 205 aura::RootWindow* root_window) OVERRIDE; |
| 207 | 206 |
| 208 // The tab no longer represents its previously identified application. | 207 // The tab no longer represents its previously identified application. |
| 209 virtual void RemoveTabFromRunningApp(TabContents* tab, | 208 virtual void RemoveTabFromRunningApp(content::WebContents* tab, |
| 210 const std::string& app_id) OVERRIDE; | 209 const std::string& app_id) OVERRIDE; |
| 211 | 210 |
| 212 // Notify the controller that the state of an non platform app's tabs | 211 // Notify the controller that the state of an non platform app's tabs |
| 213 // have changed, | 212 // have changed, |
| 214 virtual void UpdateAppState(content::WebContents* contents, | 213 virtual void UpdateAppState(content::WebContents* contents, |
| 215 AppState app_state) OVERRIDE; | 214 AppState app_state) OVERRIDE; |
| 216 | 215 |
| 217 // Limits application refocusing to urls that match |url| for |id|. | 216 // Limits application refocusing to urls that match |url| for |id|. |
| 218 virtual void SetRefocusURLPattern(ash::LauncherID id, | 217 virtual void SetRefocusURLPattern(ash::LauncherID id, |
| 219 const GURL& url) OVERRIDE; | 218 const GURL& url) OVERRIDE; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 virtual void SetAppTabHelperForTest(AppTabHelper* helper) OVERRIDE; | 268 virtual void SetAppTabHelperForTest(AppTabHelper* helper) OVERRIDE; |
| 270 virtual void SetAppIconLoaderForTest(AppIconLoader* loader) OVERRIDE; | 269 virtual void SetAppIconLoaderForTest(AppIconLoader* loader) OVERRIDE; |
| 271 virtual const std::string& GetAppIdFromLauncherIdForTest( | 270 virtual const std::string& GetAppIdFromLauncherIdForTest( |
| 272 ash::LauncherID id) OVERRIDE; | 271 ash::LauncherID id) OVERRIDE; |
| 273 | 272 |
| 274 private: | 273 private: |
| 275 friend class ChromeLauncherControllerPerBrowserTest; | 274 friend class ChromeLauncherControllerPerBrowserTest; |
| 276 | 275 |
| 277 typedef std::map<ash::LauncherID, LauncherItemController*> | 276 typedef std::map<ash::LauncherID, LauncherItemController*> |
| 278 IDToItemControllerMap; | 277 IDToItemControllerMap; |
| 279 typedef std::list<TabContents*> TabContentsList; | 278 typedef std::list<content::WebContents*> WebContentsList; |
| 280 typedef std::map<std::string, TabContentsList> AppIDToTabContentsListMap; | 279 typedef std::map<std::string, WebContentsList> AppIDToWebContentsListMap; |
| 281 typedef std::map<TabContents*, std::string> TabContentsToAppIDMap; | 280 typedef std::map<content::WebContents*, std::string> WebContentsToAppIDMap; |
| 282 | 281 |
| 283 // Returns the profile used for new windows. | 282 // Returns the profile used for new windows. |
| 284 Profile* GetProfileForNewWindows(); | 283 Profile* GetProfileForNewWindows(); |
| 285 | 284 |
| 286 // Invoked when the associated browser or app is closed. | 285 // Invoked when the associated browser or app is closed. |
| 287 void LauncherItemClosed(ash::LauncherID id); | 286 void LauncherItemClosed(ash::LauncherID id); |
| 288 | 287 |
| 289 // Internal helpers for pinning and unpinning that handle both | 288 // Internal helpers for pinning and unpinning that handle both |
| 290 // client-triggered and internal pinning operations. | 289 // client-triggered and internal pinning operations. |
| 291 void DoPinAppWithID(const std::string& app_id); | 290 void DoPinAppWithID(const std::string& app_id); |
| 292 void DoUnpinAppsWithID(const std::string& app_id); | 291 void DoUnpinAppsWithID(const std::string& app_id); |
| 293 | 292 |
| 294 // Re-syncs launcher model with prefs::kPinnedLauncherApps. | 293 // Re-syncs launcher model with prefs::kPinnedLauncherApps. |
| 295 void UpdateAppLaunchersFromPref(); | 294 void UpdateAppLaunchersFromPref(); |
| 296 | 295 |
| 297 // Persists the shelf auto-hide behavior to prefs. | 296 // Persists the shelf auto-hide behavior to prefs. |
| 298 void SetShelfAutoHideBehaviorPrefs(ash::ShelfAutoHideBehavior behavior, | 297 void SetShelfAutoHideBehaviorPrefs(ash::ShelfAutoHideBehavior behavior, |
| 299 aura::RootWindow* root_window); | 298 aura::RootWindow* root_window); |
| 300 | 299 |
| 301 // Sets the shelf auto-hide behavior from prefs. | 300 // Sets the shelf auto-hide behavior from prefs. |
| 302 void SetShelfAutoHideBehaviorFromPrefs(); | 301 void SetShelfAutoHideBehaviorFromPrefs(); |
| 303 | 302 |
| 304 // Sets the shelf alignment from prefs. | 303 // Sets the shelf alignment from prefs. |
| 305 void SetShelfAlignmentFromPrefs(); | 304 void SetShelfAlignmentFromPrefs(); |
| 306 | 305 |
| 307 // Returns the most recently active tab contents for an app. | 306 // Returns the most recently active WebContents for an app. |
| 308 TabContents* GetLastActiveTabContents(const std::string& app_id); | 307 content::WebContents* GetLastActiveWebContents(const std::string& app_id); |
| 309 | 308 |
| 310 // Creates an app launcher to insert at |index|. Note that |index| may be | 309 // Creates an app launcher to insert at |index|. Note that |index| may be |
| 311 // adjusted by the model to meet ordering constraints. | 310 // adjusted by the model to meet ordering constraints. |
| 312 ash::LauncherID InsertAppLauncherItem( | 311 ash::LauncherID InsertAppLauncherItem( |
| 313 LauncherItemController* controller, | 312 LauncherItemController* controller, |
| 314 const std::string& app_id, | 313 const std::string& app_id, |
| 315 ash::LauncherItemStatus status, | 314 ash::LauncherItemStatus status, |
| 316 int index); | 315 int index); |
| 317 | 316 |
| 318 bool HasItemController(ash::LauncherID id) const; | 317 bool HasItemController(ash::LauncherID id) const; |
| 319 | 318 |
| 320 ash::LauncherModel* model_; | 319 ash::LauncherModel* model_; |
| 321 | 320 |
| 322 // Profile used for prefs and loading extensions. This is NOT necessarily the | 321 // Profile used for prefs and loading extensions. This is NOT necessarily the |
| 323 // profile new windows are created with. | 322 // profile new windows are created with. |
| 324 Profile* profile_; | 323 Profile* profile_; |
| 325 | 324 |
| 326 IDToItemControllerMap id_to_item_controller_map_; | 325 IDToItemControllerMap id_to_item_controller_map_; |
| 327 | 326 |
| 328 // Maintains activation order of tab contents for each app. | 327 // Maintains activation order of web contents for each app. |
| 329 AppIDToTabContentsListMap app_id_to_tab_contents_list_; | 328 AppIDToWebContentsListMap app_id_to_web_contents_list_; |
| 330 | 329 |
| 331 // Direct access to app_id for a tab contents. | 330 // Direct access to app_id for a web contents. |
| 332 TabContentsToAppIDMap tab_contents_to_app_id_; | 331 WebContentsToAppIDMap web_contents_to_app_id_; |
| 333 | 332 |
| 334 // Used to track shell windows. | 333 // Used to track shell windows. |
| 335 scoped_ptr<ShellWindowLauncherController> shell_window_controller_; | 334 scoped_ptr<ShellWindowLauncherController> shell_window_controller_; |
| 336 | 335 |
| 337 // Used to get app info for tabs. | 336 // Used to get app info for tabs. |
| 338 scoped_ptr<AppTabHelper> app_tab_helper_; | 337 scoped_ptr<AppTabHelper> app_tab_helper_; |
| 339 | 338 |
| 340 // Used to load the image for an app item. | 339 // Used to load the image for an app item. |
| 341 scoped_ptr<AppIconLoader> app_icon_loader_; | 340 scoped_ptr<AppIconLoader> app_icon_loader_; |
| 342 | 341 |
| 343 content::NotificationRegistrar notification_registrar_; | 342 content::NotificationRegistrar notification_registrar_; |
| 344 | 343 |
| 345 PrefChangeRegistrar pref_change_registrar_; | 344 PrefChangeRegistrar pref_change_registrar_; |
| 346 | 345 |
| 347 AppSyncUIState* app_sync_ui_state_; | 346 AppSyncUIState* app_sync_ui_state_; |
| 348 | 347 |
| 349 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherControllerPerBrowser); | 348 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherControllerPerBrowser); |
| 350 }; | 349 }; |
| 351 | 350 |
| 352 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_PER_BROWSER
_H_ | 351 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_PER_BROWSER
_H_ |
| OLD | NEW |