| 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_views.h" | 5 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 #include "net/base/escape.h" | 39 #include "net/base/escape.h" |
| 40 #include "third_party/skia/include/core/SkColor.h" | 40 #include "third_party/skia/include/core/SkColor.h" |
| 41 #include "ui/accessibility/ax_view_state.h" | 41 #include "ui/accessibility/ax_view_state.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/os_exchange_data.h" | 44 #include "ui/base/dragdrop/os_exchange_data.h" |
| 45 #include "ui/base/ime/input_method.h" | 45 #include "ui/base/ime/input_method.h" |
| 46 #include "ui/base/ime/text_input_client.h" | 46 #include "ui/base/ime/text_input_client.h" |
| 47 #include "ui/base/ime/text_input_type.h" | 47 #include "ui/base/ime/text_input_type.h" |
| 48 #include "ui/base/l10n/l10n_util.h" | 48 #include "ui/base/l10n/l10n_util.h" |
| 49 #include "ui/base/material_design/material_design_controller.h" |
| 49 #include "ui/base/models/simple_menu_model.h" | 50 #include "ui/base/models/simple_menu_model.h" |
| 50 #include "ui/compositor/layer.h" | 51 #include "ui/compositor/layer.h" |
| 51 #include "ui/events/event.h" | 52 #include "ui/events/event.h" |
| 52 #include "ui/gfx/canvas.h" | 53 #include "ui/gfx/canvas.h" |
| 53 #include "ui/gfx/font_list.h" | 54 #include "ui/gfx/font_list.h" |
| 54 #include "ui/gfx/selection_model.h" | 55 #include "ui/gfx/selection_model.h" |
| 55 #include "ui/strings/grit/ui_strings.h" | 56 #include "ui/strings/grit/ui_strings.h" |
| 56 #include "ui/views/border.h" | 57 #include "ui/views/border.h" |
| 57 #include "ui/views/button_drag_utils.h" | 58 #include "ui/views/button_drag_utils.h" |
| 58 #include "ui/views/controls/textfield/textfield.h" | 59 #include "ui/views/controls/textfield/textfield.h" |
| (...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 884 if (!model()->user_input_in_progress() && model()->popup_model()->IsOpen()) | 885 if (!model()->user_input_in_progress() && model()->popup_model()->IsOpen()) |
| 885 RevertAll(); | 886 RevertAll(); |
| 886 else | 887 else |
| 887 CloseOmniboxPopup(); | 888 CloseOmniboxPopup(); |
| 888 | 889 |
| 889 // Tell the model to reset itself. | 890 // Tell the model to reset itself. |
| 890 model()->OnKillFocus(); | 891 model()->OnKillFocus(); |
| 891 | 892 |
| 892 // Make sure the beginning of the text is visible. | 893 // Make sure the beginning of the text is visible. |
| 893 SelectRange(gfx::Range(0)); | 894 SelectRange(gfx::Range(0)); |
| 895 |
| 896 // The location bar needs to repaint without a focus ring. |
| 897 if (ui::MaterialDesignController::IsModeMaterial()) |
| 898 location_bar_view_->SchedulePaint(); |
| 894 } | 899 } |
| 895 | 900 |
| 896 bool OmniboxViewViews::IsCommandIdEnabled(int command_id) const { | 901 bool OmniboxViewViews::IsCommandIdEnabled(int command_id) const { |
| 897 if (command_id == IDS_APP_PASTE) | 902 if (command_id == IDS_APP_PASTE) |
| 898 return !read_only() && !GetClipboardText().empty(); | 903 return !read_only() && !GetClipboardText().empty(); |
| 899 if (command_id == IDS_PASTE_AND_GO) | 904 if (command_id == IDS_PASTE_AND_GO) |
| 900 return !read_only() && model()->CanPasteAndGo(GetClipboardText()); | 905 return !read_only() && model()->CanPasteAndGo(GetClipboardText()); |
| 901 if (command_id == IDS_SHOW_URL) | 906 if (command_id == IDS_SHOW_URL) |
| 902 return controller()->GetToolbarModel()->WouldReplaceURL(); | 907 return controller()->GetToolbarModel()->WouldReplaceURL(); |
| 903 return command_id == IDS_MOVE_DOWN || command_id == IDS_MOVE_UP || | 908 return command_id == IDS_MOVE_DOWN || command_id == IDS_MOVE_UP || |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1075 menu_contents->InsertItemWithStringIdAt( | 1080 menu_contents->InsertItemWithStringIdAt( |
| 1076 select_all_position + 1, IDS_SHOW_URL, IDS_SHOW_URL); | 1081 select_all_position + 1, IDS_SHOW_URL, IDS_SHOW_URL); |
| 1077 } | 1082 } |
| 1078 | 1083 |
| 1079 // Minor note: We use IDC_ for command id here while the underlying textfield | 1084 // Minor note: We use IDC_ for command id here while the underlying textfield |
| 1080 // is using IDS_ for all its command ids. This is because views cannot depend | 1085 // is using IDS_ for all its command ids. This is because views cannot depend |
| 1081 // on IDC_ for now. | 1086 // on IDC_ for now. |
| 1082 menu_contents->AddItemWithStringId(IDC_EDIT_SEARCH_ENGINES, | 1087 menu_contents->AddItemWithStringId(IDC_EDIT_SEARCH_ENGINES, |
| 1083 IDS_EDIT_SEARCH_ENGINES); | 1088 IDS_EDIT_SEARCH_ENGINES); |
| 1084 } | 1089 } |
| OLD | NEW |