Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(360)

Side by Side Diff: app/win_util.cc

Issue 536028: Split win_util.cc - we need the code in ConvertToLongPath in the 64-bit Windows build (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « app/app_base.gypi ('k') | app/win_util_path.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « app/app_base.gypi ('k') | app/win_util_path.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698