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

Unified Diff: base/win_util.cc

Issue 6019007: Remove win_util::FormatMessage and FormatLastWin32Error. These were only used... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/win_util.h ('k') | base/win_util_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/win_util.cc
===================================================================
--- base/win_util.cc (revision 70263)
+++ base/win_util.cc (working copy)
@@ -70,30 +70,6 @@
return true;
}
-#pragma warning(push)
-#pragma warning(disable:4312 4244)
-WNDPROC SetWindowProc(HWND hwnd, WNDPROC proc) {
- // The reason we don't return the SetwindowLongPtr() value is that it returns
- // the orignal window procedure and not the current one. I don't know if it is
- // a bug or an intended feature.
- WNDPROC oldwindow_proc =
- reinterpret_cast<WNDPROC>(GetWindowLongPtr(hwnd, GWLP_WNDPROC));
- SetWindowLongPtr(hwnd, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(proc));
- return oldwindow_proc;
-}
-
-void* SetWindowUserData(HWND hwnd, void* user_data) {
- return
- reinterpret_cast<void*>(SetWindowLongPtr(hwnd, GWLP_USERDATA,
- reinterpret_cast<LONG_PTR>(user_data)));
-}
-
-void* GetWindowUserData(HWND hwnd) {
- return reinterpret_cast<void*>(GetWindowLongPtr(hwnd, GWLP_USERDATA));
-}
-
-#pragma warning(pop)
-
bool IsShiftPressed() {
return (::GetKeyState(VK_SHIFT) & 0x8000) == 0x8000;
}
@@ -106,27 +82,6 @@
return (::GetKeyState(VK_MENU) & 0x8000) == 0x8000;
}
-std::wstring GetClassName(HWND window) {
- // GetClassNameW will return a truncated result (properly null terminated) if
- // the given buffer is not large enough. So, it is not possible to determine
- // that we got the entire class name if the result is exactly equal to the
- // size of the buffer minus one.
- DWORD buffer_size = MAX_PATH;
- while (true) {
- std::wstring output;
- DWORD size_ret =
- GetClassNameW(window, WriteInto(&output, buffer_size), buffer_size);
- if (size_ret == 0)
- break;
- if (size_ret < (buffer_size - 1)) {
- output.resize(size_ret);
- return output;
- }
- buffer_size *= 2;
- }
- return std::wstring(); // error
-}
-
bool UserAccountControlIsEnabled() {
// This can be slow if Windows ends up going to disk. Should watch this key
// for changes and only read it once, preferably on the file thread.
@@ -144,28 +99,6 @@
return (uac_enabled != 0);
}
-std::wstring FormatMessage(unsigned messageid) {
- wchar_t* string_buffer = NULL;
- unsigned string_length = ::FormatMessage(
- FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS, NULL, messageid, 0,
- reinterpret_cast<wchar_t *>(&string_buffer), 0, NULL);
-
- std::wstring formatted_string;
- if (string_buffer) {
- formatted_string = string_buffer;
- LocalFree(reinterpret_cast<HLOCAL>(string_buffer));
- } else {
- // The formating failed. simply convert the message value into a string.
- base::SStringPrintf(&formatted_string, L"message number %d", messageid);
- }
- return formatted_string;
-}
-
-std::wstring FormatLastWin32Error() {
- return FormatMessage(GetLastError());
-}
-
bool SetAppIdForPropertyStore(IPropertyStore* property_store,
const wchar_t* app_id) {
DCHECK(property_store);
« no previous file with comments | « base/win_util.h ('k') | base/win_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698