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/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 27 matching lines...) Expand all Loading... |
38 #include "grit/generated_resources.h" | 38 #include "grit/generated_resources.h" |
39 #include "net/base/escape.h" | 39 #include "net/base/escape.h" |
40 #include "skia/ext/skia_utils_win.h" | 40 #include "skia/ext/skia_utils_win.h" |
41 #include "ui/base/clipboard/clipboard.h" | 41 #include "ui/base/clipboard/clipboard.h" |
42 #include "ui/base/clipboard/scoped_clipboard_writer.h" | 42 #include "ui/base/clipboard/scoped_clipboard_writer.h" |
43 #include "ui/base/dragdrop/drag_drop_types.h" | 43 #include "ui/base/dragdrop/drag_drop_types.h" |
44 #include "ui/base/dragdrop/drag_source.h" | 44 #include "ui/base/dragdrop/drag_source.h" |
45 #include "ui/base/dragdrop/drop_target.h" | 45 #include "ui/base/dragdrop/drop_target.h" |
46 #include "ui/base/dragdrop/os_exchange_data.h" | 46 #include "ui/base/dragdrop/os_exchange_data.h" |
47 #include "ui/base/dragdrop/os_exchange_data_provider_win.h" | 47 #include "ui/base/dragdrop/os_exchange_data_provider_win.h" |
| 48 #include "ui/base/events.h" |
48 #include "ui/base/keycodes/keyboard_codes.h" | 49 #include "ui/base/keycodes/keyboard_codes.h" |
49 #include "ui/base/l10n/l10n_util.h" | 50 #include "ui/base/l10n/l10n_util.h" |
50 #include "ui/base/l10n/l10n_util_win.h" | 51 #include "ui/base/l10n/l10n_util_win.h" |
51 #include "ui/base/win/mouse_wheel_util.h" | 52 #include "ui/base/win/mouse_wheel_util.h" |
52 #include "ui/gfx/canvas.h" | 53 #include "ui/gfx/canvas.h" |
53 #include "ui/gfx/canvas_skia.h" | 54 #include "ui/gfx/canvas_skia.h" |
54 #include "views/controls/textfield/native_textfield_win.h" | 55 #include "views/controls/textfield/native_textfield_win.h" |
55 #include "views/drag_utils.h" | 56 #include "views/drag_utils.h" |
56 #include "views/events/event_utils_win.h" | |
57 #include "views/widget/widget.h" | 57 #include "views/widget/widget.h" |
58 | 58 |
59 #pragma comment(lib, "oleacc.lib") // Needed for accessibility support. | 59 #pragma comment(lib, "oleacc.lib") // Needed for accessibility support. |
60 #pragma comment(lib, "riched20.lib") // Needed for the richedit control. | 60 #pragma comment(lib, "riched20.lib") // Needed for the richedit control. |
61 | 61 |
62 /////////////////////////////////////////////////////////////////////////////// | 62 /////////////////////////////////////////////////////////////////////////////// |
63 // AutocompleteEditModel | 63 // AutocompleteEditModel |
64 | 64 |
65 namespace { | 65 namespace { |
66 | 66 |
(...skipping 920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
987 model_->PasteAndGo(); | 987 model_->PasteAndGo(); |
988 } | 988 } |
989 | 989 |
990 bool OmniboxViewWin::SkipDefaultKeyEventProcessing( | 990 bool OmniboxViewWin::SkipDefaultKeyEventProcessing( |
991 const views::KeyEvent& event) { | 991 const views::KeyEvent& event) { |
992 ui::KeyboardCode key = event.key_code(); | 992 ui::KeyboardCode key = event.key_code(); |
993 // We don't process ALT + numpad digit as accelerators, they are used for | 993 // We don't process ALT + numpad digit as accelerators, they are used for |
994 // entering special characters. We do translate alt-home. | 994 // entering special characters. We do translate alt-home. |
995 if (event.IsAltDown() && (key != ui::VKEY_HOME) && | 995 if (event.IsAltDown() && (key != ui::VKEY_HOME) && |
996 views::NativeTextfieldWin::IsNumPadDigit(key, | 996 views::NativeTextfieldWin::IsNumPadDigit(key, |
997 views::IsExtendedKey(event))) | 997 (event.flags() & ui::EF_EXTENDED) != 0)) |
998 return true; | 998 return true; |
999 | 999 |
1000 // Skip accelerators for key combinations omnibox wants to crack. This list | 1000 // Skip accelerators for key combinations omnibox wants to crack. This list |
1001 // should be synced with OnKeyDownOnlyWritable() (but for tab which is dealt | 1001 // should be synced with OnKeyDownOnlyWritable() (but for tab which is dealt |
1002 // with above in LocationBarView::SkipDefaultKeyEventProcessing). | 1002 // with above in LocationBarView::SkipDefaultKeyEventProcessing). |
1003 // | 1003 // |
1004 // We cannot return true for all keys because we still need to handle some | 1004 // We cannot return true for all keys because we still need to handle some |
1005 // accelerators (e.g., F5 for reload the page should work even when the | 1005 // accelerators (e.g., F5 for reload the page should work even when the |
1006 // Omnibox gets focused). | 1006 // Omnibox gets focused). |
1007 switch (key) { | 1007 switch (key) { |
(...skipping 1591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2599 // PosFromChar(i) might return 0 when i is greater than 1. | 2599 // PosFromChar(i) might return 0 when i is greater than 1. |
2600 return font_.GetStringWidth(text) + GetHorizontalMargin(); | 2600 return font_.GetStringWidth(text) + GetHorizontalMargin(); |
2601 } | 2601 } |
2602 | 2602 |
2603 bool OmniboxViewWin::IsCaretAtEnd() const { | 2603 bool OmniboxViewWin::IsCaretAtEnd() const { |
2604 long length = GetTextLength(); | 2604 long length = GetTextLength(); |
2605 CHARRANGE sel; | 2605 CHARRANGE sel; |
2606 GetSelection(sel); | 2606 GetSelection(sel); |
2607 return sel.cpMin == sel.cpMax && sel.cpMin == length; | 2607 return sel.cpMin == sel.cpMax && sel.cpMin == length; |
2608 } | 2608 } |
OLD | NEW |