Improve performance of registering font preferences
[chromium-blink-merge.git] / base / win / metro.h
blob41404a8a94dbd825d1d1712193f968e84440619e
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/string16.h"
14 namespace base {
15 namespace win {
17 // Identifies the type of the metro launch.
18 enum MetroLaunchType {
19 METRO_LAUNCH,
20 METRO_SEARCH,
21 METRO_SHARE,
22 METRO_FILE,
23 METRO_PROTOCOL,
24 METRO_LAUNCH_ERROR,
25 METRO_LASTLAUNCHTYPE,
28 // In metro mode, this enum identifies the last execution state, i.e. whether
29 // we crashed, terminated, etc.
30 enum MetroPreviousExecutionState {
31 NOTRUNNING,
32 RUNNING,
33 SUSPENDED,
34 TERMINATED,
35 CLOSEDBYUSER,
36 LASTEXECUTIONSTATE,
39 // Contains information about the currently displayed tab in metro mode.
40 struct CurrentTabInfo {
41 wchar_t* title;
42 wchar_t* url;
45 // Returns the handle to the metro dll loaded in the process. A NULL return
46 // indicates that the metro dll was not loaded in the process.
47 BASE_EXPORT HMODULE GetMetroModule();
49 // Returns true if this process is running as an immersive program
50 // in Windows Metro mode.
51 BASE_EXPORT bool IsMetroProcess();
53 // Returns true if the process identified by the handle passed in is an
54 // immersive (Metro) process.
55 BASE_EXPORT bool IsProcessImmersive(HANDLE process);
57 // Returns true if this process is running under Text Services Framework (TSF)
58 // and browser must be TSF-aware.
59 BASE_EXPORT bool IsTsfAwareRequired();
61 // Sets browser to use Text Service Framework (TSF) regardless of process
62 // status. On Windows 8, this function also disables CUAS (Cicero Unaware
63 // Application Support) to emulate Windows Metro mode in terms of IME
64 // functionality. This should be beneficial in QA process because on can test
65 // IME functionality in Windows 8 desktop mode.
66 BASE_EXPORT void SetForceToUseTsf();
68 // Allocates and returns the destination string via the LocalAlloc API after
69 // copying the src to it.
70 BASE_EXPORT wchar_t* LocalAllocAndCopyString(const string16& src);
72 // Returns true if the screen supports touch.
73 BASE_EXPORT bool IsTouchEnabled();
75 // Returns true if Windows Parental control activity logging is enabled. This
76 // feature is available on Windows Vista and beyond.
77 // This function should ideally be called on the UI thread.
78 BASE_EXPORT bool IsParentalControlActivityLoggingOn();
80 // Returns the type of launch and the activation params. For example if the
81 // the launch is for METRO_PROTOCOL then the params is a url.
82 BASE_EXPORT MetroLaunchType GetMetroLaunchParams(string16* params);
84 // Handler function for the buttons on a metro dialog box
85 typedef void (*MetroDialogButtonPressedHandler)();
87 // Handler function invoked when a metro style notification is clicked.
88 typedef void (*MetroNotificationClickedHandler)(const wchar_t* context);
90 // Function to display metro style notifications.
91 typedef void (*MetroNotification)(const char* origin_url,
92 const char* icon_url,
93 const wchar_t* title,
94 const wchar_t* body,
95 const wchar_t* display_source,
96 const char* notification_id,
97 MetroNotificationClickedHandler handler,
98 const wchar_t* handler_context);
100 } // namespace win
101 } // namespace base
103 #endif // BASE_WIN_METRO_H_