OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/base/win/shell.h" | 5 #include "ui/base/win/shell.h" |
6 | 6 |
7 #include <dwmapi.h> | 7 #include <dwmapi.h> |
8 #include <shlobj.h> // Must be before propkey. | 8 #include <shlobj.h> // Must be before propkey. |
9 #include <propkey.h> | 9 #include <propkey.h> |
10 #include <shellapi.h> | 10 #include <shellapi.h> |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 bool OpenItemViaShell(const base::FilePath& full_path) { | 91 bool OpenItemViaShell(const base::FilePath& full_path) { |
92 return OpenAnyViaShell(full_path.value(), full_path.DirName().value(), | 92 return OpenAnyViaShell(full_path.value(), full_path.DirName().value(), |
93 string16(), 0); | 93 string16(), 0); |
94 } | 94 } |
95 | 95 |
96 bool OpenItemViaShellNoZoneCheck(const base::FilePath& full_path) { | 96 bool OpenItemViaShellNoZoneCheck(const base::FilePath& full_path) { |
97 return OpenAnyViaShell(full_path.value(), string16(), string16(), | 97 return OpenAnyViaShell(full_path.value(), string16(), string16(), |
98 SEE_MASK_NOZONECHECKS | SEE_MASK_FLAG_DDEWAIT); | 98 SEE_MASK_NOZONECHECKS | SEE_MASK_FLAG_DDEWAIT); |
99 } | 99 } |
100 | 100 |
| 101 bool PreventWindowFromPinning(HWND hwnd) { |
| 102 // This functionality is only available on Win7+. It also doesn't make sense |
| 103 // to do this for Chrome Metro. |
| 104 if (base::win::GetVersion() < base::win::VERSION_WIN7 || |
| 105 base::win::IsMetroProcess()) |
| 106 return false; |
| 107 base::win::ScopedComPtr<IPropertyStore> pps; |
| 108 HRESULT result = SHGetPropertyStoreForWindow( |
| 109 hwnd, __uuidof(*pps), reinterpret_cast<void**>(pps.Receive())); |
| 110 if (FAILED(result)) |
| 111 return false; |
| 112 |
| 113 return base::win::SetBooleanValueForPropertyStore( |
| 114 pps, PKEY_AppUserModel_PreventPinning, true); |
| 115 } |
| 116 |
101 void SetAppIdForWindow(const string16& app_id, HWND hwnd) { | 117 void SetAppIdForWindow(const string16& app_id, HWND hwnd) { |
102 SetAppDetailsForWindow(app_id, string16(), string16(), string16(), hwnd); | 118 SetAppDetailsForWindow(app_id, string16(), string16(), string16(), hwnd); |
103 } | 119 } |
104 | 120 |
105 void SetAppIconForWindow(const string16& app_icon, HWND hwnd) { | 121 void SetAppIconForWindow(const string16& app_icon, HWND hwnd) { |
106 SetAppDetailsForWindow(string16(), app_icon, string16(), string16(), hwnd); | 122 SetAppDetailsForWindow(string16(), app_icon, string16(), string16(), hwnd); |
107 } | 123 } |
108 | 124 |
109 void SetRelaunchDetailsForWindow(const string16& relaunch_command, | 125 void SetRelaunchDetailsForWindow(const string16& relaunch_command, |
110 const string16& display_name, | 126 const string16& display_name, |
(...skipping 16 matching lines...) Expand all Loading... |
127 | 143 |
128 if (base::win::GetVersion() < base::win::VERSION_VISTA) | 144 if (base::win::GetVersion() < base::win::VERSION_VISTA) |
129 return false; | 145 return false; |
130 // If composition is not enabled, we behave like on XP. | 146 // If composition is not enabled, we behave like on XP. |
131 BOOL enabled = FALSE; | 147 BOOL enabled = FALSE; |
132 return SUCCEEDED(DwmIsCompositionEnabled(&enabled)) && enabled; | 148 return SUCCEEDED(DwmIsCompositionEnabled(&enabled)) && enabled; |
133 } | 149 } |
134 | 150 |
135 } // namespace win | 151 } // namespace win |
136 } // namespace ui | 152 } // namespace ui |
OLD | NEW |