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 23 matching lines...) Expand all Loading... |
34 ~AppShortcutLauncherItemController() override; | 34 ~AppShortcutLauncherItemController() override; |
35 | 35 |
36 static AppShortcutLauncherItemController* Create( | 36 static AppShortcutLauncherItemController* Create( |
37 const std::string& app_id, | 37 const std::string& app_id, |
38 const std::string& launch_id, | 38 const std::string& launch_id, |
39 ChromeLauncherController* controller); | 39 ChromeLauncherController* controller); |
40 | 40 |
41 std::vector<content::WebContents*> GetRunningApplications(); | 41 std::vector<content::WebContents*> GetRunningApplications(); |
42 | 42 |
43 // LauncherItemController overrides: | 43 // LauncherItemController overrides: |
44 ash::ShelfItemDelegate::PerformedAction Activate( | 44 ash::ShelfAction ItemSelected(ui::EventType event_type, |
45 ash::LaunchSource source) override; | 45 int event_flags, |
46 ash::ShelfItemDelegate::PerformedAction ItemSelected( | 46 int64_t display_id, |
47 const ui::Event& event) override; | 47 ash::ShelfLaunchSource source) override; |
48 ash::ShelfAppMenuItemList GetAppMenuItems(int event_flags) override; | 48 ash::ShelfAppMenuItemList GetAppMenuItems(int event_flags) override; |
49 void Close() override; | 49 void Close() override; |
50 | 50 |
51 // Get the refocus url pattern, which can be used to identify this application | 51 // Get the refocus url pattern, which can be used to identify this application |
52 // from a URL link. | 52 // from a URL link. |
53 const GURL& refocus_url() const { return refocus_url_; } | 53 const GURL& refocus_url() const { return refocus_url_; } |
54 // Set the refocus url pattern. Used by unit tests. | 54 // Set the refocus url pattern. Used by unit tests. |
55 void set_refocus_url(const GURL& refocus_url) { refocus_url_ = refocus_url; } | 55 void set_refocus_url(const GURL& refocus_url) { refocus_url_ = refocus_url; } |
56 | 56 |
57 ChromeLauncherController* controller() { return chrome_launcher_controller_; } | 57 ChromeLauncherController* controller() { return chrome_launcher_controller_; } |
(...skipping 12 matching lines...) Expand all Loading... |
70 // |refocus_pattern| get passed. If |is_app| is true, the application gets | 70 // |refocus_pattern| get passed. If |is_app| is true, the application gets |
71 // first checked against its original URL since a windowed app might have | 71 // first checked against its original URL since a windowed app might have |
72 // navigated away from its app domain. | 72 // navigated away from its app domain. |
73 bool WebContentMatchesApp(const extensions::Extension* extension, | 73 bool WebContentMatchesApp(const extensions::Extension* extension, |
74 const URLPattern& refocus_pattern, | 74 const URLPattern& refocus_pattern, |
75 content::WebContents* web_contents, | 75 content::WebContents* web_contents, |
76 Browser* browser); | 76 Browser* browser); |
77 | 77 |
78 // Activate the browser with the given |content| and show the associated tab. | 78 // Activate the browser with the given |content| and show the associated tab. |
79 // Returns the action performed by activating the content. | 79 // Returns the action performed by activating the content. |
80 ash::ShelfItemDelegate::PerformedAction ActivateContent( | 80 ash::ShelfAction ActivateContent(content::WebContents* content); |
81 content::WebContents* content); | |
82 | 81 |
83 // Advance to the next item if an owned item is already active. The function | 82 // Advance to the next item if an owned item is already active. The function |
84 // will return true if it has successfully advanced. | 83 // will return true if it has successfully advanced. |
85 bool AdvanceToNextApp(); | 84 bool AdvanceToNextApp(); |
86 | 85 |
87 // Returns true if the application is a V2 app. | 86 // Returns true if the application is a V2 app. |
88 bool IsV2App(); | 87 bool IsV2App(); |
89 | 88 |
90 // Returns true if it is allowed to try starting a V2 app again. | 89 // Returns true if it is allowed to try starting a V2 app again. |
91 bool AllowNextLaunchAttempt(); | 90 bool AllowNextLaunchAttempt(); |
92 | 91 |
93 GURL refocus_url_; | 92 GURL refocus_url_; |
94 | 93 |
95 // Since V2 applications can be undetectable after launching, this timer is | 94 // Since V2 applications can be undetectable after launching, this timer is |
96 // keeping track of the last launch attempt. | 95 // keeping track of the last launch attempt. |
97 base::Time last_launch_attempt_; | 96 base::Time last_launch_attempt_; |
98 | 97 |
99 ChromeLauncherController* chrome_launcher_controller_; | 98 ChromeLauncherController* chrome_launcher_controller_; |
100 | 99 |
101 DISALLOW_COPY_AND_ASSIGN(AppShortcutLauncherItemController); | 100 DISALLOW_COPY_AND_ASSIGN(AppShortcutLauncherItemController); |
102 }; | 101 }; |
103 | 102 |
104 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_APP_SHORTCUT_LAUNCHER_ITEM_CONTROLLER_
H_ | 103 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_APP_SHORTCUT_LAUNCHER_ITEM_CONTROLLER_
H_ |
OLD | NEW |