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

Unified Diff: ui/base/win/open_file_name_win.cc

Issue 2123803003: Remove WinXP hook for OPENFILENAME (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/base/win/open_file_name_win.h ('k') | ui/shell_dialogs/select_file_dialog_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/win/open_file_name_win.cc
diff --git a/ui/base/win/open_file_name_win.cc b/ui/base/win/open_file_name_win.cc
index 8b32ae203034f74e0d2376d9f94ae2d3335eca44..77dc41ff482381109d95be6e0cf1680c9a002fac 100644
--- a/ui/base/win/open_file_name_win.cc
+++ b/ui/base/win/open_file_name_win.cc
@@ -5,69 +5,11 @@
#include "ui/base/win/open_file_name_win.h"
#include "base/files/file_path.h"
-#include "base/macros.h"
#include "base/strings/string_util.h"
-#include "base/win/windows_version.h"
namespace ui {
namespace win {
-namespace {
-
-// Ensures that the Save As dialog is on-screen.
-UINT_PTR CALLBACK SaveAsDialogHook(HWND dialog, UINT message,
- WPARAM wparam, LPARAM lparam) {
- static const UINT kPrivateMessage = 0x2F3F;
- switch (message) {
- case WM_INITDIALOG: {
- // Do nothing here. Just post a message to defer actual processing.
- ::PostMessage(dialog, kPrivateMessage, 0, 0);
- return TRUE;
- }
- case kPrivateMessage: {
- // The dialog box is the parent of the current handle.
- HWND real_dialog = ::GetParent(dialog);
-
- // Retrieve the final size.
- RECT dialog_rect;
- ::GetWindowRect(real_dialog, &dialog_rect);
-
- // Verify that the upper left corner is visible.
- POINT point = { dialog_rect.left, dialog_rect.top };
- HMONITOR monitor1 = ::MonitorFromPoint(point, MONITOR_DEFAULTTONULL);
- point.x = dialog_rect.right;
- point.y = dialog_rect.bottom;
-
- // Verify that the lower right corner is visible.
- HMONITOR monitor2 = ::MonitorFromPoint(point, MONITOR_DEFAULTTONULL);
- if (monitor1 && monitor2)
- return 0;
-
- // Some part of the dialog box is not visible, fix it by moving is to the
- // client rect position of the browser window.
- HWND parent_window = ::GetParent(real_dialog);
- if (!parent_window)
- return 0;
- WINDOWINFO parent_info;
- parent_info.cbSize = sizeof(WINDOWINFO);
- ::GetWindowInfo(parent_window, &parent_info);
- ::SetWindowPos(
- real_dialog,
- NULL,
- parent_info.rcClient.left,
- parent_info.rcClient.top,
- 0,
- 0, // Size.
- SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOSIZE | SWP_NOZORDER);
-
- return 0;
- }
- }
- return 0;
-}
-
-} // namespace
-
OpenFileName::OpenFileName(HWND parent_window, DWORD flags) {
::ZeroMemory(&openfilename_, sizeof(openfilename_));
openfilename_.lStructSize = sizeof(openfilename_);
@@ -127,15 +69,6 @@ void OpenFileName::SetInitialSelection(const base::FilePath& initial_directory,
arraysize(filename_buffer_));
}
-void OpenFileName::MaybeInstallWindowPositionHookForSaveAsOnXP() {
- if (base::win::GetVersion() >= base::win::VERSION_VISTA)
- return;
-
- openfilename_.Flags |= OFN_ENABLEHOOK;
- DCHECK(!openfilename_.lpfnHook);
- openfilename_.lpfnHook = &SaveAsDialogHook;
-}
-
base::FilePath OpenFileName::GetSingleResult() {
base::FilePath directory;
std::vector<base::FilePath> filenames;
« no previous file with comments | « ui/base/win/open_file_name_win.h ('k') | ui/shell_dialogs/select_file_dialog_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698