| 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_APP_SHORTCUT_LAUNCHER_ITEM_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_ASH_LAUNCHER_APP_SHORTCUT_LAUNCHER_ITEM_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_UI_ASH_LAUNCHER_APP_SHORTCUT_LAUNCHER_ITEM_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_ASH_LAUNCHER_APP_SHORTCUT_LAUNCHER_ITEM_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 // Item controller for an app shortcut. Shortcuts track app and launcher ids, | 25 // Item controller for an app shortcut. Shortcuts track app and launcher ids, |
| 26 // but do not have any associated windows (opening a shortcut will replace the | 26 // but do not have any associated windows (opening a shortcut will replace the |
| 27 // item with the appropriate LauncherItemController type). | 27 // item with the appropriate LauncherItemController type). |
| 28 class AppShortcutLauncherItemController : public LauncherItemController { | 28 class AppShortcutLauncherItemController : public LauncherItemController { |
| 29 public: | 29 public: |
| 30 ~AppShortcutLauncherItemController() override; | 30 ~AppShortcutLauncherItemController() override; |
| 31 | 31 |
| 32 static AppShortcutLauncherItemController* Create( | 32 static AppShortcutLauncherItemController* Create( |
| 33 const std::string& app_id, | 33 const std::string& app_id, |
| 34 const std::string& launch_id, | 34 const std::string& launch_id, |
| 35 const std::string& title, |
| 35 ChromeLauncherController* controller); | 36 ChromeLauncherController* controller); |
| 36 | 37 |
| 37 std::vector<content::WebContents*> GetRunningApplications(); | 38 std::vector<content::WebContents*> GetRunningApplications(); |
| 38 | 39 |
| 39 // LauncherItemController overrides: | 40 // LauncherItemController overrides: |
| 40 bool IsOpen() const override; | 41 bool IsOpen() const override; |
| 41 bool IsVisible() const override; | 42 bool IsVisible() const override; |
| 42 void Launch(ash::LaunchSource source, int event_flags) override; | 43 void Launch(ash::LaunchSource source, int event_flags) override; |
| 43 ash::ShelfItemDelegate::PerformedAction Activate( | 44 ash::ShelfItemDelegate::PerformedAction Activate( |
| 44 ash::LaunchSource source) override; | 45 ash::LaunchSource source) override; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 57 const GURL& refocus_url() const { return refocus_url_; } | 58 const GURL& refocus_url() const { return refocus_url_; } |
| 58 // Set the refocus url pattern. Used by unit tests. | 59 // Set the refocus url pattern. Used by unit tests. |
| 59 void set_refocus_url(const GURL& refocus_url) { refocus_url_ = refocus_url; } | 60 void set_refocus_url(const GURL& refocus_url) { refocus_url_ = refocus_url; } |
| 60 | 61 |
| 61 ChromeLauncherController* controller() { return chrome_launcher_controller_; } | 62 ChromeLauncherController* controller() { return chrome_launcher_controller_; } |
| 62 | 63 |
| 63 const std::string& app_id() const { return app_id_; } | 64 const std::string& app_id() const { return app_id_; } |
| 64 | 65 |
| 65 const std::string& launch_id() const { return launch_id_; } | 66 const std::string& launch_id() const { return launch_id_; } |
| 66 | 67 |
| 68 const std::string& title() const { return title_; } |
| 69 |
| 67 protected: | 70 protected: |
| 68 AppShortcutLauncherItemController(const std::string& app_id, | 71 AppShortcutLauncherItemController(const std::string& app_id, |
| 69 const std::string& launch_id, | 72 const std::string& launch_id, |
| 73 const std::string& title, |
| 70 ChromeLauncherController* controller); | 74 ChromeLauncherController* controller); |
| 71 | 75 |
| 72 private: | 76 private: |
| 73 // Get the last running application. | 77 // Get the last running application. |
| 74 content::WebContents* GetLRUApplication(); | 78 content::WebContents* GetLRUApplication(); |
| 75 | 79 |
| 76 // Returns true if this app matches the given |web_contents|. To accelerate | 80 // Returns true if this app matches the given |web_contents|. To accelerate |
| 77 // the matching, the app managing |extension| as well as the parsed | 81 // the matching, the app managing |extension| as well as the parsed |
| 78 // |refocus_pattern| get passed. If |is_app| is true, the application gets | 82 // |refocus_pattern| get passed. If |is_app| is true, the application gets |
| 79 // first checked against its original URL since a windowed app might have | 83 // first checked against its original URL since a windowed app might have |
| (...skipping 27 matching lines...) Expand all Loading... |
| 107 ChromeLauncherController* chrome_launcher_controller_; | 111 ChromeLauncherController* chrome_launcher_controller_; |
| 108 | 112 |
| 109 // The application id associated with this app shortcut. | 113 // The application id associated with this app shortcut. |
| 110 const std::string app_id_; | 114 const std::string app_id_; |
| 111 | 115 |
| 112 // An id that can be passed to an app when launched in order to support | 116 // An id that can be passed to an app when launched in order to support |
| 113 // multiple shelf items per app. This id is used together with the app_id to | 117 // multiple shelf items per app. This id is used together with the app_id to |
| 114 // uniquely identify each shelf item that has the same app_id. | 118 // uniquely identify each shelf item that has the same app_id. |
| 115 const std::string launch_id_; | 119 const std::string launch_id_; |
| 116 | 120 |
| 121 // Title of the window that has its own icon in the shelf. |
| 122 const std::string title_; |
| 123 |
| 117 DISALLOW_COPY_AND_ASSIGN(AppShortcutLauncherItemController); | 124 DISALLOW_COPY_AND_ASSIGN(AppShortcutLauncherItemController); |
| 118 }; | 125 }; |
| 119 | 126 |
| 120 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_APP_SHORTCUT_LAUNCHER_ITEM_CONTROLLER_
H_ | 127 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_APP_SHORTCUT_LAUNCHER_ITEM_CONTROLLER_
H_ |
| OLD | NEW |