OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/autocomplete/autocomplete_edit_view_win.h" | 5 #include "chrome/browser/autocomplete/autocomplete_edit_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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 #include "ui/base/dragdrop/drop_target.h" | 44 #include "ui/base/dragdrop/drop_target.h" |
45 #include "ui/base/dragdrop/os_exchange_data.h" | 45 #include "ui/base/dragdrop/os_exchange_data.h" |
46 #include "ui/base/dragdrop/os_exchange_data_provider_win.h" | 46 #include "ui/base/dragdrop/os_exchange_data_provider_win.h" |
47 #include "ui/base/keycodes/keyboard_codes.h" | 47 #include "ui/base/keycodes/keyboard_codes.h" |
48 #include "ui/base/l10n/l10n_util.h" | 48 #include "ui/base/l10n/l10n_util.h" |
49 #include "ui/base/l10n/l10n_util_win.h" | 49 #include "ui/base/l10n/l10n_util_win.h" |
50 #include "ui/gfx/canvas.h" | 50 #include "ui/gfx/canvas.h" |
51 #include "ui/gfx/canvas_skia.h" | 51 #include "ui/gfx/canvas_skia.h" |
52 #include "views/controls/textfield/native_textfield_win.h" | 52 #include "views/controls/textfield/native_textfield_win.h" |
53 #include "views/drag_utils.h" | 53 #include "views/drag_utils.h" |
| 54 #include "views/events/event_utils_win.h" |
54 #include "views/focus/focus_util_win.h" | 55 #include "views/focus/focus_util_win.h" |
55 #include "views/widget/widget.h" | 56 #include "views/widget/widget.h" |
56 | 57 |
57 #pragma comment(lib, "oleacc.lib") // Needed for accessibility support. | 58 #pragma comment(lib, "oleacc.lib") // Needed for accessibility support. |
58 #pragma comment(lib, "riched20.lib") // Needed for the richedit control. | 59 #pragma comment(lib, "riched20.lib") // Needed for the richedit control. |
59 | 60 |
60 /////////////////////////////////////////////////////////////////////////////// | 61 /////////////////////////////////////////////////////////////////////////////// |
61 // AutocompleteEditModel | 62 // AutocompleteEditModel |
62 | 63 |
63 namespace { | 64 namespace { |
(...skipping 902 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
966 if (CanPasteAndGo(text)) | 967 if (CanPasteAndGo(text)) |
967 model_->PasteAndGo(); | 968 model_->PasteAndGo(); |
968 } | 969 } |
969 | 970 |
970 bool AutocompleteEditViewWin::SkipDefaultKeyEventProcessing( | 971 bool AutocompleteEditViewWin::SkipDefaultKeyEventProcessing( |
971 const views::KeyEvent& e) { | 972 const views::KeyEvent& e) { |
972 ui::KeyboardCode key = e.key_code(); | 973 ui::KeyboardCode key = e.key_code(); |
973 // We don't process ALT + numpad digit as accelerators, they are used for | 974 // We don't process ALT + numpad digit as accelerators, they are used for |
974 // entering special characters. We do translate alt-home. | 975 // entering special characters. We do translate alt-home. |
975 if (e.IsAltDown() && (key != ui::VKEY_HOME) && | 976 if (e.IsAltDown() && (key != ui::VKEY_HOME) && |
976 views::NativeTextfieldWin::IsNumPadDigit(key, e.IsExtendedKey())) | 977 views::NativeTextfieldWin::IsNumPadDigit(key, views::IsExtendedKey(e))) |
977 return true; | 978 return true; |
978 | 979 |
979 // Skip accelerators for key combinations omnibox wants to crack. This list | 980 // Skip accelerators for key combinations omnibox wants to crack. This list |
980 // should be synced with OnKeyDownOnlyWritable() (but for tab which is dealt | 981 // should be synced with OnKeyDownOnlyWritable() (but for tab which is dealt |
981 // with above in LocationBarView::SkipDefaultKeyEventProcessing). | 982 // with above in LocationBarView::SkipDefaultKeyEventProcessing). |
982 // | 983 // |
983 // We cannot return true for all keys because we still need to handle some | 984 // We cannot return true for all keys because we still need to handle some |
984 // accelerators (e.g., F5 for reload the page should work even when the | 985 // accelerators (e.g., F5 for reload the page should work even when the |
985 // Omnibox gets focused). | 986 // Omnibox gets focused). |
986 switch (key) { | 987 switch (key) { |
(...skipping 1595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2582 // PosFromChar(i) might return 0 when i is greater than 1. | 2583 // PosFromChar(i) might return 0 when i is greater than 1. |
2583 return font_.GetStringWidth(text) + GetHorizontalMargin(); | 2584 return font_.GetStringWidth(text) + GetHorizontalMargin(); |
2584 } | 2585 } |
2585 | 2586 |
2586 bool AutocompleteEditViewWin::IsCaretAtEnd() const { | 2587 bool AutocompleteEditViewWin::IsCaretAtEnd() const { |
2587 long length = GetTextLength(); | 2588 long length = GetTextLength(); |
2588 CHARRANGE sel; | 2589 CHARRANGE sel; |
2589 GetSelection(sel); | 2590 GetSelection(sel); |
2590 return sel.cpMin == sel.cpMax && sel.cpMin == length; | 2591 return sel.cpMin == sel.cpMax && sel.cpMin == length; |
2591 } | 2592 } |
OLD | NEW |