| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 #include "net/base/escape.h" | 44 #include "net/base/escape.h" |
| 45 #include "skia/ext/skia_utils_win.h" | 45 #include "skia/ext/skia_utils_win.h" |
| 46 #include "ui/base/accessibility/accessible_view_state.h" | 46 #include "ui/base/accessibility/accessible_view_state.h" |
| 47 #include "ui/base/clipboard/clipboard.h" | 47 #include "ui/base/clipboard/clipboard.h" |
| 48 #include "ui/base/clipboard/scoped_clipboard_writer.h" | 48 #include "ui/base/clipboard/scoped_clipboard_writer.h" |
| 49 #include "ui/base/dragdrop/drag_drop_types.h" | 49 #include "ui/base/dragdrop/drag_drop_types.h" |
| 50 #include "ui/base/dragdrop/drag_source.h" | 50 #include "ui/base/dragdrop/drag_source.h" |
| 51 #include "ui/base/dragdrop/drop_target.h" | 51 #include "ui/base/dragdrop/drop_target.h" |
| 52 #include "ui/base/dragdrop/os_exchange_data.h" | 52 #include "ui/base/dragdrop/os_exchange_data.h" |
| 53 #include "ui/base/dragdrop/os_exchange_data_provider_win.h" | 53 #include "ui/base/dragdrop/os_exchange_data_provider_win.h" |
| 54 #include "ui/base/event.h" |
| 54 #include "ui/base/events.h" | 55 #include "ui/base/events.h" |
| 55 #include "ui/base/keycodes/keyboard_codes.h" | 56 #include "ui/base/keycodes/keyboard_codes.h" |
| 56 #include "ui/base/l10n/l10n_util.h" | 57 #include "ui/base/l10n/l10n_util.h" |
| 57 #include "ui/base/l10n/l10n_util_win.h" | 58 #include "ui/base/l10n/l10n_util_win.h" |
| 58 #include "ui/base/win/mouse_wheel_util.h" | 59 #include "ui/base/win/mouse_wheel_util.h" |
| 59 #include "ui/gfx/canvas.h" | 60 #include "ui/gfx/canvas.h" |
| 60 #include "ui/views/button_drag_utils.h" | 61 #include "ui/views/button_drag_utils.h" |
| 61 #include "ui/views/controls/menu/menu_item_view.h" | 62 #include "ui/views/controls/menu/menu_item_view.h" |
| 62 #include "ui/views/controls/menu/menu_model_adapter.h" | 63 #include "ui/views/controls/menu/menu_model_adapter.h" |
| 63 #include "ui/views/controls/menu/menu_runner.h" | 64 #include "ui/views/controls/menu/menu_runner.h" |
| (...skipping 937 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1001 if (model()->CanPasteAndGo(collapsed_text)) | 1002 if (model()->CanPasteAndGo(collapsed_text)) |
| 1002 model()->PasteAndGo(collapsed_text); | 1003 model()->PasteAndGo(collapsed_text); |
| 1003 } | 1004 } |
| 1004 return CopyOrLinkDragOperation(event.source_operations()); | 1005 return CopyOrLinkDragOperation(event.source_operations()); |
| 1005 } | 1006 } |
| 1006 } | 1007 } |
| 1007 | 1008 |
| 1008 return ui::DragDropTypes::DRAG_NONE; | 1009 return ui::DragDropTypes::DRAG_NONE; |
| 1009 } | 1010 } |
| 1010 | 1011 |
| 1011 bool OmniboxViewWin::SkipDefaultKeyEventProcessing( | 1012 bool OmniboxViewWin::SkipDefaultKeyEventProcessing(const ui::KeyEvent& event) { |
| 1012 const views::KeyEvent& event) { | |
| 1013 ui::KeyboardCode key = event.key_code(); | 1013 ui::KeyboardCode key = event.key_code(); |
| 1014 // We don't process ALT + numpad digit as accelerators, they are used for | 1014 // We don't process ALT + numpad digit as accelerators, they are used for |
| 1015 // entering special characters. We do translate alt-home. | 1015 // entering special characters. We do translate alt-home. |
| 1016 if (event.IsAltDown() && (key != ui::VKEY_HOME) && | 1016 if (event.IsAltDown() && (key != ui::VKEY_HOME) && |
| 1017 views::NativeTextfieldWin::IsNumPadDigit(key, | 1017 views::NativeTextfieldWin::IsNumPadDigit(key, |
| 1018 (event.flags() & ui::EF_EXTENDED) != 0)) | 1018 (event.flags() & ui::EF_EXTENDED) != 0)) |
| 1019 return true; | 1019 return true; |
| 1020 | 1020 |
| 1021 // Skip accelerators for key combinations omnibox wants to crack. This list | 1021 // Skip accelerators for key combinations omnibox wants to crack. This list |
| 1022 // should be synced with OnKeyDownOnlyWritable() (but for tab which is dealt | 1022 // should be synced with OnKeyDownOnlyWritable() (but for tab which is dealt |
| (...skipping 1609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2632 return (rect.left - client_rect.left) + (client_rect.right - rect.right); | 2632 return (rect.left - client_rect.left) + (client_rect.right - rect.right); |
| 2633 } | 2633 } |
| 2634 | 2634 |
| 2635 int OmniboxViewWin::WidthNeededToDisplay(const string16& text) const { | 2635 int OmniboxViewWin::WidthNeededToDisplay(const string16& text) const { |
| 2636 // Use font_.GetStringWidth() instead of | 2636 // Use font_.GetStringWidth() instead of |
| 2637 // PosFromChar(location_entry_->GetTextLength()) because PosFromChar() is | 2637 // PosFromChar(location_entry_->GetTextLength()) because PosFromChar() is |
| 2638 // apparently buggy. In both LTR UI and RTL UI with left-to-right layout, | 2638 // apparently buggy. In both LTR UI and RTL UI with left-to-right layout, |
| 2639 // PosFromChar(i) might return 0 when i is greater than 1. | 2639 // PosFromChar(i) might return 0 when i is greater than 1. |
| 2640 return font_.GetStringWidth(text) + GetHorizontalMargin(); | 2640 return font_.GetStringWidth(text) + GetHorizontalMargin(); |
| 2641 } | 2641 } |
| OLD | NEW |