Chromecast: adds scheme for local file support in Android.
[chromium-blink-merge.git] / win8 / metro_driver / winrt_utils.h
blobe3a777f9bc9cc3a2ff9a95e029c5a150c7bf8045
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 WIN8_METRO_DRIVER_WINRT_UTILS_H_
6 #define WIN8_METRO_DRIVER_WINRT_UTILS_H_
8 #include <string>
10 #include <roapi.h>
11 #include <windows.applicationmodel.core.h>
13 #include "base/strings/string16.h"
15 void CheckHR(HRESULT hr, const char* str = nullptr);
17 HSTRING MakeHString(const base::string16& str);
19 base::string16 MakeStdWString(HSTRING hstring);
21 namespace winrt_utils {
23 template<unsigned int size, typename T>
24 HRESULT CreateActivationFactory(wchar_t const (&class_name)[size], T** object) {
25 mswrw::HStringReference ref_class_name(class_name);
26 return winfoundtn::GetActivationFactory(ref_class_name.Get(), object);
29 #define DECLARE_CREATE_PROPERTY(Name, Type) \
30 HRESULT Create ## Name ## Property( \
31 Type value, \
32 winfoundtn::IPropertyValue** prop);
34 DECLARE_CREATE_PROPERTY(String, HSTRING);
35 DECLARE_CREATE_PROPERTY(Int16, INT16);
36 DECLARE_CREATE_PROPERTY(Int32, INT32);
37 DECLARE_CREATE_PROPERTY(Int64, INT64);
38 DECLARE_CREATE_PROPERTY(UInt8, UINT8);
39 DECLARE_CREATE_PROPERTY(UInt16, UINT16);
40 DECLARE_CREATE_PROPERTY(UInt32, UINT32);
41 DECLARE_CREATE_PROPERTY(UInt64, UINT64);
43 // Compares |lhs| with |rhs| and return the |result| as
44 // WindowsCompareStringOrdinal would do, i.e.,
45 // -1 if |lhs| is less than |rhs|, 0 if they are equal, and
46 // +1 if |lhs| is greater than |rhs|.
47 HRESULT CompareProperties(
48 winfoundtn::IPropertyValue* lhs, winfoundtn::IPropertyValue* rhs,
49 INT32* result);
51 // Looks for a pinned taskbar shortcut in the current user's profile. If it
52 // finds one, will return any arguments that have been appended to the
53 // shortcut's command line. This is intended for scenarios where those shortcut
54 // parameters are ordinarily ignored (i.e. metro apps on win8). Returns an
55 // empty string on failure.
56 base::string16 ReadArgumentsFromPinnedTaskbarShortcut();
58 } // namespace winrt_utils
60 #endif // WIN8_METRO_DRIVER_WINRT_UTILS_H_