Chromium Code Reviews| 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 1431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1442 break; | 1442 break; |
| 1443 default: | 1443 default: |
| 1444 break; | 1444 break; |
| 1445 } | 1445 } |
| 1446 return DefWindowProc(message, wparam, lparam); | 1446 return DefWindowProc(message, wparam, lparam); |
| 1447 } | 1447 } |
| 1448 | 1448 |
| 1449 LRESULT OmniboxViewWin::OnPointerDown(UINT message, | 1449 LRESULT OmniboxViewWin::OnPointerDown(UINT message, |
| 1450 WPARAM wparam, | 1450 WPARAM wparam, |
| 1451 LPARAM lparam) { | 1451 LPARAM lparam) { |
| 1452 if (!model()->has_focus()) | 1452 if (!model()->has_focus()) { |
| 1453 SetFocus(); | 1453 SetFocus(); |
| 1454 SetCapture(); | |
|
sky
2012/10/11 19:24:25
Do you need a corresponding ReleaseCapture somewhe
ananta
2012/10/11 20:04:04
Added a ReleaseCapture in OnPointerUp.
| |
| 1455 } | |
| 1454 | 1456 |
| 1455 if (IS_POINTER_FIRSTBUTTON_WPARAM(wparam)) { | 1457 if (IS_POINTER_FIRSTBUTTON_WPARAM(wparam)) { |
| 1456 TrackMousePosition(kLeft, CPoint(GET_X_LPARAM(lparam), | 1458 TrackMousePosition(kLeft, CPoint(GET_X_LPARAM(lparam), |
| 1457 GET_Y_LPARAM(lparam))); | 1459 GET_Y_LPARAM(lparam))); |
| 1458 } | 1460 } |
| 1459 | 1461 |
| 1460 SetMsgHandled(false); | 1462 SetMsgHandled(false); |
| 1461 | 1463 |
| 1462 return 0; | 1464 return 0; |
| 1463 } | 1465 } |
| (...skipping 1215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2679 return (rect.left - client_rect.left) + (client_rect.right - rect.right); | 2681 return (rect.left - client_rect.left) + (client_rect.right - rect.right); |
| 2680 } | 2682 } |
| 2681 | 2683 |
| 2682 int OmniboxViewWin::WidthNeededToDisplay(const string16& text) const { | 2684 int OmniboxViewWin::WidthNeededToDisplay(const string16& text) const { |
| 2683 // Use font_.GetStringWidth() instead of | 2685 // Use font_.GetStringWidth() instead of |
| 2684 // PosFromChar(location_entry_->GetTextLength()) because PosFromChar() is | 2686 // PosFromChar(location_entry_->GetTextLength()) because PosFromChar() is |
| 2685 // apparently buggy. In both LTR UI and RTL UI with left-to-right layout, | 2687 // apparently buggy. In both LTR UI and RTL UI with left-to-right layout, |
| 2686 // PosFromChar(i) might return 0 when i is greater than 1. | 2688 // PosFromChar(i) might return 0 when i is greater than 1. |
| 2687 return font_.GetStringWidth(text) + GetHorizontalMargin(); | 2689 return font_.GetStringWidth(text) + GetHorizontalMargin(); |
| 2688 } | 2690 } |
| OLD | NEW |