Compute can_use_lcd_text using property trees.
[chromium-blink-merge.git] / base / win / metro.h
blob0696006751954df8c0438a328e2553424b80f22c
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.
5 #ifndef BASE_WIN_METRO_H_
6 #define BASE_WIN_METRO_H_
8 #include <windows.h>
10 #include "base/base_export.h"
11 #include "base/callback.h"
12 #include "base/files/file_path.h"
13 #include "base/strings/string16.h"
15 namespace base {
16 namespace win {
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,
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,
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
60 // Contains information about the currently displayed tab in metro mode.
61 struct CurrentTabInfo {
62 wchar_t* title;
63 wchar_t* url;
66 // Returns the handle to the metro dll loaded in the process. A NULL return
67 // indicates that the metro dll was not loaded in the process.
68 BASE_EXPORT HMODULE GetMetroModule();
70 // Returns true if this process is running as an immersive program
71 // in Windows Metro mode.
72 BASE_EXPORT bool IsMetroProcess();
74 // Returns true if the process identified by the handle passed in is an
75 // immersive (Metro) process.
76 BASE_EXPORT bool IsProcessImmersive(HANDLE process);
78 // Allocates and returns the destination string via the LocalAlloc API after
79 // copying the src to it.
80 BASE_EXPORT wchar_t* LocalAllocAndCopyString(const string16& src);
82 // Returns the type of launch and the activation params. For example if the
83 // the launch is for METRO_PROTOCOL then the params is a url.
84 BASE_EXPORT MetroLaunchType GetMetroLaunchParams(string16* params);
86 // Handler function for the buttons on a metro dialog box
87 typedef void (*MetroDialogButtonPressedHandler)();
89 // Handler function invoked when a metro style notification is clicked.
90 typedef void (*MetroNotificationClickedHandler)(const wchar_t* context);
92 // Function to display metro style notifications.
93 typedef void (*MetroNotification)(const char* origin_url,
94 const char* icon_url,
95 const wchar_t* title,
96 const wchar_t* body,
97 const wchar_t* display_source,
98 const char* notification_id,
99 MetroNotificationClickedHandler handler,
100 const wchar_t* handler_context);
102 // Function to cancel displayed notification.
103 typedef bool (*MetroCancelNotification)(const char* notification_id);
105 // Callback for UMA invoked by Metro Pin and UnPin functions after user gesture.
106 typedef base::Callback<void(MetroSecondaryTilePinUmaResult)>
107 MetroPinUmaResultCallback;
109 // Function to pin a site-specific tile (bookmark) to the start screen.
110 typedef void (*MetroPinToStartScreen)(
111 const string16& tile_id,
112 const string16& title,
113 const string16& url,
114 const FilePath& logo_path,
115 const MetroPinUmaResultCallback& callback);
117 // Function to un-pin a site-specific tile (bookmark) from the start screen.
118 typedef void (*MetroUnPinFromStartScreen)(
119 const string16& title_id,
120 const MetroPinUmaResultCallback& callback);
122 } // namespace win
123 } // namespace base
125 #endif // BASE_WIN_METRO_H_