OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 // The <code>chrome.launcherPage</code> API provides launcher pages in the | 5 // The <code>chrome.launcherPage</code> API provides launcher pages in the |
6 // Chrome Launcher with the capabilities and events they need. | 6 // Chrome Launcher with the capabilities and events they need. |
7 namespace launcherPage { | 7 namespace launcherPage { |
8 callback PushSubpageCallback = void(); | 8 callback PushSubpageCallback = void(); |
9 callback ShowCallback = void(); | 9 callback ShowCallback = void(); |
| 10 callback HideCallback = void(); |
10 callback SetEnabledCallback = void(); | 11 callback SetEnabledCallback = void(); |
11 | 12 |
12 interface Functions { | 13 interface Functions { |
13 // Pushes a subpage state onto a state stack for the launcher page. This | 14 // Pushes a subpage state onto a state stack for the launcher page. This |
14 // state will be popped when the launcher's back button is pressed, | 15 // state will be popped when the launcher's back button is pressed, |
15 // preventing the launcher from hiding the launcher page and sending an | 16 // preventing the launcher from hiding the launcher page and sending an |
16 // onPopSubpage event to the launcher page. Once all states are popped, the | 17 // onPopSubpage event to the launcher page. Once all states are popped, the |
17 // next press of the back button will cause the launcher to be hidden. | 18 // next press of the back button will cause the launcher to be hidden. |
18 // | 19 // |
19 // Note: All subpages are immediately popped when the launcher is closed or | 20 // Note: All subpages are immediately popped when the launcher is closed or |
20 // the launcher page is otherwise hidden. | 21 // the launcher page is otherwise hidden. |
21 static void pushSubpage(optional PushSubpageCallback callback); | 22 static void pushSubpage(optional PushSubpageCallback callback); |
22 | 23 |
23 // Opens the launcher if it isn't currently open and shows the launcher | 24 // Opens the launcher if it isn't currently open and shows the launcher |
24 // page. | 25 // page. |
25 static void show(optional ShowCallback callback); | 26 static void show(optional ShowCallback callback); |
26 | 27 |
| 28 // Returns the launcher to the start page if the launcher page is showing. |
| 29 static void hide(optional HideCallback callback); |
| 30 |
27 // Sets whether the launcher page is enabled in the launcher. If disabled, | 31 // Sets whether the launcher page is enabled in the launcher. If disabled, |
28 // the launcher page will not be shown when the area at the bottom of the | 32 // the launcher page will not be shown when the area at the bottom of the |
29 // launcher is pressed. | 33 // launcher is pressed. |
30 // | 34 // |
31 // Note: The launcher page will still be displayed at the bottom of the | 35 // Note: The launcher page will still be displayed at the bottom of the |
32 // launcher's start page and launcherPage.show() will still show the | 36 // launcher's start page and launcherPage.show() will still show the |
33 // launcher page. | 37 // launcher page. |
34 static void setEnabled(boolean enabled, | 38 static void setEnabled(boolean enabled, |
35 optional SetEnabledCallback callback); | 39 optional SetEnabledCallback callback); |
36 }; | 40 }; |
37 | 41 |
38 interface Events { | 42 interface Events { |
39 // Fired when the launcher page is transitioning between hidden and shown. | 43 // Fired when the launcher page is transitioning between hidden and shown. |
40 // It's possible for this to be called with a pushed subpage so this | 44 // It's possible for this to be called with a pushed subpage so this |
41 // event handler should account for transitioning from any subpage to a | 45 // event handler should account for transitioning from any subpage to a |
42 // collapsed view. | 46 // collapsed view. |
43 static void onTransitionChanged(double progress); | 47 static void onTransitionChanged(double progress); |
44 | 48 |
45 // Fired when the launcher's back button is pressed if there are remaining | 49 // Fired when the launcher's back button is pressed if there are remaining |
46 // subpages on the state stack pushed by pushSubpage(). | 50 // subpages on the state stack pushed by pushSubpage(). |
47 static void onPopSubpage(); | 51 static void onPopSubpage(); |
48 }; | 52 }; |
49 }; | 53 }; |
OLD | NEW |