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 // Returns true if this process is running under Text Services Framework (TSF)
80 // and browser must be TSF-aware.
81 BASE_EXPORT
bool IsTSFAwareRequired();
83 // Allocates and returns the destination string via the LocalAlloc API after
84 // copying the src to it.
85 BASE_EXPORT
wchar_t* LocalAllocAndCopyString(const string16
& src
);
87 // Returns true if Windows Parental control activity logging is enabled. This
88 // feature is available on Windows Vista and beyond.
89 // This function should ideally be called on the UI thread.
90 BASE_EXPORT
bool IsParentalControlActivityLoggingOn();
92 // Returns the type of launch and the activation params. For example if the
93 // the launch is for METRO_PROTOCOL then the params is a url.
94 BASE_EXPORT MetroLaunchType
GetMetroLaunchParams(string16
* params
);
96 // Handler function for the buttons on a metro dialog box
97 typedef void (*MetroDialogButtonPressedHandler
)();
99 // Handler function invoked when a metro style notification is clicked.
100 typedef void (*MetroNotificationClickedHandler
)(const wchar_t* context
);
102 // Function to display metro style notifications.
103 typedef void (*MetroNotification
)(const char* origin_url
,
104 const char* icon_url
,
105 const wchar_t* title
,
107 const wchar_t* display_source
,
108 const char* notification_id
,
109 MetroNotificationClickedHandler handler
,
110 const wchar_t* handler_context
);
112 // Function to cancel displayed notification.
113 typedef bool (*MetroCancelNotification
)(const char* notification_id
);
115 // Callback for UMA invoked by Metro Pin and UnPin functions after user gesture.
116 typedef base::Callback
<void(MetroSecondaryTilePinUmaResult
)>
117 MetroPinUmaResultCallback
;
119 // Function to pin a site-specific tile (bookmark) to the start screen.
120 typedef void (*MetroPinToStartScreen
)(
121 const string16
& tile_id
,
122 const string16
& title
,
124 const FilePath
& logo_path
,
125 const MetroPinUmaResultCallback
& callback
);
127 // Function to un-pin a site-specific tile (bookmark) from the start screen.
128 typedef void (*MetroUnPinFromStartScreen
)(
129 const string16
& title_id
,
130 const MetroPinUmaResultCallback
& callback
);
135 #endif // BASE_WIN_METRO_H_