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_
10 #include "base/base_export.h"
11 #include "base/callback.h"
12 #include "base/files/file_path.h"
13 #include "base/strings/string16.h"
18 // Identifies the type of the metro launch.
19 enum MetroLaunchType
{
29 // In metro mode, this enum identifies the last execution state, i.e. whether
30 // we crashed, terminated, etc.
31 enum MetroPreviousExecutionState
{
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
{
46 METRO_PIN_REQUEST_SHOW_ERROR
,
47 METRO_PIN_RESULT_CANCEL
,
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
,
60 // Contains information about the currently displayed tab in metro mode.
61 struct CurrentTabInfo
{
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
,
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
,
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
);
125 #endif // BASE_WIN_METRO_H_