diff options
author | brettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-30 15:38:47 +0000 |
---|---|---|
committer | brettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-30 15:38:47 +0000 |
commit | fff369b8be4e7df5af4f9c2cedd29234248fd35b (patch) | |
tree | 4e6494c94c2cb379273ab1beab20c0c142485601 | |
parent | c376c45bd9f166acbdc776c640161d7fbd5956a4 (diff) | |
download | chromium_src-fff369b8be4e7df5af4f9c2cedd29234248fd35b.zip chromium_src-fff369b8be4e7df5af4f9c2cedd29234248fd35b.tar.gz chromium_src-fff369b8be4e7df5af4f9c2cedd29234248fd35b.tar.bz2 |
Remove win_util::FormatMessage and FormatLastWin32Error. These were only used in a couple of diagnostic places and one can always use the "Error Lookup" utility.
Move window HWND-specific functions from base/win_util.h to a new file app/win/hwnd_util.h. I plan to put some more stuff from app/win_util into this file as well.
Move gfx/window_impl.h into app/win
TEST=it compiles
BUG=none
Review URL: http://codereview.chromium.org/6019007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70312 0039d316-1c4b-4281-b951-d872f2087c98
38 files changed, 192 insertions, 217 deletions
diff --git a/app/app_base.gypi b/app/app_base.gypi index 6b4e363..f2be9f1 100644 --- a/app/app_base.gypi +++ b/app/app_base.gypi @@ -234,10 +234,14 @@ 'win/drag_source.h', 'win/drop_target.cc', 'win/drop_target.h', + 'win/hwnd_util.cc', + 'win/hwnd_util.h', 'win/iat_patch_function.cc', 'win/iat_patch_function.h', 'win/scoped_prop.cc', 'win/scoped_prop.h', + 'win/window_impl.cc', + 'win/window_impl.h', 'x11_util.cc', 'x11_util.h', 'x11_util_internal.h', diff --git a/app/win/hwnd_util.cc b/app/win/hwnd_util.cc new file mode 100644 index 0000000..b0be404 --- /dev/null +++ b/app/win/hwnd_util.cc @@ -0,0 +1,59 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "app/win/hwnd_util.h" + +#include "base/string_util.h" + +namespace app { +namespace win { + +string16 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 +} + +#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) + +} // namespace win +} // namespace app diff --git a/app/win/hwnd_util.h b/app/win/hwnd_util.h new file mode 100644 index 0000000..f8ae37e --- /dev/null +++ b/app/win/hwnd_util.h @@ -0,0 +1,31 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef APP_WIN_HWND_UTIL_H_ +#define APP_WIN_HWND_UTIL_H_ +#pragma once + +#include <windows.h> + +#include "base/string16.h" + +namespace app { +namespace win { + +// A version of the GetClassNameW API that returns the class name in an +// string16. An empty result indicates a failure to get the class name. +string16 GetClassName(HWND hwnd); + +// Useful for subclassing a HWND. Returns the previous window procedure. +WNDPROC SetWindowProc(HWND hwnd, WNDPROC wndproc); + +// Pointer-friendly wrappers around Get/SetWindowLong(..., GWLP_USERDATA, ...) +// Returns the previously set value. +void* SetWindowUserData(HWND hwnd, void* user_data); +void* GetWindowUserData(HWND hwnd); + +} // namespace win +} // namespace app + +#endif // APP_WIN_HWND_UTIL_H_ diff --git a/app/win/scoped_prop.cc b/app/win/scoped_prop.cc index e2d623e..203e1e4 100644 --- a/app/win/scoped_prop.cc +++ b/app/win/scoped_prop.cc @@ -18,7 +18,7 @@ ScopedProp::ScopedProp(HWND hwnd, const std::wstring& key, HANDLE data) // is going to ask for the property and get NULL. So, rather than crash later // on when someone expects a non-NULL value we crash here in hopes of // diagnosing the failure. - CHECK(result) << win_util::FormatLastWin32Error(); + CHECK(result) << ::GetLastError(); } ScopedProp::~ScopedProp() { diff --git a/gfx/window_impl.cc b/app/win/window_impl.cc index b85f2f2..a0f0b3f 100644 --- a/gfx/window_impl.cc +++ b/app/win/window_impl.cc @@ -2,15 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "gfx/window_impl.h" +#include "app/win/window_impl.h" #include <list> +#include "app/win/hwnd_util.h" #include "base/singleton.h" #include "base/string_number_conversions.h" -#include "base/win_util.h" -namespace gfx { +namespace app { +namespace win { static const DWORD kWindowDefaultChildStyle = WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS; @@ -149,7 +150,7 @@ void WindowImpl::Init(HWND parent, const gfx::Rect& bounds) { DCHECK(hwnd_); // The window procedure should have set the data for us. - DCHECK(win_util::GetWindowUserData(hwnd_) == this); + DCHECK(app::win::GetWindowUserData(hwnd_) == this); } HICON WindowImpl::GetDefaultWindowIcon() const { @@ -186,13 +187,13 @@ LRESULT CALLBACK WindowImpl::WndProc(HWND hwnd, CREATESTRUCT* cs = reinterpret_cast<CREATESTRUCT*>(l_param); WindowImpl* window = reinterpret_cast<WindowImpl*>(cs->lpCreateParams); DCHECK(window); - win_util::SetWindowUserData(hwnd, window); + app::win::SetWindowUserData(hwnd, window); window->hwnd_ = hwnd; return TRUE; } WindowImpl* window = reinterpret_cast<WindowImpl*>( - win_util::GetWindowUserData(hwnd)); + app::win::GetWindowUserData(hwnd)); if (!window) return 0; @@ -227,4 +228,5 @@ std::wstring WindowImpl::GetWindowClassName() { return name; } -} // namespace gfx +} // namespace win +} // namespace app diff --git a/gfx/window_impl.h b/app/win/window_impl.h index 8ce230a..606f4c2 100644 --- a/gfx/window_impl.h +++ b/app/win/window_impl.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef GFX_WINDOW_IMPL_H_ -#define GFX_WINDOW_IMPL_H_ +#ifndef APP_WIN_WINDOW_IMPL_H_ +#define APP_WIN_WINDOW_IMPL_H_ #pragma once #include <atlbase.h> @@ -17,7 +17,8 @@ #include "gfx/native_widget_types.h" #include "gfx/rect.h" -namespace gfx { +namespace app { +namespace win { // An interface implemented by classes that use message maps. // ProcessWindowMessage is implemented by the BEGIN_MESSAGE_MAP_EX macro. @@ -109,6 +110,7 @@ class WindowImpl : public MessageMapInterface { DISALLOW_COPY_AND_ASSIGN(WindowImpl); }; -} // namespace gfx +} // namespace win +} // namespace app -#endif // GFX_WINDOW_IMPL_H_ +#endif // APP_WIN_WINDOW_IMPL_H_ diff --git a/base/file_util_win.cc b/base/file_util_win.cc index 3ca52ae..2644803 100644 --- a/base/file_util_win.cc +++ b/base/file_util_win.cc @@ -757,9 +757,8 @@ int WriteFile(const FilePath& filename, const char* data, int size) { 0, NULL)); if (!file) { - LOG(WARNING) << "CreateFile failed for path " << filename.value() << - " error code=" << GetLastError() << - " error text=" << win_util::FormatLastWin32Error(); + LOG(WARNING) << "CreateFile failed for path " << filename.value() + << " error code=" << GetLastError(); return -1; } @@ -770,9 +769,8 @@ int WriteFile(const FilePath& filename, const char* data, int size) { if (!result) { // WriteFile failed. - LOG(WARNING) << "writing file " << filename.value() << - " failed, error code=" << GetLastError() << - " description=" << win_util::FormatLastWin32Error(); + LOG(WARNING) << "writing file " << filename.value() + << " failed, error code=" << GetLastError(); } else { // Didn't write all the bytes. LOG(WARNING) << "wrote" << written << " bytes to " << diff --git a/base/win_util.cc b/base/win_util.cc index 3fcfb92..b7d5cd7 100644 --- a/base/win_util.cc +++ b/base/win_util.cc @@ -70,30 +70,6 @@ bool GetUserSidString(std::wstring* user_sid) { 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 @@ bool IsAltPressed() { 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 @@ bool UserAccountControlIsEnabled() { 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); diff --git a/base/win_util.h b/base/win_util.h index 4ba7eeb..c06e9c7 100644 --- a/base/win_util.h +++ b/base/win_util.h @@ -23,14 +23,6 @@ void GetNonClientMetrics(NONCLIENTMETRICS* metrics); // Returns the string representing the current user sid. bool GetUserSidString(std::wstring* user_sid); -// Useful for subclassing a HWND. Returns the previous window procedure. -WNDPROC SetWindowProc(HWND hwnd, WNDPROC wndproc); - -// Pointer-friendly wrappers around Get/SetWindowLong(..., GWLP_USERDATA, ...) -// Returns the previously set value. -void* SetWindowUserData(HWND hwnd, void* user_data); -void* GetWindowUserData(HWND hwnd); - // Returns true if the shift key is currently pressed. bool IsShiftPressed(); @@ -40,10 +32,6 @@ bool IsCtrlPressed(); // Returns true if the alt key is currently pressed. bool IsAltPressed(); -// A version of the GetClassNameW API that returns the class name in an -// std::wstring. An empty result indicates a failure to get the class name. -std::wstring GetClassName(HWND window); - // Returns false if user account control (UAC) has been disabled with the // EnableLUA registry flag. Returns true if user account control is enabled. // NOTE: The EnableLUA registry flag, which is ignored on Windows XP @@ -52,13 +40,6 @@ std::wstring GetClassName(HWND window); // if the OS is Vista. bool UserAccountControlIsEnabled(); -// Use the Win32 API FormatMessage() function to generate a string, using -// Windows's default Message Compiled resources; ignoring the inserts. -std::wstring FormatMessage(unsigned messageid); - -// Uses the last Win32 error to generate a human readable message string. -std::wstring FormatLastWin32Error(); - // Sets the application id in given IPropertyStore. The function is intended // for tagging application/chromium shortcut, browser window and jump list for // Win7. diff --git a/base/win_util_unittest.cc b/base/win_util_unittest.cc index 673bc84..b0aeb8e 100644 --- a/base/win_util_unittest.cc +++ b/base/win_util_unittest.cc @@ -50,40 +50,3 @@ class ThreadLocaleSaver { }; } // namespace - -TEST(BaseWinUtilTest, FormatMessage) { - // Because we cannot write tests of every language, we only test the message - // of en-US locale. Here, we change the current locale temporarily. - ThreadLocaleSaver thread_locale_saver; - WORD language_id = MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US); - LCID locale_id = MAKELCID(language_id, SORT_DEFAULT); - ASSERT_TRUE(SetThreadLocale(locale_id)); - - const int kAccessDeniedErrorCode = 5; - SetLastError(kAccessDeniedErrorCode); - ASSERT_EQ(GetLastError(), kAccessDeniedErrorCode); - std::wstring value; - TrimWhitespace(win_util::FormatLastWin32Error(), TRIM_ALL, &value); - EXPECT_EQ(std::wstring(L"Access is denied."), value); - - // Manually call the OS function - wchar_t * string_buffer = NULL; - unsigned string_length = - ::FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | - FORMAT_MESSAGE_FROM_SYSTEM | - FORMAT_MESSAGE_IGNORE_INSERTS, NULL, - kAccessDeniedErrorCode, 0, - reinterpret_cast<wchar_t *>(&string_buffer), 0, NULL); - - // Verify the call succeeded - ASSERT_TRUE(string_length); - ASSERT_TRUE(string_buffer); - - // Verify the string is the same by different calls - EXPECT_EQ(win_util::FormatLastWin32Error(), std::wstring(string_buffer)); - EXPECT_EQ(win_util::FormatMessage(kAccessDeniedErrorCode), - std::wstring(string_buffer)); - - // Done with the buffer allocated by ::FormatMessage() - LocalFree(string_buffer); -} diff --git a/chrome/browser/aeropeek_manager.cc b/chrome/browser/aeropeek_manager.cc index eb5e8bf..e628224 100644 --- a/chrome/browser/aeropeek_manager.cc +++ b/chrome/browser/aeropeek_manager.cc @@ -7,6 +7,7 @@ #include <dwmapi.h> #include <shobjidl.h> +#include "app/win/window_impl.h" #include "app/win_util.h" #include "base/command_line.h" #include "base/scoped_comptr_win.h" @@ -32,7 +33,6 @@ #include "chrome/installer/util/browser_distribution.h" #include "gfx/gdi_util.h" #include "gfx/icon_util.h" -#include "gfx/window_impl.h" #include "skia/ext/image_operations.h" #include "skia/ext/platform_canvas.h" #include "third_party/skia/include/core/SkBitmap.h" @@ -545,7 +545,7 @@ class SendLivePreviewTask : public Task { // * Translating received messages for TabStrip. // This class is used by the AeroPeekManager class, which is a proxy // between TabStrip and Windows 7. -class AeroPeekWindow : public gfx::WindowImpl { +class AeroPeekWindow : public app::win::WindowImpl { public: AeroPeekWindow(HWND frame_window, AeroPeekWindowDelegate* delegate, diff --git a/chrome/browser/hang_monitor/hung_plugin_action.cc b/chrome/browser/hang_monitor/hung_plugin_action.cc index 9b719ca..b7a937c 100644 --- a/chrome/browser/hang_monitor/hung_plugin_action.cc +++ b/chrome/browser/hang_monitor/hung_plugin_action.cc @@ -7,8 +7,8 @@ #include "chrome/browser/hang_monitor/hung_plugin_action.h" #include "app/l10n_util.h" +#include "app/win/hwnd_util.h" #include "app/win_util.h" -#include "base/win_util.h" #include "chrome/browser/platform_util.h" #include "chrome/common/logging_chrome.h" #include "grit/generated_resources.h" @@ -133,7 +133,7 @@ bool HungPluginAction::GetPluginName(HWND plugin_window, // static BOOL CALLBACK HungPluginAction::DismissMessageBox(HWND window, LPARAM ignore) { - std::wstring class_name = win_util::GetClassNameW(window); + string16 class_name = app::win::GetClassName(window); // #32770 is the dialog window class which is the window class of // the message box being displayed. if (class_name == L"#32770") { diff --git a/chrome/browser/process_singleton_win.cc b/chrome/browser/process_singleton_win.cc index 1e86daa..cacbff6 100644 --- a/chrome/browser/process_singleton_win.cc +++ b/chrome/browser/process_singleton_win.cc @@ -5,6 +5,7 @@ #include "chrome/browser/process_singleton.h" #include "app/l10n_util.h" +#include "app/win/hwnd_util.h" #include "app/win_util.h" #include "base/base_paths.h" #include "base/command_line.h" @@ -12,7 +13,6 @@ #include "base/path_service.h" #include "base/process_util.h" #include "base/scoped_handle.h" -#include "base/win_util.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/extensions/extensions_startup.h" #include "chrome/browser/platform_util.h" @@ -192,7 +192,7 @@ bool ProcessSingleton::Create() { 0, 0, 0, 0, 0, HWND_MESSAGE, 0, hinst, 0); DCHECK(window_); - win_util::SetWindowUserData(window_, this); + app::win::SetWindowUserData(window_, this); return true; } diff --git a/chrome/browser/renderer_host/render_widget_host_view_win.cc b/chrome/browser/renderer_host/render_widget_host_view_win.cc index 72804de..ddbd313 100644 --- a/chrome/browser/renderer_host/render_widget_host_view_win.cc +++ b/chrome/browser/renderer_host/render_widget_host_view_win.cc @@ -9,6 +9,7 @@ #include "app/l10n_util.h" #include "app/l10n_util_win.h" #include "app/resource_bundle.h" +#include "app/win/hwnd_util.h" #include "app/view_prop.h" #include "base/command_line.h" #include "base/i18n/rtl.h" @@ -1448,7 +1449,7 @@ LRESULT RenderWidgetHostViewWin::OnMouseActivate(UINT message, ::ScreenToClient(m_hWnd, &cursor_pos); HWND child_window = ::RealChildWindowFromPoint(m_hWnd, cursor_pos); if (::IsWindow(child_window) && child_window != m_hWnd) { - if (win_util::GetClassName(child_window) == + if (app::win::GetClassName(child_window) == webkit::npapi::kWrapperNativeWindowClassName) child_window = ::GetWindow(child_window, GW_CHILD); diff --git a/chrome/browser/ui/views/status_icons/status_tray_win.cc b/chrome/browser/ui/views/status_icons/status_tray_win.cc index 29ed025..53f80f9 100644 --- a/chrome/browser/ui/views/status_icons/status_tray_win.cc +++ b/chrome/browser/ui/views/status_icons/status_tray_win.cc @@ -4,7 +4,7 @@ #include "chrome/browser/views/status_icons/status_tray_win.h" -#include "base/win_util.h" +#include "app/win/hwnd_util.h" #include "chrome/browser/views/status_icons/status_icon_win.h" #include "chrome/common/chrome_constants.h" @@ -25,7 +25,7 @@ StatusTrayWin::StatusTrayWin() // Create an offscreen window for handling messages for the status icons. window_ = CreateWindow(chrome::kStatusTrayWindowClass, 0, 0, 0, 0, 0, 0, HWND_MESSAGE, 0, hinst, 0); - win_util::SetWindowUserData(window_, this); + app::win::SetWindowUserData(window_, this); } LRESULT CALLBACK StatusTrayWin::WndProcStatic(HWND hwnd, diff --git a/chrome/default_plugin/plugin_impl_win.h b/chrome/default_plugin/plugin_impl_win.h index f6aa02f..c08816b 100644 --- a/chrome/default_plugin/plugin_impl_win.h +++ b/chrome/default_plugin/plugin_impl_win.h @@ -8,10 +8,10 @@ #include <string> +#include "app/win/window_impl.h" #include "chrome/default_plugin/install_dialog.h" #include "chrome/default_plugin/plugin_database_handler.h" #include "chrome/default_plugin/plugin_install_job_monitor.h" -#include "gfx/window_impl.h" #include "third_party/npapi/bindings/npapi.h" // Possible plugin installer states. @@ -34,7 +34,7 @@ class PluginDatabaseHandler; // Provides the plugin installation functionality. This class is // instantiated with the information like the mime type of the // target plugin, the display mode, etc. -class PluginInstallerImpl : public gfx::WindowImpl { +class PluginInstallerImpl : public app::win::WindowImpl { public: static const int kRefreshPluginsMessage = WM_APP + 1; diff --git a/chrome/tools/profiles/generate_profile.cc b/chrome/tools/profiles/generate_profile.cc index 89eebbd..d87366f 100644 --- a/chrome/tools/profiles/generate_profile.cc +++ b/chrome/tools/profiles/generate_profile.cc @@ -226,9 +226,9 @@ int main(int argc, const char* argv[]) { dst_dir = current_dir.Append(dst_dir); } if (!file_util::CreateDirectory(dst_dir)) { - printf("Unable to create directory %ls: %ls\n", + printf("Unable to create directory %ls: %d\n", dst_dir.value().c_str(), - win_util::FormatLastWin32Error().c_str()); + ::GetLastError()); } icu_util::Initialize(); @@ -278,8 +278,7 @@ int main(int argc, const char* argv[]) { printf("Copying file %ls to %ls\n", path.value().c_str(), dst_file.value().c_str()); if (!file_util::CopyFile(path, dst_file)) { - printf("Copying file failed: %ls\n", - win_util::FormatLastWin32Error().c_str()); + printf("Copying file failed: %d\n", ::GetLastError()); return -1; } path = file_iterator.Next(); diff --git a/chrome_frame/test/chrome_frame_test_utils.cc b/chrome_frame/test/chrome_frame_test_utils.cc index 6c84938..6b1f581 100644 --- a/chrome_frame/test/chrome_frame_test_utils.cc +++ b/chrome_frame/test/chrome_frame_test_utils.cc @@ -566,7 +566,7 @@ bool DetectRunningCrashService(int timeout_ms) { break; default: DLOG(WARNING) << "Unexpected error while checking crash_service.exe's " - << "pipe: " << win_util::FormatLastWin32Error(); + << ::GetLastError(); // Go ahead and wait in case it clears up. break; } @@ -2,4 +2,7 @@ include_rules = [ "+base", "+grit/gfx_resources.h", "+skia", + + # Allow the unit tests to use window_impl to pop up windows. + "+app/win/window_impl.h", ] diff --git a/gfx/canvas_direct2d_unittest.cc b/gfx/canvas_direct2d_unittest.cc index eaa6a79..2a50da2 100644 --- a/gfx/canvas_direct2d_unittest.cc +++ b/gfx/canvas_direct2d_unittest.cc @@ -7,6 +7,7 @@ #include <vsstyle.h> #include <vssym32.h> +#include "app/win/window_impl.h" #include "base/command_line.h" #include "base/ref_counted_memory.h" #include "base/resource_util.h" @@ -16,7 +17,6 @@ #include "gfx/canvas_skia.h" #include "gfx/codec/png_codec.h" #include "gfx/native_theme_win.h" -#include "gfx/window_impl.h" #include "gfx/win_util.h" #include "grit/gfx_resources.h" #include "testing/gtest/include/gtest/gtest.h" @@ -26,7 +26,7 @@ namespace { const char kVisibleModeFlag[] = "d2d-canvas-visible"; -class TestWindow : public gfx::WindowImpl { +class TestWindow : public app::win::WindowImpl { public: static const int kWindowSize = 500; static const int kWindowPosition = 10; diff --git a/gfx/gfx.gyp b/gfx/gfx.gyp index 76aea87..359e668 100644 --- a/gfx/gfx.gyp +++ b/gfx/gfx.gyp @@ -17,6 +17,7 @@ 'dependencies': [ 'gfx', 'gfx_resources', + '../app/app.gyp:app_base', '../base/base.gyp:test_support_base', '../skia/skia.gyp:skia', '../testing/gtest.gyp:gtest', @@ -149,8 +150,6 @@ 'icon_util.h', 'native_theme_win.cc', 'native_theme_win.h', - 'window_impl.cc', - 'window_impl.h', 'win_util.cc', 'win_util.h', ], diff --git a/tools/memory_watcher/hotkey.h b/tools/memory_watcher/hotkey.h index 3610d0f..8a0fb97 100644 --- a/tools/memory_watcher/hotkey.h +++ b/tools/memory_watcher/hotkey.h @@ -6,11 +6,11 @@ #define TOOLS_MEMORY_WATCHER_HOTKEY_H_ #include "gfx/rect.h" -#include "gfx/window_impl.h" +#include "app/win/window_impl.h" // HotKey handler. // Programs wishing to register a hotkey can use this. -class HotKeyHandler : public gfx::WindowImpl { +class HotKeyHandler : public app::win::WindowImpl { public: HotKeyHandler(UINT modifiers, UINT vk) : modifiers_(modifiers), diff --git a/views/controls/menu/menu_win.cc b/views/controls/menu/menu_win.cc index 0c75743..294ea7e 100644 --- a/views/controls/menu/menu_win.cc +++ b/views/controls/menu/menu_win.cc @@ -9,13 +9,13 @@ #include "app/keyboard_codes.h" #include "app/l10n_util.h" #include "app/l10n_util_win.h" +#include "app/win/window_impl.h" #include "base/logging.h" #include "base/stl_util-inl.h" #include "base/string_util.h" #include "gfx/canvas_skia.h" #include "gfx/font.h" #include "gfx/rect.h" -#include "gfx/window_impl.h" #include "views/accelerator.h" namespace views { @@ -62,7 +62,7 @@ static int ChromeGetMenuItemID(HMENU hMenu, int pos) { // to intercept right clicks on the HMENU and notify the delegate as well as // for drawing icons. // -class MenuHostWindow : public gfx::WindowImpl { +class MenuHostWindow : public app::win::WindowImpl { public: MenuHostWindow(MenuWin* menu, HWND parent_window) : menu_(menu) { int extended_style = 0; diff --git a/views/controls/menu/native_menu_win.cc b/views/controls/menu/native_menu_win.cc index 3c31639..cf36c8e 100644 --- a/views/controls/menu/native_menu_win.cc +++ b/views/controls/menu/native_menu_win.cc @@ -7,9 +7,9 @@ #include "app/keyboard_codes.h" #include "app/l10n_util.h" #include "app/l10n_util_win.h" +#include "app/win/hwnd_util.h" #include "base/logging.h" #include "base/stl_util-inl.h" -#include "base/win_util.h" #include "gfx/canvas_skia.h" #include "gfx/font.h" #include "third_party/skia/include/core/SkBitmap.h" @@ -56,7 +56,7 @@ class NativeMenuWin::MenuHostWindow { RegisterClass(); hwnd_ = CreateWindowEx(l10n_util::GetExtendedStyles(), kWindowClassName, L"", 0, 0, 0, 0, 0, HWND_MESSAGE, NULL, NULL, NULL); - win_util::SetWindowUserData(hwnd_, this); + app::win::SetWindowUserData(hwnd_, this); } ~MenuHostWindow() { @@ -275,7 +275,7 @@ class NativeMenuWin::MenuHostWindow { WPARAM w_param, LPARAM l_param) { MenuHostWindow* host = - reinterpret_cast<MenuHostWindow*>(win_util::GetWindowUserData(window)); + reinterpret_cast<MenuHostWindow*>(app::win::GetWindowUserData(window)); // host is null during initial construction. LRESULT l_result = 0; if (!host || !host->ProcessWindowMessage(window, message, w_param, l_param, diff --git a/views/controls/native_control.cc b/views/controls/native_control.cc index 13881bb..9434a50 100644 --- a/views/controls/native_control.cc +++ b/views/controls/native_control.cc @@ -13,10 +13,10 @@ #include "app/keyboard_code_conversion_win.h" #include "app/keyboard_codes.h" #include "app/l10n_util_win.h" +#include "app/win/hwnd_util.h" #include "app/view_prop.h" #include "base/logging.h" #include "base/scoped_ptr.h" -#include "base/win_util.h" #include "gfx/native_theme_win.h" #include "views/background.h" #include "views/border.h" @@ -89,7 +89,7 @@ class NativeControlContainer : public CWindowImpl<NativeControlContainer, control_ = parent_->CreateNativeControl(m_hWnd); // We subclass the control hwnd so we get the WM_KEYDOWN messages. - original_handler_ = win_util::SetWindowProc( + original_handler_ = app::win::SetWindowProc( control_, &NativeControl::NativeControlWndProc); prop_.reset(new ViewProp(control_, kNativeControlKey , parent_)); @@ -382,7 +382,7 @@ LRESULT CALLBACK NativeControl::NativeControlWndProc(HWND window, NOTREACHED(); } } else if (message == WM_DESTROY) { - win_util::SetWindowProc(window, + app::win::SetWindowProc(window, reinterpret_cast<WNDPROC>(original_handler)); native_control->container_->prop_.reset(); } diff --git a/views/controls/native_control_win.cc b/views/controls/native_control_win.cc index a223993..0c24fef 100644 --- a/views/controls/native_control_win.cc +++ b/views/controls/native_control_win.cc @@ -7,9 +7,9 @@ #include <windowsx.h> #include "app/l10n_util_win.h" +#include "app/win/hwnd_util.h" #include "app/view_prop.h" #include "base/logging.h" -#include "base/win_util.h" #include "views/focus/focus_manager.h" using app::ViewProp; @@ -136,9 +136,8 @@ void NativeControlWin::NativeControlCreated(HWND native_control) { props_.push_back(ChildWindowMessageProcessor::Register(native_control, this)); // Subclass so we get WM_KEYDOWN and WM_SETFOCUS messages. - original_wndproc_ = - win_util::SetWindowProc(native_control, - &NativeControlWin::NativeControlWndProc); + original_wndproc_ = app::win::SetWindowProc( + native_control, &NativeControlWin::NativeControlWndProc); Attach(native_control); // native_view() is now valid. @@ -214,7 +213,7 @@ LRESULT NativeControlWin::NativeControlWndProc(HWND window, } } else if (message == WM_DESTROY) { native_control->props_.reset(); - win_util::SetWindowProc(window, native_control->original_wndproc_); + app::win::SetWindowProc(window, native_control->original_wndproc_); } return CallWindowProc(native_control->original_wndproc_, window, message, diff --git a/views/controls/scrollbar/native_scroll_bar_win.cc b/views/controls/scrollbar/native_scroll_bar_win.cc index 55592a8a..0aea447c 100644 --- a/views/controls/scrollbar/native_scroll_bar_win.cc +++ b/views/controls/scrollbar/native_scroll_bar_win.cc @@ -8,8 +8,8 @@ #include <string> #include "app/keyboard_codes.h" +#include "app/win/window_impl.h" #include "base/message_loop.h" -#include "gfx/window_impl.h" #include "views/controls/scrollbar/native_scroll_bar.h" #include "views/controls/scrollbar/scroll_bar.h" #include "views/widget/widget.h" @@ -24,7 +24,7 @@ namespace views { // use instances of this class to wrap native scrollbars. // ///////////////////////////////////////////////////////////////////////////// -class ScrollBarContainer : public gfx::WindowImpl { +class ScrollBarContainer : public app::win::WindowImpl { public: explicit ScrollBarContainer(ScrollBar* parent) : parent_(parent), diff --git a/views/controls/table/native_table_win.cc b/views/controls/table/native_table_win.cc index 82561e1..35769c6 100644 --- a/views/controls/table/native_table_win.cc +++ b/views/controls/table/native_table_win.cc @@ -10,8 +10,8 @@ #include "app/l10n_util.h" #include "app/l10n_util_win.h" #include "app/table_model.h" +#include "app/win/hwnd_util.h" #include "base/logging.h" -#include "base/win_util.h" #include "gfx/canvas_skia.h" #include "gfx/favicon_size.h" #include "gfx/icon_util.h" @@ -408,12 +408,12 @@ void NativeTableWin::CreateNativeControl() { DCHECK(header); SetWindowLongPtr(header, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(this)); header_original_handler_ = - win_util::SetWindowProc(header, &NativeTableWin::TableHeaderWndProc); + app::win::SetWindowProc(header, &NativeTableWin::TableHeaderWndProc); } SetWindowLongPtr(hwnd, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(this)); original_handler_ = - win_util::SetWindowProc(hwnd, &NativeTableWin::TableWndProc); + app::win::SetWindowProc(hwnd, &NativeTableWin::TableWndProc); // Bug 964884: detach the IME attached to this window. // We should attach IMEs only when we need to input CJK strings. diff --git a/views/controls/table/table_view.cc b/views/controls/table/table_view.cc index 84c0538..d35b074 100644 --- a/views/controls/table/table_view.cc +++ b/views/controls/table/table_view.cc @@ -13,9 +13,9 @@ #include "app/l10n_util_win.h" #include "app/resource_bundle.h" #include "app/table_model.h" +#include "app/win/hwnd_util.h" #include "base/i18n/rtl.h" #include "base/string_util.h" -#include "base/win_util.h" #include "gfx/canvas_skia.h" #include "gfx/favicon_size.h" #include "gfx/font.h" @@ -835,14 +835,14 @@ HWND TableView::CreateNativeControl(HWND parent_container) { DCHECK(header); SetWindowLongPtr(header, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(&table_view_wrapper_)); - header_original_handler_ = win_util::SetWindowProc(header, + header_original_handler_ = app::win::SetWindowProc(header, &TableView::TableHeaderWndProc); } SetWindowLongPtr(list_view_, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(&table_view_wrapper_)); original_handler_ = - win_util::SetWindowProc(list_view_, &TableView::TableWndProc); + app::win::SetWindowProc(list_view_, &TableView::TableWndProc); // Bug 964884: detach the IME attached to this window. // We should attach IMEs only when we need to input CJK strings. diff --git a/views/controls/tree/tree_view.cc b/views/controls/tree/tree_view.cc index bfdd454..5fe2ef9 100644 --- a/views/controls/tree/tree_view.cc +++ b/views/controls/tree/tree_view.cc @@ -10,6 +10,7 @@ #include "app/keyboard_codes.h" #include "app/l10n_util_win.h" #include "app/resource_bundle.h" +#include "app/win/hwnd_util.h" #include "base/i18n/rtl.h" #include "base/logging.h" #include "base/stl_util-inl.h" @@ -336,8 +337,7 @@ HWND TreeView::CreateNativeControl(HWND parent_container) { parent_container, NULL, NULL, NULL); SetWindowLongPtr(tree_view_, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(&wrapper_)); - original_handler_ = win_util::SetWindowProc(tree_view_, - &TreeWndProc); + original_handler_ = app::win::SetWindowProc(tree_view_, &TreeWndProc); l10n_util::AdjustUIFontForWindow(tree_view_); if (model_) { diff --git a/views/focus/focus_util_win.cc b/views/focus/focus_util_win.cc index 23172ad..7261075 100644 --- a/views/focus/focus_util_win.cc +++ b/views/focus/focus_util_win.cc @@ -6,6 +6,7 @@ #include <windowsx.h> +#include "app/win/hwnd_util.h" #include "app/view_prop.h" #include "base/auto_reset.h" #include "base/win_util.h" @@ -34,7 +35,7 @@ static bool WindowSupportsRerouteMouseWheel(HWND window) { } static bool IsCompatibleWithMouseWheelRedirection(HWND window) { - std::wstring class_name = win_util::GetClassName(window); + std::wstring class_name = app::win::GetClassName(window); // Mousewheel redirection to comboboxes is a surprising and // undesireable user behavior. return !(class_name == L"ComboBox" || @@ -42,7 +43,7 @@ static bool IsCompatibleWithMouseWheelRedirection(HWND window) { } static bool CanRedirectMouseWheelFrom(HWND window) { - std::wstring class_name = win_util::GetClassName(window); + std::wstring class_name = app::win::GetClassName(window); // Older Thinkpad mouse wheel drivers create a window under mouse wheel // pointer. Detect if we are dealing with this window. In this case we diff --git a/views/widget/widget_win.cc b/views/widget/widget_win.cc index b94efa3..a5ea141 100644 --- a/views/widget/widget_win.cc +++ b/views/widget/widget_win.cc @@ -8,9 +8,9 @@ #include "app/l10n_util_win.h" #include "app/system_monitor.h" #include "app/view_prop.h" +#include "app/win/hwnd_util.h" #include "app/win_util.h" #include "base/string_util.h" -#include "base/win_util.h" #include "gfx/canvas_skia.h" #include "gfx/native_theme_win.h" #include "gfx/path.h" @@ -78,7 +78,7 @@ WidgetWin* WidgetWin::GetWidget(HWND hwnd) { // WindowImpl). if (!WindowImpl::IsWindowImpl(hwnd)) return NULL; - return reinterpret_cast<WidgetWin*>(win_util::GetWindowUserData(hwnd)); + return reinterpret_cast<WidgetWin*>(app::win::GetWindowUserData(hwnd)); } // static @@ -1105,7 +1105,7 @@ Window* WidgetWin::GetWindowImpl(HWND hwnd) { HWND parent = hwnd; while (parent) { WidgetWin* widget = - reinterpret_cast<WidgetWin*>(win_util::GetWindowUserData(parent)); + reinterpret_cast<WidgetWin*>(app::win::GetWindowUserData(parent)); if (widget && widget->is_window_) return static_cast<WindowWin*>(widget); parent = ::GetParent(parent); diff --git a/views/widget/widget_win.h b/views/widget/widget_win.h index 0c9f1b0..849f5c9 100644 --- a/views/widget/widget_win.h +++ b/views/widget/widget_win.h @@ -14,10 +14,10 @@ #include <string> #include <vector> +#include "app/win/window_impl.h" #include "base/message_loop.h" #include "base/scoped_vector.h" #include "base/win/scoped_comptr.h" -#include "gfx/window_impl.h" #include "views/focus/focus_manager.h" #include "views/layout_manager.h" #include "views/widget/widget.h" @@ -74,7 +74,7 @@ const int WM_NCUAHDRAWFRAME = 0xAF; // then responsible for cleaning up after it. // /////////////////////////////////////////////////////////////////////////////// -class WidgetWin : public gfx::WindowImpl, +class WidgetWin : public app::win::WindowImpl, public Widget, public MessageLoopForUI::Observer, public FocusTraversable { diff --git a/views/window/window_win.cc b/views/window/window_win.cc index 5cf09bb..1f525e9 100644 --- a/views/window/window_win.cc +++ b/views/window/window_win.cc @@ -9,9 +9,9 @@ #include "app/keyboard_code_conversion_win.h" #include "app/theme_provider.h" +#include "app/win/hwnd_util.h" #include "app/win_util.h" #include "base/i18n/rtl.h" -#include "base/win_util.h" #include "base/win/windows_version.h" #include "gfx/canvas_skia_paint.h" #include "gfx/font.h" @@ -546,7 +546,7 @@ void WindowWin::Init(HWND parent, const gfx::Rect& bounds) { set_window_ex_style(CalculateWindowExStyle()); WidgetWin::Init(parent, bounds); - win_util::SetWindowUserData(GetNativeView(), this); + app::win::SetWindowUserData(GetNativeView(), this); // Create the ClientView, add it to the NonClientView and add the // NonClientView to the RootView. This will cause everything to be parented. diff --git a/webkit/tools/test_shell/foreground_helper.h b/webkit/tools/test_shell/foreground_helper.h index 1050236..40332d8 100644 --- a/webkit/tools/test_shell/foreground_helper.h +++ b/webkit/tools/test_shell/foreground_helper.h @@ -5,8 +5,8 @@ #ifndef WEBKIT_TOOLS_TEST_SHELL_FOREGROUND_HELPER_H_ #define WEBKIT_TOOLS_TEST_SHELL_FOREGROUND_HELPER_H_ +#include "app/win/window_impl.h" #include "base/logging.h" -#include "gfx/window_impl.h" // Helper class for moving a window to the foreground. // Windows XP and later will not allow a window which is in the background to @@ -15,7 +15,7 @@ // to be capable of moving to the foreground. // // This is probably leveraging a windows bug. -class ForegroundHelper : public gfx::WindowImpl { +class ForegroundHelper : public app::win::WindowImpl { public: BEGIN_MSG_MAP_EX(ForegroundHelper) MESSAGE_HANDLER(WM_HOTKEY, OnHotKey) diff --git a/webkit/tools/test_shell/test_shell_win.cc b/webkit/tools/test_shell/test_shell_win.cc index 60a4b1a..2d78895 100644 --- a/webkit/tools/test_shell/test_shell_win.cc +++ b/webkit/tools/test_shell/test_shell_win.cc @@ -10,6 +10,7 @@ #include <process.h> #include <shlwapi.h> +#include "app/win/hwnd_util.h" #include "base/command_line.h" #include "base/debug/trace_event.h" #include "base/file_util.h" @@ -21,7 +22,6 @@ #include "base/string_piece.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" -#include "base/win_util.h" #include "breakpad/src/client/windows/handler/exception_handler.h" #include "grit/webkit_resources.h" #include "grit/webkit_chromium_resources.h" @@ -233,7 +233,7 @@ void TestShell::DumpAllBackForwardLists(string16* result) { iter != TestShell::windowList()->end(); iter++) { HWND hwnd = *iter; TestShell* shell = - static_cast<TestShell*>(win_util::GetWindowUserData(hwnd)); + static_cast<TestShell*>(app::win::GetWindowUserData(hwnd)); shell->DumpBackForwardList(result); } } @@ -249,7 +249,7 @@ bool TestShell::RunFileTest(const TestParams& params) { HWND hwnd = *(TestShell::windowList()->begin()); TestShell* shell = - static_cast<TestShell*>(win_util::GetWindowUserData(hwnd)); + static_cast<TestShell*>(app::win::GetWindowUserData(hwnd)); // Clear focus between tests. shell->m_focusedWidgetHost = NULL; @@ -266,7 +266,7 @@ bool TestShell::RunFileTest(const TestParams& params) { // ResetTestController may have closed the window we were holding on to. // Grab the first window again. hwnd = *(TestShell::windowList()->begin()); - shell = static_cast<TestShell*>(win_util::GetWindowUserData(hwnd)); + shell = static_cast<TestShell*>(app::win::GetWindowUserData(hwnd)); DCHECK(shell); // Whether DevTools should be open before loading the page. @@ -339,8 +339,8 @@ std::string TestShell::RewriteLocalUrl(const std::string& url) { void TestShell::PlatformCleanUp() { // When the window is destroyed, tell the Edit field to forget about us, // otherwise we will crash. - win_util::SetWindowProc(m_editWnd, default_edit_wnd_proc_); - win_util::SetWindowUserData(m_editWnd, NULL); + app::win::SetWindowProc(m_editWnd, default_edit_wnd_proc_); + app::win::SetWindowUserData(m_editWnd, NULL); } void TestShell::EnableUIControl(UIControl control, bool is_enabled) { @@ -368,7 +368,7 @@ bool TestShell::Initialize(const GURL& starting_url) { WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN, CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, instance_handle_, NULL); - win_util::SetWindowUserData(m_mainWnd, this); + app::win::SetWindowUserData(m_mainWnd, this); HWND hwnd; int x = 0; @@ -404,8 +404,8 @@ bool TestShell::Initialize(const GURL& starting_url) { x, 0, 0, 0, m_mainWnd, 0, instance_handle_, 0); default_edit_wnd_proc_ = - win_util::SetWindowProc(m_editWnd, TestShell::EditWndProc); - win_util::SetWindowUserData(m_editWnd, this); + app::win::SetWindowProc(m_editWnd, TestShell::EditWndProc); + app::win::SetWindowUserData(m_editWnd, this); dev_tools_agent_.reset(new TestShellDevToolsAgent()); @@ -441,7 +441,7 @@ void TestShell::TestFinished() { if (dump_when_finished_) { HWND hwnd = *(TestShell::windowList()->begin()); TestShell* shell = - static_cast<TestShell*>(win_util::GetWindowUserData(hwnd)); + static_cast<TestShell*>(app::win::GetWindowUserData(hwnd)); TestShell::Dump(shell); } @@ -578,7 +578,7 @@ void TestShell::LoadURLForFrame(const GURL& url, LRESULT CALLBACK TestShell::WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { - TestShell* shell = static_cast<TestShell*>(win_util::GetWindowUserData(hwnd)); + TestShell* shell = static_cast<TestShell*>(app::win::GetWindowUserData(hwnd)); switch (message) { case WM_COMMAND: @@ -676,7 +676,7 @@ LRESULT CALLBACK TestShell::WndProc(HWND hwnd, UINT message, WPARAM wParam, LRESULT CALLBACK TestShell::EditWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { TestShell* shell = - static_cast<TestShell*>(win_util::GetWindowUserData(hwnd)); + static_cast<TestShell*>(app::win::GetWindowUserData(hwnd)); switch (message) { case WM_CHAR: diff --git a/webkit/tools/test_shell/webview_host_win.cc b/webkit/tools/test_shell/webview_host_win.cc index d7cab2d..2d908c0 100644 --- a/webkit/tools/test_shell/webview_host_win.cc +++ b/webkit/tools/test_shell/webview_host_win.cc @@ -1,10 +1,10 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "webkit/tools/test_shell/webview_host.h" -#include "base/win_util.h" +#include "app/win/hwnd_util.h" #include "gfx/rect.h" #include "gfx/size.h" #include "skia/ext/platform_canvas.h" @@ -40,7 +40,7 @@ WebViewHost* WebViewHost::Create(HWND parent_view, WS_CHILD|WS_CLIPCHILDREN|WS_CLIPSIBLINGS, 0, 0, 0, 0, parent_view, NULL, GetModuleHandle(NULL), NULL); - win_util::SetWindowUserData(host->view_, host); + app::win::SetWindowUserData(host->view_, host); host->webwidget_ = WebView::create(delegate, dev_tools_client); prefs.Apply(host->webview()); diff --git a/webkit/tools/test_shell/webwidget_host_win.cc b/webkit/tools/test_shell/webwidget_host_win.cc index 0ead127..54e2d11 100644 --- a/webkit/tools/test_shell/webwidget_host_win.cc +++ b/webkit/tools/test_shell/webwidget_host_win.cc @@ -4,8 +4,8 @@ #include "webkit/tools/test_shell/webwidget_host.h" +#include "app/win/hwnd_util.h" #include "base/logging.h" -#include "base/win_util.h" #include "gfx/rect.h" #include "skia/ext/platform_canvas.h" #include "third_party/WebKit/WebKit/chromium/public/WebInputEvent.h" @@ -52,7 +52,7 @@ WebWidgetHost* WebWidgetHost::Create(HWND parent_view, kWindowClassName, kWindowClassName, WS_POPUP, 0, 0, 0, 0, parent_view, NULL, GetModuleHandle(NULL), NULL); - win_util::SetWindowUserData(host->view_, host); + app::win::SetWindowUserData(host->view_, host); host->webwidget_ = WebPopupMenu::create(client); @@ -60,7 +60,7 @@ WebWidgetHost* WebWidgetHost::Create(HWND parent_view, } static WebWidgetHost* FromWindow(HWND view) { - return reinterpret_cast<WebWidgetHost*>(win_util::GetWindowUserData(view)); + return reinterpret_cast<WebWidgetHost*>(app::win::GetWindowUserData(view)); } /*static*/ @@ -205,7 +205,7 @@ WebWidgetHost::WebWidgetHost() } WebWidgetHost::~WebWidgetHost() { - win_util::SetWindowUserData(view_, 0); + app::win::SetWindowUserData(view_, 0); TrackMouseLeave(false); |