OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "app/win_util.h" | 5 #include "app/win_util.h" |
6 | 6 |
7 #include <commdlg.h> | 7 #include <commdlg.h> |
8 #include <dwmapi.h> | 8 #include <dwmapi.h> |
9 #include <shellapi.h> | 9 #include <shellapi.h> |
10 #include <shlobj.h> | 10 #include <shlobj.h> |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 int buffer_size = GetDateFormat(LOCALE_USER_DEFAULT, NULL, &date, format_ptr, | 125 int buffer_size = GetDateFormat(LOCALE_USER_DEFAULT, NULL, &date, format_ptr, |
126 NULL, 0); | 126 NULL, 0); |
127 | 127 |
128 std::wstring output; | 128 std::wstring output; |
129 GetDateFormat(LOCALE_USER_DEFAULT, NULL, &date, format_ptr, | 129 GetDateFormat(LOCALE_USER_DEFAULT, NULL, &date, format_ptr, |
130 WriteInto(&output, buffer_size), buffer_size); | 130 WriteInto(&output, buffer_size), buffer_size); |
131 | 131 |
132 return output; | 132 return output; |
133 } | 133 } |
134 | 134 |
135 bool ConvertToLongPath(const std::wstring& short_path, | |
136 std::wstring* long_path) { | |
137 wchar_t long_path_buf[MAX_PATH]; | |
138 DWORD return_value = GetLongPathName(short_path.c_str(), long_path_buf, | |
139 MAX_PATH); | |
140 if (return_value != 0 && return_value < MAX_PATH) { | |
141 *long_path = long_path_buf; | |
142 return true; | |
143 } | |
144 | |
145 return false; | |
146 } | |
147 | |
148 bool IsDoubleClick(const POINT& origin, | 135 bool IsDoubleClick(const POINT& origin, |
149 const POINT& current, | 136 const POINT& current, |
150 DWORD elapsed_time) { | 137 DWORD elapsed_time) { |
151 // The CXDOUBLECLK and CYDOUBLECLK system metrics describe the width and | 138 // The CXDOUBLECLK and CYDOUBLECLK system metrics describe the width and |
152 // height of a rectangle around the origin position, inside of which clicks | 139 // height of a rectangle around the origin position, inside of which clicks |
153 // within the double click time are considered double clicks. | 140 // within the double click time are considered double clicks. |
154 return (elapsed_time <= GetDoubleClickTime()) && | 141 return (elapsed_time <= GetDoubleClickTime()) && |
155 (abs(current.x - origin.x) <= (GetSystemMetrics(SM_CXDOUBLECLK) / 2)) && | 142 (abs(current.x - origin.x) <= (GetSystemMetrics(SM_CXDOUBLECLK) / 2)) && |
156 (abs(current.y - origin.y) <= (GetSystemMetrics(SM_CYDOUBLECLK) / 2)); | 143 (abs(current.y - origin.y) <= (GetSystemMetrics(SM_CYDOUBLECLK) / 2)); |
157 } | 144 } |
(...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
880 hwnd, __uuidof(*pps), reinterpret_cast<void**>(pps.Receive())); | 867 hwnd, __uuidof(*pps), reinterpret_cast<void**>(pps.Receive())); |
881 if (S_OK == result) { | 868 if (S_OK == result) { |
882 SetAppIdForPropertyStore(pps, app_id.c_str()); | 869 SetAppIdForPropertyStore(pps, app_id.c_str()); |
883 } | 870 } |
884 | 871 |
885 // Cleanup. | 872 // Cleanup. |
886 base::UnloadNativeLibrary(shell32_library); | 873 base::UnloadNativeLibrary(shell32_library); |
887 } | 874 } |
888 | 875 |
889 } // namespace win_util | 876 } // namespace win_util |
OLD | NEW |