| 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_LAUNCHER_ITEM_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_ASH_LAUNCHER_LAUNCHER_ITEM_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_UI_ASH_LAUNCHER_LAUNCHER_ITEM_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_ASH_LAUNCHER_LAUNCHER_ITEM_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "ash/shelf/shelf_item_delegate.h" | 10 #include "ash/shelf/shelf_item_delegate.h" |
| 11 #include "ash/shelf/shelf_item_types.h" | 11 #include "ash/shelf/shelf_item_types.h" |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/memory/scoped_vector.h" | 14 #include "base/memory/scoped_vector.h" |
| 15 #include "base/strings/string16.h" | |
| 16 #include "chrome/browser/ui/ash/launcher/chrome_launcher_types.h" | 15 #include "chrome/browser/ui/ash/launcher/chrome_launcher_types.h" |
| 17 #include "ui/events/event.h" | 16 #include "ui/events/event.h" |
| 18 | 17 |
| 19 class ChromeLauncherController; | 18 class ChromeLauncherController; |
| 20 class ChromeLauncherAppMenuItem; | 19 class ChromeLauncherAppMenuItem; |
| 20 class Profile; |
| 21 | 21 |
| 22 typedef ScopedVector<ChromeLauncherAppMenuItem> ChromeLauncherAppMenuItems; | 22 typedef ScopedVector<ChromeLauncherAppMenuItem> ChromeLauncherAppMenuItems; |
| 23 | 23 |
| 24 namespace aura { | 24 namespace aura { |
| 25 class Window; | 25 class Window; |
| 26 } | 26 } |
| 27 | 27 |
| 28 namespace content { | 28 namespace content { |
| 29 class WebContents; | 29 class WebContents; |
| 30 } | 30 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 41 }; | 41 }; |
| 42 | 42 |
| 43 LauncherItemController(Type type, | 43 LauncherItemController(Type type, |
| 44 const std::string& app_id, | 44 const std::string& app_id, |
| 45 ChromeLauncherController* launcher_controller); | 45 ChromeLauncherController* launcher_controller); |
| 46 ~LauncherItemController() override; | 46 ~LauncherItemController() override; |
| 47 | 47 |
| 48 Type type() const { return type_; } | 48 Type type() const { return type_; } |
| 49 ash::ShelfID shelf_id() const { return shelf_id_; } | 49 ash::ShelfID shelf_id() const { return shelf_id_; } |
| 50 void set_shelf_id(ash::ShelfID id) { shelf_id_ = id; } | 50 void set_shelf_id(ash::ShelfID id) { shelf_id_ = id; } |
| 51 virtual const std::string& app_id() const; | 51 const std::string& app_id() const { return app_id_; } |
| 52 ChromeLauncherController* launcher_controller() const { | 52 ChromeLauncherController* launcher_controller() const { |
| 53 return launcher_controller_; | 53 return launcher_controller_; |
| 54 } | 54 } |
| 55 | 55 |
| 56 // Lock this item to the launcher without being pinned (windowed v1 apps). | 56 // Lock this item to the launcher without being pinned (windowed v1 apps). |
| 57 void lock() { locked_++; } | 57 void lock() { locked_++; } |
| 58 void unlock() { | 58 void unlock() { |
| 59 DCHECK(locked_); | 59 DCHECK(locked_); |
| 60 locked_--; | 60 locked_--; |
| 61 } | 61 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 79 // item, or launches the item if it is not currently open. | 79 // item, or launches the item if it is not currently open. |
| 80 // Returns the action performed by activating the item. | 80 // Returns the action performed by activating the item. |
| 81 virtual PerformedAction Activate(ash::LaunchSource source) = 0; | 81 virtual PerformedAction Activate(ash::LaunchSource source) = 0; |
| 82 | 82 |
| 83 // Called to retrieve the list of running applications. | 83 // Called to retrieve the list of running applications. |
| 84 virtual ChromeLauncherAppMenuItems GetApplicationList(int event_flags) = 0; | 84 virtual ChromeLauncherAppMenuItems GetApplicationList(int event_flags) = 0; |
| 85 | 85 |
| 86 // Helper function to get the ash::ShelfItemType for the item type. | 86 // Helper function to get the ash::ShelfItemType for the item type. |
| 87 ash::ShelfItemType GetShelfItemType() const; | 87 ash::ShelfItemType GetShelfItemType() const; |
| 88 | 88 |
| 89 protected: | |
| 90 // Helper function to return the title associated with |app_id_|. | |
| 91 // Returns an empty title if no matching extension can be found. | |
| 92 base::string16 GetAppTitle() const; | |
| 93 | |
| 94 private: | 89 private: |
| 95 const Type type_; | 90 const Type type_; |
| 96 // App id will be empty if there is no app associated with the window. | 91 // App id will be empty if there is no app associated with the window. |
| 97 const std::string app_id_; | 92 const std::string app_id_; |
| 98 ash::ShelfID shelf_id_; | 93 ash::ShelfID shelf_id_; |
| 99 ChromeLauncherController* launcher_controller_; | 94 ChromeLauncherController* launcher_controller_; |
| 100 | 95 |
| 101 // The lock counter which tells the launcher if the item can be removed from | 96 // The lock counter which tells the launcher if the item can be removed from |
| 102 // the launcher (0) or not (>0). It is being used for windowed V1 | 97 // the launcher (0) or not (>0). It is being used for windowed V1 |
| 103 // applications. | 98 // applications. |
| 104 int locked_; | 99 int locked_; |
| 105 | 100 |
| 106 // Set to true if the launcher item image has been set by the controller. | 101 // Set to true if the launcher item image has been set by the controller. |
| 107 bool image_set_by_controller_; | 102 bool image_set_by_controller_; |
| 108 | 103 |
| 109 DISALLOW_COPY_AND_ASSIGN(LauncherItemController); | 104 DISALLOW_COPY_AND_ASSIGN(LauncherItemController); |
| 110 }; | 105 }; |
| 111 | 106 |
| 112 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_LAUNCHER_ITEM_CONTROLLER_H_ | 107 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_LAUNCHER_ITEM_CONTROLLER_H_ |
| OLD | NEW |