OLD | NEW |
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 <list> | 8 #include <list> |
9 #include <map> | 9 #include <map> |
| 10 #include <memory> |
10 #include <string> | 11 #include <string> |
11 #include <vector> | 12 #include <vector> |
12 | 13 |
13 #include "ash/display/window_tree_host_manager.h" | 14 #include "ash/display/window_tree_host_manager.h" |
14 #include "ash/shelf/shelf_delegate.h" | 15 #include "ash/shelf/shelf_delegate.h" |
15 #include "ash/shelf/shelf_item_delegate.h" | 16 #include "ash/shelf/shelf_item_delegate.h" |
16 #include "ash/shelf/shelf_item_delegate_manager.h" | 17 #include "ash/shelf/shelf_item_delegate_manager.h" |
17 #include "ash/shelf/shelf_item_types.h" | 18 #include "ash/shelf/shelf_item_types.h" |
18 #include "ash/shelf/shelf_model_observer.h" | 19 #include "ash/shelf/shelf_model_observer.h" |
19 #include "ash/shelf/shelf_types.h" | 20 #include "ash/shelf/shelf_types.h" |
20 #include "base/compiler_specific.h" | 21 #include "base/compiler_specific.h" |
21 #include "base/macros.h" | 22 #include "base/macros.h" |
22 #include "base/memory/scoped_ptr.h" | |
23 #include "base/memory/scoped_vector.h" | 23 #include "base/memory/scoped_vector.h" |
24 #include "build/build_config.h" | 24 #include "build/build_config.h" |
25 #include "chrome/browser/ui/app_icon_loader.h" | 25 #include "chrome/browser/ui/app_icon_loader.h" |
26 #include "chrome/browser/ui/ash/app_sync_ui_state_observer.h" | 26 #include "chrome/browser/ui/ash/app_sync_ui_state_observer.h" |
27 #include "chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item.h" | 27 #include "chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item.h" |
28 #include "chrome/browser/ui/ash/launcher/chrome_launcher_types.h" | 28 #include "chrome/browser/ui/ash/launcher/chrome_launcher_types.h" |
29 #include "chrome/browser/ui/ash/launcher/launcher_app_updater.h" | 29 #include "chrome/browser/ui/ash/launcher/launcher_app_updater.h" |
30 #include "chrome/browser/ui/extensions/extension_enable_flow_delegate.h" | 30 #include "chrome/browser/ui/extensions/extension_enable_flow_delegate.h" |
31 #include "components/prefs/pref_change_registrar.h" | 31 #include "components/prefs/pref_change_registrar.h" |
32 #include "components/syncable_prefs/pref_service_syncable_observer.h" | 32 #include "components/syncable_prefs/pref_service_syncable_observer.h" |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 protected: | 386 protected: |
387 // Creates a new app shortcut item and controller on the shelf at |index|. | 387 // Creates a new app shortcut item and controller on the shelf at |index|. |
388 // Use kInsertItemAtEnd to add a shortcut as the last item. | 388 // Use kInsertItemAtEnd to add a shortcut as the last item. |
389 ash::ShelfID CreateAppShortcutLauncherItem(const std::string& app_id, | 389 ash::ShelfID CreateAppShortcutLauncherItem(const std::string& app_id, |
390 int index); | 390 int index); |
391 | 391 |
392 // Sets the AppTabHelper/AppIconLoader, taking ownership of the helper class. | 392 // Sets the AppTabHelper/AppIconLoader, taking ownership of the helper class. |
393 // These are intended for testing. | 393 // These are intended for testing. |
394 void SetAppTabHelperForTest(AppTabHelper* helper); | 394 void SetAppTabHelperForTest(AppTabHelper* helper); |
395 void SetAppIconLoadersForTest( | 395 void SetAppIconLoadersForTest( |
396 std::vector<scoped_ptr<AppIconLoader>>& loaders); | 396 std::vector<std::unique_ptr<AppIconLoader>>& loaders); |
397 const std::string& GetAppIdFromShelfIdForTest(ash::ShelfID id); | 397 const std::string& GetAppIdFromShelfIdForTest(ash::ShelfID id); |
398 | 398 |
399 // Sets the ash::ShelfItemDelegateManager only for unittests and doesn't | 399 // Sets the ash::ShelfItemDelegateManager only for unittests and doesn't |
400 // take an ownership of it. | 400 // take an ownership of it. |
401 void SetShelfItemDelegateManagerForTest( | 401 void SetShelfItemDelegateManagerForTest( |
402 ash::ShelfItemDelegateManager* manager); | 402 ash::ShelfItemDelegateManager* manager); |
403 | 403 |
404 private: | 404 private: |
405 friend class ChromeLauncherControllerTest; | 405 friend class ChromeLauncherControllerTest; |
406 friend class ShelfAppBrowserTest; | 406 friend class ShelfAppBrowserTest; |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 // profile new windows are created with. | 536 // profile new windows are created with. |
537 Profile* profile_; | 537 Profile* profile_; |
538 | 538 |
539 // Controller items in this map are owned by |ShelfItemDelegateManager|. | 539 // Controller items in this map are owned by |ShelfItemDelegateManager|. |
540 IDToItemControllerMap id_to_item_controller_map_; | 540 IDToItemControllerMap id_to_item_controller_map_; |
541 | 541 |
542 // Direct access to app_id for a web contents. | 542 // Direct access to app_id for a web contents. |
543 WebContentsToAppIDMap web_contents_to_app_id_; | 543 WebContentsToAppIDMap web_contents_to_app_id_; |
544 | 544 |
545 // Used to track app windows. | 545 // Used to track app windows. |
546 std::vector<scoped_ptr<AppWindowLauncherController>> app_window_controllers_; | 546 std::vector<std::unique_ptr<AppWindowLauncherController>> |
| 547 app_window_controllers_; |
547 | 548 |
548 // Used to get app info for tabs. | 549 // Used to get app info for tabs. |
549 scoped_ptr<AppTabHelper> app_tab_helper_; | 550 std::unique_ptr<AppTabHelper> app_tab_helper_; |
550 | 551 |
551 // Used to load the image for an extension app item. | 552 // Used to load the image for an extension app item. |
552 std::vector<scoped_ptr<AppIconLoader>> app_icon_loaders_; | 553 std::vector<std::unique_ptr<AppIconLoader>> app_icon_loaders_; |
553 | 554 |
554 // Used to handle app load/unload events. | 555 // Used to handle app load/unload events. |
555 std::vector<scoped_ptr<LauncherAppUpdater>> app_updaters_; | 556 std::vector<std::unique_ptr<LauncherAppUpdater>> app_updaters_; |
556 | 557 |
557 PrefChangeRegistrar pref_change_registrar_; | 558 PrefChangeRegistrar pref_change_registrar_; |
558 | 559 |
559 AppSyncUIState* app_sync_ui_state_; | 560 AppSyncUIState* app_sync_ui_state_; |
560 | 561 |
561 scoped_ptr<ExtensionEnableFlow> extension_enable_flow_; | 562 std::unique_ptr<ExtensionEnableFlow> extension_enable_flow_; |
562 | 563 |
563 // The owned browser status monitor. | 564 // The owned browser status monitor. |
564 scoped_ptr<BrowserStatusMonitor> browser_status_monitor_; | 565 std::unique_ptr<BrowserStatusMonitor> browser_status_monitor_; |
565 | 566 |
566 #if defined(OS_CHROMEOS) | 567 #if defined(OS_CHROMEOS) |
567 // A special observer class to detect user switches. | 568 // A special observer class to detect user switches. |
568 scoped_ptr<ChromeLauncherControllerUserSwitchObserver> user_switch_observer_; | 569 std::unique_ptr<ChromeLauncherControllerUserSwitchObserver> |
| 570 user_switch_observer_; |
569 #endif | 571 #endif |
570 | 572 |
571 // If true, incoming pinned state changes should be ignored. | 573 // If true, incoming pinned state changes should be ignored. |
572 bool ignore_persist_pinned_state_change_; | 574 bool ignore_persist_pinned_state_change_; |
573 | 575 |
574 // The list of running & un-pinned applications for different users on hidden | 576 // The list of running & un-pinned applications for different users on hidden |
575 // desktops. | 577 // desktops. |
576 typedef std::vector<std::string> RunningAppListIds; | 578 typedef std::vector<std::string> RunningAppListIds; |
577 typedef std::map<std::string, RunningAppListIds> RunningAppListIdMap; | 579 typedef std::map<std::string, RunningAppListIds> RunningAppListIdMap; |
578 RunningAppListIdMap last_used_running_application_order_; | 580 RunningAppListIdMap last_used_running_application_order_; |
579 | 581 |
580 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherController); | 582 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherController); |
581 }; | 583 }; |
582 | 584 |
583 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_H_ | 585 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_H_ |
OLD | NEW |