Added vitalybuka@ and noamsml@ to mdns extension api OWNERS
[chromium-blink-merge.git] / base / win / metro.h
blob5894ef06daed473355a8422c7b25753e5fcb9a94
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>
9 #include <wpcapi.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"
16 namespace base {
17 namespace win {
19 // Identifies the type of the metro launch.
20 enum MetroLaunchType {
21 METRO_LAUNCH,
22 METRO_SEARCH,
23 METRO_SHARE,
24 METRO_FILE,
25 METRO_PROTOCOL,
26 METRO_LAUNCH_ERROR,
27 METRO_LASTLAUNCHTYPE,
30 // In metro mode, this enum identifies the last execution state, i.e. whether
31 // we crashed, terminated, etc.
32 enum MetroPreviousExecutionState {
33 NOTRUNNING,
34 RUNNING,
35 SUSPENDED,
36 TERMINATED,
37 CLOSEDBYUSER,
38 LASTEXECUTIONSTATE,
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 {
44 METRO_PIN_STATE_NONE,
45 METRO_PIN_INITIATED,
46 METRO_PIN_LOGO_READY,
47 METRO_PIN_REQUEST_SHOW_ERROR,
48 METRO_PIN_RESULT_CANCEL,
49 METRO_PIN_RESULT_OK,
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,
58 METRO_PIN_STATE_LIMIT
61 // Contains information about the currently displayed tab in metro mode.
62 struct CurrentTabInfo {
63 wchar_t* title;
64 wchar_t* url;
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,
102 const wchar_t* body,
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,
119 const string16& url,
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);
128 } // namespace win
129 } // namespace base
131 #endif // BASE_WIN_METRO_H_