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_
11 #include "base/base_export.h"
12 #include "base/callback.h"
13 #include "base/files/file_path.h"
14 #include "base/strings/string16.h"
19 // Identifies the type of the metro launch.
20 enum MetroLaunchType
{
30 // In metro mode, this enum identifies the last execution state, i.e. whether
31 // we crashed, terminated, etc.
32 enum MetroPreviousExecutionState
{
41 // Enum values for UMA histogram reporting of site-specific tile pinning.
42 // TODO(tapted): Move this to win8/util when ready (http://crbug.com/160288).
43 enum MetroSecondaryTilePinUmaResult
{
47 METRO_PIN_REQUEST_SHOW_ERROR
,
48 METRO_PIN_RESULT_CANCEL
,
50 METRO_PIN_RESULT_OTHER
,
51 METRO_PIN_RESULT_ERROR
,
52 METRO_UNPIN_INITIATED
,
53 METRO_UNPIN_REQUEST_SHOW_ERROR
,
54 METRO_UNPIN_RESULT_CANCEL
,
55 METRO_UNPIN_RESULT_OK
,
56 METRO_UNPIN_RESULT_OTHER
,
57 METRO_UNPIN_RESULT_ERROR
,
61 // Contains information about the currently displayed tab in metro mode.
62 struct CurrentTabInfo
{
67 // Returns the handle to the metro dll loaded in the process. A NULL return
68 // indicates that the metro dll was not loaded in the process.
69 BASE_EXPORT HMODULE
GetMetroModule();
71 // Returns true if this process is running as an immersive program
72 // in Windows Metro mode.
73 BASE_EXPORT
bool IsMetroProcess();
75 // Returns true if the process identified by the handle passed in is an
76 // immersive (Metro) process.
77 BASE_EXPORT
bool IsProcessImmersive(HANDLE process
);
79 // Allocates and returns the destination string via the LocalAlloc API after
80 // copying the src to it.
81 BASE_EXPORT
wchar_t* LocalAllocAndCopyString(const string16
& src
);
83 // Returns true if Windows Parental control activity logging is enabled. This
84 // feature is available on Windows Vista and beyond.
85 // This function should ideally be called on the UI thread.
86 BASE_EXPORT
bool IsParentalControlActivityLoggingOn();
88 // Returns the type of launch and the activation params. For example if the
89 // the launch is for METRO_PROTOCOL then the params is a url.
90 BASE_EXPORT MetroLaunchType
GetMetroLaunchParams(string16
* params
);
92 // Handler function for the buttons on a metro dialog box
93 typedef void (*MetroDialogButtonPressedHandler
)();
95 // Handler function invoked when a metro style notification is clicked.
96 typedef void (*MetroNotificationClickedHandler
)(const wchar_t* context
);
98 // Function to display metro style notifications.
99 typedef void (*MetroNotification
)(const char* origin_url
,
100 const char* icon_url
,
101 const wchar_t* title
,
103 const wchar_t* display_source
,
104 const char* notification_id
,
105 MetroNotificationClickedHandler handler
,
106 const wchar_t* handler_context
);
108 // Function to cancel displayed notification.
109 typedef bool (*MetroCancelNotification
)(const char* notification_id
);
111 // Callback for UMA invoked by Metro Pin and UnPin functions after user gesture.
112 typedef base::Callback
<void(MetroSecondaryTilePinUmaResult
)>
113 MetroPinUmaResultCallback
;
115 // Function to pin a site-specific tile (bookmark) to the start screen.
116 typedef void (*MetroPinToStartScreen
)(
117 const string16
& tile_id
,
118 const string16
& title
,
120 const FilePath
& logo_path
,
121 const MetroPinUmaResultCallback
& callback
);
123 // Function to un-pin a site-specific tile (bookmark) from the start screen.
124 typedef void (*MetroUnPinFromStartScreen
)(
125 const string16
& title_id
,
126 const MetroPinUmaResultCallback
& callback
);
131 #endif // BASE_WIN_METRO_H_