| 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 IsVisible() const override; | 41 bool IsVisible() const override; |
| 41 void Launch(ash::LaunchSource source, int event_flags) override; | 42 void Launch(ash::LaunchSource source, int event_flags) override; |
| 42 ash::ShelfItemDelegate::PerformedAction Activate( | 43 ash::ShelfItemDelegate::PerformedAction Activate( |
| 43 ash::LaunchSource source) override; | 44 ash::LaunchSource source) override; |
| 44 ChromeLauncherAppMenuItems GetApplicationList(int event_flags) override; | 45 ChromeLauncherAppMenuItems GetApplicationList(int event_flags) override; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 55 // from a URL link. | 56 // from a URL link. |
| 56 const GURL& refocus_url() const { return refocus_url_; } | 57 const GURL& refocus_url() const { return refocus_url_; } |
| 57 // Set the refocus url pattern. Used by unit tests. | 58 // Set the refocus url pattern. Used by unit tests. |
| 58 void set_refocus_url(const GURL& refocus_url) { refocus_url_ = refocus_url; } | 59 void set_refocus_url(const GURL& refocus_url) { refocus_url_ = refocus_url; } |
| 59 | 60 |
| 60 ChromeLauncherController* controller() { return chrome_launcher_controller_; } | 61 ChromeLauncherController* controller() { return chrome_launcher_controller_; } |
| 61 | 62 |
| 62 protected: | 63 protected: |
| 63 AppShortcutLauncherItemController(const std::string& app_id, | 64 AppShortcutLauncherItemController(const std::string& app_id, |
| 64 const std::string& launch_id, | 65 const std::string& launch_id, |
| 66 const std::string& title, |
| 65 ChromeLauncherController* controller); | 67 ChromeLauncherController* controller); |
| 66 | 68 |
| 67 private: | 69 private: |
| 68 // Get the last running application. | 70 // Get the last running application. |
| 69 content::WebContents* GetLRUApplication(); | 71 content::WebContents* GetLRUApplication(); |
| 70 | 72 |
| 71 // Returns true if this app matches the given |web_contents|. To accelerate | 73 // Returns true if this app matches the given |web_contents|. To accelerate |
| 72 // the matching, the app managing |extension| as well as the parsed | 74 // the matching, the app managing |extension| as well as the parsed |
| 73 // |refocus_pattern| get passed. If |is_app| is true, the application gets | 75 // |refocus_pattern| get passed. If |is_app| is true, the application gets |
| 74 // first checked against its original URL since a windowed app might have | 76 // first checked against its original URL since a windowed app might have |
| (...skipping 23 matching lines...) Expand all Loading... |
| 98 // Since V2 applications can be undetectable after launching, this timer is | 100 // Since V2 applications can be undetectable after launching, this timer is |
| 99 // keeping track of the last launch attempt. | 101 // keeping track of the last launch attempt. |
| 100 base::Time last_launch_attempt_; | 102 base::Time last_launch_attempt_; |
| 101 | 103 |
| 102 ChromeLauncherController* chrome_launcher_controller_; | 104 ChromeLauncherController* chrome_launcher_controller_; |
| 103 | 105 |
| 104 DISALLOW_COPY_AND_ASSIGN(AppShortcutLauncherItemController); | 106 DISALLOW_COPY_AND_ASSIGN(AppShortcutLauncherItemController); |
| 105 }; | 107 }; |
| 106 | 108 |
| 107 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_APP_SHORTCUT_LAUNCHER_ITEM_CONTROLLER_
H_ | 109 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_APP_SHORTCUT_LAUNCHER_ITEM_CONTROLLER_
H_ |
| OLD | NEW |