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

Unified Diff: chrome/browser/autocomplete/autocomplete_edit_view_win.cc

Issue 6386009: Remove app/win/win_util.h,cc etc. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Code cleanup Created 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/autocomplete/autocomplete_edit_view_win.cc
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_win.cc b/chrome/browser/autocomplete/autocomplete_edit_view_win.cc
index 89d8f55aa4ddbd75ee875eae2d48c3452f012211..fe55d629826dba4cbb1dc80cb45a2ade36b7d62c 100644
--- a/chrome/browser/autocomplete/autocomplete_edit_view_win.cc
+++ b/chrome/browser/autocomplete/autocomplete_edit_view_win.cc
@@ -12,7 +12,6 @@
#include <textserv.h>
#include "app/win/iat_patch_function.h"
-#include "app/win/win_util.h"
#include "base/auto_reset.h"
#include "base/basictypes.h"
#include "base/i18n/rtl.h"
@@ -50,6 +49,7 @@
#include "ui/base/keycodes/keyboard_codes.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/l10n/l10n_util_win.h"
+#include "views/controls/textfield/native_textfield_win.h"
#include "views/drag_utils.h"
#include "views/focus/focus_util_win.h"
#include "views/widget/widget.h"
@@ -261,6 +261,16 @@ struct AutocompleteEditState {
const AutocompleteEditViewWin::State view_state;
};
+// Returns true if the current point is far enough from the origin that it
+// would be considered a drag.
+bool IsDrag(const POINT& origin, const POINT& current) {
+ // The CXDRAG and CYDRAG system metrics describe the width and height of a
+ // rectangle around the origin position, inside of which motion is not
+ // considered a drag.
+ return (abs(current.x - origin.x) > (GetSystemMetrics(SM_CXDRAG) / 2)) ||
+ (abs(current.y - origin.y) > (GetSystemMetrics(SM_CYDRAG) / 2));
+}
+
} // namespace
///////////////////////////////////////////////////////////////////////////////
@@ -964,7 +974,7 @@ bool AutocompleteEditViewWin::SkipDefaultKeyEventProcessing(
// We don't process ALT + numpad digit as accelerators, they are used for
// entering special characters. We do translate alt-home.
if (e.IsAltDown() && (key != ui::VKEY_HOME) &&
- app::win::IsNumPadDigit(key, e.IsExtendedKey()))
+ views::NativeTextfieldWin::IsNumPadDigit(key, e.IsExtendedKey()))
return true;
// Skip accelerators for key combinations omnibox wants to crack. This list
@@ -1460,8 +1470,8 @@ void AutocompleteEditViewWin::OnLButtonDown(UINT keys, const CPoint& point) {
// double_click_time_ from the current message's time even if the timer has
// wrapped in between.
const bool is_triple_click = tracking_double_click_ &&
- app::win::IsDoubleClick(double_click_point_, point,
- GetCurrentMessage()->time - double_click_time_);
+ views::NativeTextfieldWin::IsDoubleClick(double_click_point_, point,
+ GetCurrentMessage()->time - double_click_time_);
tracking_double_click_ = false;
if (!gaining_focus_.get() && !is_triple_click)
@@ -1560,7 +1570,7 @@ void AutocompleteEditViewWin::OnMouseMove(UINT keys, const CPoint& point) {
return;
}
- if (tracking_click_[kLeft] && !app::win::IsDrag(click_point_[kLeft], point))
+ if (tracking_click_[kLeft] && !IsDrag(click_point_[kLeft], point))
return;
tracking_click_[kLeft] = false;
@@ -2376,7 +2386,7 @@ ITextDocument* AutocompleteEditViewWin::GetTextObjectModel() const {
}
void AutocompleteEditViewWin::StartDragIfNecessary(const CPoint& point) {
- if (initiated_drag_ || !app::win::IsDrag(click_point_[kLeft], point))
+ if (initiated_drag_ || !IsDrag(click_point_[kLeft], point))
return;
ui::OSExchangeData data;
@@ -2533,7 +2543,7 @@ void AutocompleteEditViewWin::SelectAllIfNecessary(MouseButton button,
const CPoint& point) {
// When the user has clicked and released to give us focus, select all.
if (tracking_click_[button] &&
- !app::win::IsDrag(click_point_[button], point)) {
+ !IsDrag(click_point_[button], point)) {
// Select all in the reverse direction so as not to scroll the caret
// into view and shift the contents jarringly.
SelectAll(true);

Powered by Google App Engine
This is Rietveld 408576698