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 1511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1522 } | 1522 } |
1523 | 1523 |
1524 void OmniboxViewWin::OnKillFocus(HWND focus_wnd) { | 1524 void OmniboxViewWin::OnKillFocus(HWND focus_wnd) { |
1525 if (m_hWnd == focus_wnd) { | 1525 if (m_hWnd == focus_wnd) { |
1526 // Focus isn't actually leaving. | 1526 // Focus isn't actually leaving. |
1527 SetMsgHandled(false); | 1527 SetMsgHandled(false); |
1528 return; | 1528 return; |
1529 } | 1529 } |
1530 | 1530 |
1531 // This must be invoked before ClosePopup. | 1531 // This must be invoked before ClosePopup. |
1532 model_->OnWillKillFocus(focus_wnd); | 1532 model_->OnWillKillFocus(); |
1533 | 1533 |
1534 // Close the popup. | 1534 // Close the popup. |
1535 ClosePopup(); | 1535 ClosePopup(); |
1536 | 1536 |
1537 // Save the user's existing selection to restore it later. | 1537 // Save the user's existing selection to restore it later. |
1538 GetSelection(saved_selection_for_focus_change_); | 1538 GetSelection(saved_selection_for_focus_change_); |
1539 | 1539 |
1540 // Tell the model to reset itself. | 1540 // Tell the model to reset itself. |
1541 model_->OnKillFocus(); | 1541 model_->OnKillFocus(); |
1542 | 1542 |
(...skipping 1123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2666 // PosFromChar(i) might return 0 when i is greater than 1. | 2666 // PosFromChar(i) might return 0 when i is greater than 1. |
2667 return font_.GetStringWidth(text) + GetHorizontalMargin(); | 2667 return font_.GetStringWidth(text) + GetHorizontalMargin(); |
2668 } | 2668 } |
2669 | 2669 |
2670 bool OmniboxViewWin::IsCaretAtEnd() const { | 2670 bool OmniboxViewWin::IsCaretAtEnd() const { |
2671 long length = GetTextLength(); | 2671 long length = GetTextLength(); |
2672 CHARRANGE sel; | 2672 CHARRANGE sel; |
2673 GetSelection(sel); | 2673 GetSelection(sel); |
2674 return sel.cpMin == sel.cpMax && sel.cpMin == length; | 2674 return sel.cpMin == sel.cpMax && sel.cpMin == length; |
2675 } | 2675 } |
OLD | NEW |