OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 "chrome/browser/ui/views/omnibox/omnibox_view_win.h" | 5 #include "chrome/browser/ui/views/omnibox/omnibox_view_win.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <locale> | 8 #include <locale> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 #include "ui/base/dragdrop/os_exchange_data.h" | 56 #include "ui/base/dragdrop/os_exchange_data.h" |
57 #include "ui/base/dragdrop/os_exchange_data_provider_win.h" | 57 #include "ui/base/dragdrop/os_exchange_data_provider_win.h" |
58 #include "ui/base/events/event.h" | 58 #include "ui/base/events/event.h" |
59 #include "ui/base/events/event_constants.h" | 59 #include "ui/base/events/event_constants.h" |
60 #include "ui/base/ime/win/tsf_bridge.h" | 60 #include "ui/base/ime/win/tsf_bridge.h" |
61 #include "ui/base/ime/win/tsf_event_router.h" | 61 #include "ui/base/ime/win/tsf_event_router.h" |
62 #include "ui/base/keycodes/keyboard_codes.h" | 62 #include "ui/base/keycodes/keyboard_codes.h" |
63 #include "ui/base/l10n/l10n_util.h" | 63 #include "ui/base/l10n/l10n_util.h" |
64 #include "ui/base/l10n/l10n_util_win.h" | 64 #include "ui/base/l10n/l10n_util_win.h" |
65 #include "ui/base/win/mouse_wheel_util.h" | 65 #include "ui/base/win/mouse_wheel_util.h" |
| 66 #include "ui/base/win/touch_input.h" |
66 #include "ui/gfx/canvas.h" | 67 #include "ui/gfx/canvas.h" |
67 #include "ui/gfx/image/image.h" | 68 #include "ui/gfx/image/image.h" |
68 #include "ui/views/button_drag_utils.h" | 69 #include "ui/views/button_drag_utils.h" |
69 #include "ui/views/controls/menu/menu_item_view.h" | 70 #include "ui/views/controls/menu/menu_item_view.h" |
70 #include "ui/views/controls/menu/menu_model_adapter.h" | 71 #include "ui/views/controls/menu/menu_model_adapter.h" |
71 #include "ui/views/controls/menu/menu_runner.h" | 72 #include "ui/views/controls/menu/menu_runner.h" |
72 #include "ui/views/controls/textfield/native_textfield_win.h" | 73 #include "ui/views/controls/textfield/native_textfield_win.h" |
73 #include "ui/views/widget/widget.h" | 74 #include "ui/views/widget/widget.h" |
74 #include "win8/util/win8_util.h" | 75 #include "win8/util/win8_util.h" |
75 | 76 |
(...skipping 1487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1563 WPARAM wparam, | 1564 WPARAM wparam, |
1564 LPARAM lparam) { | 1565 LPARAM lparam) { |
1565 // There is a bug in Windows 8 where in the generated mouse messages | 1566 // There is a bug in Windows 8 where in the generated mouse messages |
1566 // after touch go to the window which previously had focus. This means that | 1567 // after touch go to the window which previously had focus. This means that |
1567 // if a user taps the omnibox to give it focus, we don't get the simulated | 1568 // if a user taps the omnibox to give it focus, we don't get the simulated |
1568 // WM_LBUTTONDOWN, and thus don't properly select all the text. To ensure | 1569 // WM_LBUTTONDOWN, and thus don't properly select all the text. To ensure |
1569 // that we get this message, we capture the mouse when the user is doing a | 1570 // that we get this message, we capture the mouse when the user is doing a |
1570 // single-point tap on an unfocused model. | 1571 // single-point tap on an unfocused model. |
1571 if ((wparam == 1) && !model()->has_focus()) { | 1572 if ((wparam == 1) && !model()->has_focus()) { |
1572 TOUCHINPUT point = {0}; | 1573 TOUCHINPUT point = {0}; |
1573 if (GetTouchInputInfo(reinterpret_cast<HTOUCHINPUT>(lparam), 1, | 1574 if (ui::GetTouchInputInfoWrapper(reinterpret_cast<HTOUCHINPUT>(lparam), 1, |
1574 &point, sizeof(TOUCHINPUT))) { | 1575 &point, sizeof(TOUCHINPUT))) { |
1575 if (point.dwFlags & TOUCHEVENTF_DOWN) | 1576 if (point.dwFlags & TOUCHEVENTF_DOWN) |
1576 SetCapture(); | 1577 SetCapture(); |
1577 else if (point.dwFlags & TOUCHEVENTF_UP) | 1578 else if (point.dwFlags & TOUCHEVENTF_UP) |
1578 ReleaseCapture(); | 1579 ReleaseCapture(); |
1579 } | 1580 } |
1580 } | 1581 } |
1581 SetMsgHandled(false); | 1582 SetMsgHandled(false); |
1582 return 0; | 1583 return 0; |
1583 } | 1584 } |
1584 | 1585 |
(...skipping 1253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2838 return (rect.left - client_rect.left) + (client_rect.right - rect.right); | 2839 return (rect.left - client_rect.left) + (client_rect.right - rect.right); |
2839 } | 2840 } |
2840 | 2841 |
2841 int OmniboxViewWin::WidthNeededToDisplay(const string16& text) const { | 2842 int OmniboxViewWin::WidthNeededToDisplay(const string16& text) const { |
2842 // Use font_.GetStringWidth() instead of | 2843 // Use font_.GetStringWidth() instead of |
2843 // PosFromChar(location_entry_->GetTextLength()) because PosFromChar() is | 2844 // PosFromChar(location_entry_->GetTextLength()) because PosFromChar() is |
2844 // apparently buggy. In both LTR UI and RTL UI with left-to-right layout, | 2845 // apparently buggy. In both LTR UI and RTL UI with left-to-right layout, |
2845 // PosFromChar(i) might return 0 when i is greater than 1. | 2846 // PosFromChar(i) might return 0 when i is greater than 1. |
2846 return font_.GetStringWidth(text) + GetHorizontalMargin(); | 2847 return font_.GetStringWidth(text) + GetHorizontalMargin(); |
2847 } | 2848 } |
OLD | NEW |