OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef BASE_WIN_METRO_H_ | |
6 #define BASE_WIN_METRO_H_ | |
7 | |
8 #include <windows.h> | |
9 | |
10 #include "base/base_export.h" | |
11 #include "base/callback.h" | |
12 #include "base/files/file_path.h" | |
13 #include "base/strings/string16.h" | |
14 | |
15 namespace base { | |
16 namespace win { | |
17 | |
18 // Identifies the type of the metro launch. | |
19 enum MetroLaunchType { | |
20 METRO_LAUNCH, | |
21 METRO_SEARCH, | |
22 METRO_SHARE, | |
23 METRO_FILE, | |
24 METRO_PROTOCOL, | |
25 METRO_LAUNCH_ERROR, | |
26 METRO_LASTLAUNCHTYPE, | |
27 }; | |
28 | |
29 // In metro mode, this enum identifies the last execution state, i.e. whether | |
30 // we crashed, terminated, etc. | |
31 enum MetroPreviousExecutionState { | |
32 NOTRUNNING, | |
33 RUNNING, | |
34 SUSPENDED, | |
35 TERMINATED, | |
36 CLOSEDBYUSER, | |
37 LASTEXECUTIONSTATE, | |
38 }; | |
39 | |
40 // Enum values for UMA histogram reporting of site-specific tile pinning. | |
41 // TODO(tapted): Move this to win8/util when ready (http://crbug.com/160288). | |
42 enum MetroSecondaryTilePinUmaResult { | |
43 METRO_PIN_STATE_NONE, | |
44 METRO_PIN_INITIATED, | |
45 METRO_PIN_LOGO_READY, | |
46 METRO_PIN_REQUEST_SHOW_ERROR, | |
47 METRO_PIN_RESULT_CANCEL, | |
48 METRO_PIN_RESULT_OK, | |
49 METRO_PIN_RESULT_OTHER, | |
50 METRO_PIN_RESULT_ERROR, | |
51 METRO_UNPIN_INITIATED, | |
52 METRO_UNPIN_REQUEST_SHOW_ERROR, | |
53 METRO_UNPIN_RESULT_CANCEL, | |
54 METRO_UNPIN_RESULT_OK, | |
55 METRO_UNPIN_RESULT_OTHER, | |
56 METRO_UNPIN_RESULT_ERROR, | |
57 METRO_PIN_STATE_LIMIT | |
58 }; | |
59 | |
60 // Contains information about the currently displayed tab in metro mode. | |
61 struct CurrentTabInfo { | |
62 wchar_t* title; | |
63 wchar_t* url; | |
64 }; | |
65 | |
66 // Returns true if Chrome supports Metro-mode on this Windows version. | |
67 BASE_EXPORT bool IsChromeMetroSupported(); | |
68 | |
69 // Returns the handle to the metro dll loaded in the process. A NULL return | |
70 // indicates that the metro dll was not loaded in the process. | |
71 BASE_EXPORT HMODULE GetMetroModule(); | |
72 | |
73 // Returns true if this process is running as an immersive program | |
74 // in Windows Metro mode. | |
75 BASE_EXPORT bool IsMetroProcess(); | |
76 | |
77 // Returns true if the process identified by the handle passed in is an | |
78 // immersive (Metro) process. | |
79 BASE_EXPORT bool IsProcessImmersive(HANDLE process); | |
80 | |
81 // Allocates and returns the destination string via the LocalAlloc API after | |
82 // copying the src to it. | |
83 BASE_EXPORT wchar_t* LocalAllocAndCopyString(const string16& src); | |
84 | |
85 // Returns the type of launch and the activation params. For example if the | |
86 // the launch is for METRO_PROTOCOL then the params is a url. | |
87 BASE_EXPORT MetroLaunchType GetMetroLaunchParams(string16* params); | |
88 | |
89 // Handler function for the buttons on a metro dialog box | |
90 typedef void (*MetroDialogButtonPressedHandler)(); | |
91 | |
92 // Handler function invoked when a metro style notification is clicked. | |
93 typedef void (*MetroNotificationClickedHandler)(const wchar_t* context); | |
94 | |
95 // Function to display metro style notifications. | |
96 typedef void (*MetroNotification)(const char* origin_url, | |
97 const char* icon_url, | |
98 const wchar_t* title, | |
99 const wchar_t* body, | |
100 const wchar_t* display_source, | |
101 const char* notification_id, | |
102 MetroNotificationClickedHandler handler, | |
103 const wchar_t* handler_context); | |
104 | |
105 // Function to cancel displayed notification. | |
106 typedef bool (*MetroCancelNotification)(const char* notification_id); | |
107 | |
108 // Callback for UMA invoked by Metro Pin and UnPin functions after user gesture. | |
109 typedef base::Callback<void(MetroSecondaryTilePinUmaResult)> | |
110 MetroPinUmaResultCallback; | |
111 | |
112 // Function to pin a site-specific tile (bookmark) to the start screen. | |
113 typedef void (*MetroPinToStartScreen)( | |
114 const string16& tile_id, | |
115 const string16& title, | |
116 const string16& url, | |
117 const FilePath& logo_path, | |
118 const MetroPinUmaResultCallback& callback); | |
119 | |
120 // Function to un-pin a site-specific tile (bookmark) from the start screen. | |
121 typedef void (*MetroUnPinFromStartScreen)( | |
122 const string16& title_id, | |
123 const MetroPinUmaResultCallback& callback); | |
124 | |
125 } // namespace win | |
126 } // namespace base | |
127 | |
128 #endif // BASE_WIN_METRO_H_ | |
OLD | NEW |