1 // Copyright 2010-2018, Google Inc.
2 // All rights reserved.
3 //
4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are
6 // met:
7 //
8 //     * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer.
10 //     * Redistributions in binary form must reproduce the above
11 // copyright notice, this list of conditions and the following disclaimer
12 // in the documentation and/or other materials provided with the
13 // distribution.
14 //     * Neither the name of Google Inc. nor the names of its
15 // contributors may be used to endorse or promote products derived from
16 // this software without specific prior written permission.
17 //
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 
30 #ifndef MOZC_GUI_BASE_WIN_UTIL_H_
31 #define MOZC_GUI_BASE_WIN_UTIL_H_
32 
33 #include "base/port.h"
34 
35 namespace mozc {
36 namespace gui {
37 
38 class WinUtil {
39  public:
40   // Activate a visible window first found in the process specified by
41   // |process_id|. The caller process must satisfy the condition
42   // described in the following document.
43   // http://msdn.microsoft.com/en-us/library/windows/desktop/ms633539.aspx
44   static void ActivateWindow(uint32 process_id);
45 
46   // return true if IME hotkey is disabled.
47   static bool GetIMEHotKeyDisabled();
48 
49   // If |disabled| true, disable IME hotkey (Ctrl+Shift).
50   // return true if the operation finishes successfully.
51   // This function actually edits the registry entry as follows:
52   // - |disabled| is true:
53   //    Set "3" (REG_SZ) to "Keyboard Layout\\Toggle\\Layout Hotkey".
54   // - |disabled| is false:
55   //  Remove "Keyboard Layout\\Toggle\\Layout Hotkey".
56   //  It is OK to remove this value. After removing the entry,
57   //  Default setting is used.
58   static bool SetIMEHotKeyDisabled(bool disabled);
59 
60   // This method keeps JumpList to be up-to-date on Windows 7.
61   // Does nothing on any other platform.
62   static void KeepJumpListUpToDate();
63 
64  private:
WinUtil()65   WinUtil() {}
~WinUtil()66   ~WinUtil() {}
67 
68   DISALLOW_COPY_AND_ASSIGN(WinUtil);
69 };
70 }  // namespace gui
71 }  // namespace mozc
72 
73 #endif  // MOZC_GUI_BASE_WIN_UTIL_H_
74