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 <set> | 10 #include <set> |
11 #include <string> | 11 #include <string> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "ash/display/display_controller.h" | 14 #include "ash/display/display_controller.h" |
15 #include "ash/launcher/launcher_delegate.h" | 15 #include "ash/launcher/launcher_delegate.h" |
16 #include "ash/launcher/launcher_item_delegate.h" | |
17 #include "ash/launcher/launcher_types.h" | 16 #include "ash/launcher/launcher_types.h" |
| 17 #include "ash/shelf/shelf_item_delegate.h" |
18 #include "ash/shelf/shelf_layout_manager_observer.h" | 18 #include "ash/shelf/shelf_layout_manager_observer.h" |
19 #include "ash/shelf/shelf_model_observer.h" | 19 #include "ash/shelf/shelf_model_observer.h" |
20 #include "ash/shelf/shelf_types.h" | 20 #include "ash/shelf/shelf_types.h" |
21 #include "ash/shell_observer.h" | 21 #include "ash/shell_observer.h" |
22 #include "base/basictypes.h" | 22 #include "base/basictypes.h" |
23 #include "base/compiler_specific.h" | 23 #include "base/compiler_specific.h" |
24 #include "base/memory/scoped_ptr.h" | 24 #include "base/memory/scoped_ptr.h" |
25 #include "base/memory/scoped_vector.h" | 25 #include "base/memory/scoped_vector.h" |
26 #include "base/prefs/pref_change_registrar.h" | 26 #include "base/prefs/pref_change_registrar.h" |
27 #include "chrome/browser/extensions/app_icon_loader.h" | 27 #include "chrome/browser/extensions/app_icon_loader.h" |
(...skipping 12 matching lines...) Expand all Loading... |
40 class BrowserShortcutLauncherItemController; | 40 class BrowserShortcutLauncherItemController; |
41 class BrowserStatusMonitor; | 41 class BrowserStatusMonitor; |
42 class ExtensionEnableFlow; | 42 class ExtensionEnableFlow; |
43 class GURL; | 43 class GURL; |
44 class LauncherItemController; | 44 class LauncherItemController; |
45 class Profile; | 45 class Profile; |
46 class ShellWindowLauncherController; | 46 class ShellWindowLauncherController; |
47 class TabContents; | 47 class TabContents; |
48 | 48 |
49 namespace ash { | 49 namespace ash { |
50 class LauncherItemDelegateManager; | 50 class ShelfItemDelegateManager; |
51 class ShelfModel; | 51 class ShelfModel; |
52 } | 52 } |
53 | 53 |
54 namespace aura { | 54 namespace aura { |
55 class Window; | 55 class Window; |
56 } | 56 } |
57 | 57 |
58 namespace content { | 58 namespace content { |
59 class WebContents; | 59 class WebContents; |
60 } | 60 } |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 // Use kInsertItemAtEnd to add a shortcut as the last item. | 397 // Use kInsertItemAtEnd to add a shortcut as the last item. |
398 ash::LauncherID CreateAppShortcutLauncherItem(const std::string& app_id, | 398 ash::LauncherID CreateAppShortcutLauncherItem(const std::string& app_id, |
399 int index); | 399 int index); |
400 | 400 |
401 // Sets the AppTabHelper/AppIconLoader, taking ownership of the helper class. | 401 // Sets the AppTabHelper/AppIconLoader, taking ownership of the helper class. |
402 // These are intended for testing. | 402 // These are intended for testing. |
403 void SetAppTabHelperForTest(AppTabHelper* helper); | 403 void SetAppTabHelperForTest(AppTabHelper* helper); |
404 void SetAppIconLoaderForTest(extensions::AppIconLoader* loader); | 404 void SetAppIconLoaderForTest(extensions::AppIconLoader* loader); |
405 const std::string& GetAppIdFromLauncherIdForTest(ash::LauncherID id); | 405 const std::string& GetAppIdFromLauncherIdForTest(ash::LauncherID id); |
406 | 406 |
407 // Sets the ash::LauncherItemDelegateManager only for unittests and doesn't | 407 // Sets the ash::ShelfItemDelegateManager only for unittests and doesn't |
408 // take an ownership of it. | 408 // take an ownership of it. |
409 void SetLauncherItemDelegateManagerForTest( | 409 void SetShelfItemDelegateManagerForTest( |
410 ash::LauncherItemDelegateManager* manager); | 410 ash::ShelfItemDelegateManager* manager); |
411 | 411 |
412 private: | 412 private: |
413 friend class ChromeLauncherControllerTest; | 413 friend class ChromeLauncherControllerTest; |
414 friend class LauncherAppBrowserTest; | 414 friend class LauncherAppBrowserTest; |
415 friend class LauncherPlatformAppBrowserTest; | 415 friend class LauncherPlatformAppBrowserTest; |
416 | 416 |
417 typedef std::map<ash::LauncherID, LauncherItemController*> | 417 typedef std::map<ash::LauncherID, LauncherItemController*> |
418 IDToItemControllerMap; | 418 IDToItemControllerMap; |
419 typedef std::list<content::WebContents*> WebContentsList; | 419 typedef std::list<content::WebContents*> WebContentsList; |
420 typedef std::map<std::string, WebContentsList> AppIDToWebContentsListMap; | 420 typedef std::map<std::string, WebContentsList> AppIDToWebContentsListMap; |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
513 // configuration of pinned and known (but not running) apps. | 513 // configuration of pinned and known (but not running) apps. |
514 int GetChromeIconIndexForCreation(); | 514 int GetChromeIconIndexForCreation(); |
515 | 515 |
516 // Get the list of pinned programs from the preferences. | 516 // Get the list of pinned programs from the preferences. |
517 std::vector<std::string> GetListOfPinnedAppsAndBrowser(); | 517 std::vector<std::string> GetListOfPinnedAppsAndBrowser(); |
518 | 518 |
519 // Close all windowed V1 applications of a certain extension which was already | 519 // Close all windowed V1 applications of a certain extension which was already |
520 // deleted. | 520 // deleted. |
521 void CloseWindowedAppsFromRemovedExtension(const std::string& app_id); | 521 void CloseWindowedAppsFromRemovedExtension(const std::string& app_id); |
522 | 522 |
523 // Set LauncherItemDelegate |item_delegate| for |id| and take an ownership. | 523 // Set ShelfItemDelegate |item_delegate| for |id| and take an ownership. |
524 // TODO(simon.hong81): Make this take a scoped_ptr of |item_delegate|. | 524 // TODO(simon.hong81): Make this take a scoped_ptr of |item_delegate|. |
525 void SetLauncherItemDelegate(ash::LauncherID id, | 525 void SetShelfItemDelegate(ash::LauncherID id, |
526 ash::LauncherItemDelegate* item_delegate); | 526 ash::ShelfItemDelegate* item_delegate); |
527 | 527 |
528 // Attach to a specific profile. | 528 // Attach to a specific profile. |
529 void AttachProfile(Profile* proifile); | 529 void AttachProfile(Profile* proifile); |
530 | 530 |
531 // Forget the current profile to allow attaching to a new one. | 531 // Forget the current profile to allow attaching to a new one. |
532 void ReleaseProfile(); | 532 void ReleaseProfile(); |
533 | 533 |
534 // Returns true if |app_id| is a Packaged App that has already launched on the | 534 // Returns true if |app_id| is a Packaged App that has already launched on the |
535 // native desktop and, if so, executes it as a desktop shortcut to activate | 535 // native desktop and, if so, executes it as a desktop shortcut to activate |
536 // desktop mode and send another OnLaunched event to the Extension. | 536 // desktop mode and send another OnLaunched event to the Extension. |
537 bool LaunchedInNativeDesktop(const std::string& app_id); | 537 bool LaunchedInNativeDesktop(const std::string& app_id); |
538 | 538 |
539 static ChromeLauncherController* instance_; | 539 static ChromeLauncherController* instance_; |
540 | 540 |
541 ash::ShelfModel* model_; | 541 ash::ShelfModel* model_; |
542 | 542 |
543 ash::LauncherItemDelegateManager* item_delegate_manager_; | 543 ash::ShelfItemDelegateManager* item_delegate_manager_; |
544 | 544 |
545 // Profile used for prefs and loading extensions. This is NOT necessarily the | 545 // Profile used for prefs and loading extensions. This is NOT necessarily the |
546 // profile new windows are created with. | 546 // profile new windows are created with. |
547 Profile* profile_; | 547 Profile* profile_; |
548 | 548 |
549 IDToItemControllerMap id_to_item_controller_map_; | 549 IDToItemControllerMap id_to_item_controller_map_; |
550 | 550 |
551 // Maintains activation order of web contents for each app. | 551 // Maintains activation order of web contents for each app. |
552 AppIDToWebContentsListMap app_id_to_web_contents_list_; | 552 AppIDToWebContentsListMap app_id_to_web_contents_list_; |
553 | 553 |
(...skipping 29 matching lines...) Expand all Loading... |
583 // If true, incoming pinned state changes should be ignored. | 583 // If true, incoming pinned state changes should be ignored. |
584 bool ignore_persist_pinned_state_change_; | 584 bool ignore_persist_pinned_state_change_; |
585 | 585 |
586 // True if each user has an own desktop. | 586 // True if each user has an own desktop. |
587 bool multi_profile_desktop_separation_; | 587 bool multi_profile_desktop_separation_; |
588 | 588 |
589 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherController); | 589 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherController); |
590 }; | 590 }; |
591 | 591 |
592 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_H_ | 592 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_H_ |
OLD | NEW |