OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 1429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1440 default: | 1440 default: |
1441 break; | 1441 break; |
1442 } | 1442 } |
1443 return DefWindowProc(message, wparam, lparam); | 1443 return DefWindowProc(message, wparam, lparam); |
1444 } | 1444 } |
1445 | 1445 |
1446 LRESULT OmniboxViewWin::OnPointerDown(UINT message, | 1446 LRESULT OmniboxViewWin::OnPointerDown(UINT message, |
1447 WPARAM wparam, | 1447 WPARAM wparam, |
1448 LPARAM lparam) { | 1448 LPARAM lparam) { |
1449 SetFocus(); | 1449 SetFocus(); |
| 1450 |
| 1451 if (IS_POINTER_FIRSTBUTTON_WPARAM(wparam)) { |
| 1452 TrackMousePosition(kLeft, CPoint(GET_X_LPARAM(lparam), |
| 1453 GET_Y_LPARAM(lparam))); |
| 1454 } |
| 1455 |
1450 // ITextInputPanel is not supported on all platforms. NULL is fine. | 1456 // ITextInputPanel is not supported on all platforms. NULL is fine. |
1451 if (keyboard_ != NULL) | 1457 if (keyboard_ != NULL) |
1452 keyboard_->SetInPlaceVisibility(true); | 1458 keyboard_->SetInPlaceVisibility(true); |
1453 return DefWindowProc(message, wparam, lparam); | 1459 return DefWindowProc(message, wparam, lparam); |
1454 } | 1460 } |
1455 | 1461 |
1456 void OmniboxViewWin::OnKeyDown(TCHAR key, | 1462 void OmniboxViewWin::OnKeyDown(TCHAR key, |
1457 UINT repeat_count, | 1463 UINT repeat_count, |
1458 UINT flags) { | 1464 UINT flags) { |
1459 delete_at_end_pressed_ = false; | 1465 delete_at_end_pressed_ = false; |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1657 // actually going to activate and gain focus. | 1663 // actually going to activate and gain focus. |
1658 LRESULT result = DefWindowProc(WM_MOUSEACTIVATE, | 1664 LRESULT result = DefWindowProc(WM_MOUSEACTIVATE, |
1659 reinterpret_cast<WPARAM>(window), | 1665 reinterpret_cast<WPARAM>(window), |
1660 MAKELPARAM(hit_test, mouse_message)); | 1666 MAKELPARAM(hit_test, mouse_message)); |
1661 // Check if we're getting focus from a click. We have to do this here rather | 1667 // Check if we're getting focus from a click. We have to do this here rather |
1662 // than in OnXButtonDown() since in many scenarios OnSetFocus() will be | 1668 // than in OnXButtonDown() since in many scenarios OnSetFocus() will be |
1663 // reached before OnXButtonDown(), preventing us from detecting this properly | 1669 // reached before OnXButtonDown(), preventing us from detecting this properly |
1664 // there. Also in those cases, we need to already know in OnSetFocus() that | 1670 // there. Also in those cases, we need to already know in OnSetFocus() that |
1665 // we should not restore the saved selection. | 1671 // we should not restore the saved selection. |
1666 if (!model_->has_focus() && | 1672 if (!model_->has_focus() && |
1667 ((mouse_message == WM_LBUTTONDOWN || mouse_message == WM_RBUTTONDOWN)) && | 1673 ((mouse_message == WM_LBUTTONDOWN || mouse_message == WM_RBUTTONDOWN || |
| 1674 mouse_message == WM_POINTERDOWN)) && |
1668 (result == MA_ACTIVATE)) { | 1675 (result == MA_ACTIVATE)) { |
1669 DCHECK(!gaining_focus_.get()); | 1676 DCHECK(!gaining_focus_.get()); |
1670 gaining_focus_.reset(new ScopedFreeze(this, GetTextObjectModel())); | 1677 gaining_focus_.reset(new ScopedFreeze(this, GetTextObjectModel())); |
1671 // NOTE: Despite |mouse_message| being WM_XBUTTONDOWN here, we're not | 1678 // NOTE: Despite |mouse_message| being WM_XBUTTONDOWN here, we're not |
1672 // guaranteed to call OnXButtonDown() later! Specifically, if this is the | 1679 // guaranteed to call OnXButtonDown() later! Specifically, if this is the |
1673 // second click of a double click, we'll reach here but later call | 1680 // second click of a double click, we'll reach here but later call |
1674 // OnXButtonDblClk(). Make sure |gaining_focus_| gets reset both places, | 1681 // OnXButtonDblClk(). Make sure |gaining_focus_| gets reset both places, |
1675 // or we'll have visual glitchiness and then DCHECK failures. | 1682 // or we'll have visual glitchiness and then DCHECK failures. |
1676 | 1683 |
1677 // Don't restore saved selection, it will just screw up our interaction | 1684 // Don't restore saved selection, it will just screw up our interaction |
(...skipping 998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2676 bool popup_window_mode, | 2683 bool popup_window_mode, |
2677 LocationBarView* location_bar) { | 2684 LocationBarView* location_bar) { |
2678 return new OmniboxViewWin(controller, | 2685 return new OmniboxViewWin(controller, |
2679 toolbar_model, | 2686 toolbar_model, |
2680 location_bar, | 2687 location_bar, |
2681 command_updater, | 2688 command_updater, |
2682 popup_window_mode, | 2689 popup_window_mode, |
2683 location_bar); | 2690 location_bar); |
2684 } | 2691 } |
2685 #endif | 2692 #endif |
OLD | NEW |