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

Side by Side Diff: chrome/browser/ui/views/omnibox/omnibox_view_win.cc

Issue 19805005: Refactored touch-events flag test, correcting "enabled" logic. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Renamed IsTouchEnabled to AreTouchEventsEnabled. Created 7 years, 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/chrome.user32.delay.imports » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 #include "ui/base/dragdrop/drop_target_win.h" 54 #include "ui/base/dragdrop/drop_target_win.h"
55 #include "ui/base/dragdrop/os_exchange_data.h" 55 #include "ui/base/dragdrop/os_exchange_data.h"
56 #include "ui/base/dragdrop/os_exchange_data_provider_win.h" 56 #include "ui/base/dragdrop/os_exchange_data_provider_win.h"
57 #include "ui/base/events/event.h" 57 #include "ui/base/events/event.h"
58 #include "ui/base/events/event_constants.h" 58 #include "ui/base/events/event_constants.h"
59 #include "ui/base/ime/win/tsf_bridge.h" 59 #include "ui/base/ime/win/tsf_bridge.h"
60 #include "ui/base/ime/win/tsf_event_router.h" 60 #include "ui/base/ime/win/tsf_event_router.h"
61 #include "ui/base/keycodes/keyboard_codes.h" 61 #include "ui/base/keycodes/keyboard_codes.h"
62 #include "ui/base/l10n/l10n_util.h" 62 #include "ui/base/l10n/l10n_util.h"
63 #include "ui/base/l10n/l10n_util_win.h" 63 #include "ui/base/l10n/l10n_util_win.h"
64 #include "ui/base/touch/touch_enabled.h"
64 #include "ui/base/win/hwnd_util.h" 65 #include "ui/base/win/hwnd_util.h"
65 #include "ui/base/win/mouse_wheel_util.h" 66 #include "ui/base/win/mouse_wheel_util.h"
66 #include "ui/base/win/touch_input.h" 67 #include "ui/base/win/touch_input.h"
67 #include "ui/gfx/canvas.h" 68 #include "ui/gfx/canvas.h"
68 #include "ui/gfx/image/image.h" 69 #include "ui/gfx/image/image.h"
69 #include "ui/views/button_drag_utils.h" 70 #include "ui/views/button_drag_utils.h"
70 #include "ui/views/controls/menu/menu_item_view.h" 71 #include "ui/views/controls/menu/menu_item_view.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"
(...skipping 1360 matching lines...) Expand 10 before | Expand all | Expand 10 after
1434 DoCopyURL(url, text); 1435 DoCopyURL(url, text);
1435 else 1436 else
1436 DoCopyText(text); 1437 DoCopyText(text);
1437 } 1438 }
1438 1439
1439 LRESULT OmniboxViewWin::OnCreate(const CREATESTRUCTW* /*create_struct*/) { 1440 LRESULT OmniboxViewWin::OnCreate(const CREATESTRUCTW* /*create_struct*/) {
1440 if (base::win::IsTSFAwareRequired()) { 1441 if (base::win::IsTSFAwareRequired()) {
1441 // Enable TSF support of RichEdit. 1442 // Enable TSF support of RichEdit.
1442 SetEditStyle(SES_USECTF, SES_USECTF); 1443 SetEditStyle(SES_USECTF, SES_USECTF);
1443 } 1444 }
1444 if (base::win::GetVersion() >= base::win::VERSION_WIN8) { 1445 if ((base::win::GetVersion() >= base::win::VERSION_WIN8) &&
1446 ui::AreTouchEventsEnabled()) {
1445 BOOL touch_mode = RegisterTouchWindow(m_hWnd, TWF_WANTPALM); 1447 BOOL touch_mode = RegisterTouchWindow(m_hWnd, TWF_WANTPALM);
1446 DCHECK(touch_mode); 1448 DCHECK(touch_mode);
1447 } 1449 }
1448 SetMsgHandled(FALSE); 1450 SetMsgHandled(FALSE);
1449 1451
1450 // When TSF is enabled, OnTextUpdated() may be called without any previous 1452 // When TSF is enabled, OnTextUpdated() may be called without any previous
1451 // call that would have indicated the start of an editing session. In order 1453 // call that would have indicated the start of an editing session. In order
1452 // to guarantee we've always called OnBeforePossibleChange() before 1454 // to guarantee we've always called OnBeforePossibleChange() before
1453 // OnAfterPossibleChange(), we therefore call that here. Note that multiple 1455 // OnAfterPossibleChange(), we therefore call that here. Note that multiple
1454 // (i.e. unmatched) calls to this function in a row are safe. 1456 // (i.e. unmatched) calls to this function in a row are safe.
(...skipping 1369 matching lines...) Expand 10 before | Expand all | Expand 10 after
2824 return (rect.left - client_rect.left) + (client_rect.right - rect.right); 2826 return (rect.left - client_rect.left) + (client_rect.right - rect.right);
2825 } 2827 }
2826 2828
2827 int OmniboxViewWin::WidthNeededToDisplay(const string16& text) const { 2829 int OmniboxViewWin::WidthNeededToDisplay(const string16& text) const {
2828 // Use font_.GetStringWidth() instead of PosFromChar(GetTextLength()) because 2830 // Use font_.GetStringWidth() instead of PosFromChar(GetTextLength()) because
2829 // PosFromChar() is apparently buggy. In both LTR UI and RTL UI with 2831 // PosFromChar() is apparently buggy. In both LTR UI and RTL UI with
2830 // left-to-right layout, PosFromChar(i) might return 0 when i is greater than 2832 // left-to-right layout, PosFromChar(i) might return 0 when i is greater than
2831 // 1. 2833 // 1.
2832 return font_.GetStringWidth(text) + GetHorizontalMargin(); 2834 return font_.GetStringWidth(text) + GetHorizontalMargin();
2833 } 2835 }
OLDNEW
« no previous file with comments | « no previous file | chrome/chrome.user32.delay.imports » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698