| 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 26 matching lines...) Expand all Loading... |
| 37 #include "third_party/skia/include/core/SkColor.h" | 37 #include "third_party/skia/include/core/SkColor.h" |
| 38 #include "ui/accessibility/ax_view_state.h" | 38 #include "ui/accessibility/ax_view_state.h" |
| 39 #include "ui/base/clipboard/scoped_clipboard_writer.h" | 39 #include "ui/base/clipboard/scoped_clipboard_writer.h" |
| 40 #include "ui/base/dragdrop/drag_drop_types.h" | 40 #include "ui/base/dragdrop/drag_drop_types.h" |
| 41 #include "ui/base/dragdrop/os_exchange_data.h" | 41 #include "ui/base/dragdrop/os_exchange_data.h" |
| 42 #include "ui/base/ime/input_method.h" | 42 #include "ui/base/ime/input_method.h" |
| 43 #include "ui/base/ime/text_edit_commands.h" | 43 #include "ui/base/ime/text_edit_commands.h" |
| 44 #include "ui/base/ime/text_input_client.h" | 44 #include "ui/base/ime/text_input_client.h" |
| 45 #include "ui/base/ime/text_input_type.h" | 45 #include "ui/base/ime/text_input_type.h" |
| 46 #include "ui/base/l10n/l10n_util.h" | 46 #include "ui/base/l10n/l10n_util.h" |
| 47 #include "ui/base/material_design/material_design_controller.h" |
| 47 #include "ui/base/models/simple_menu_model.h" | 48 #include "ui/base/models/simple_menu_model.h" |
| 48 #include "ui/compositor/layer.h" | 49 #include "ui/compositor/layer.h" |
| 49 #include "ui/events/event.h" | 50 #include "ui/events/event.h" |
| 50 #include "ui/gfx/canvas.h" | 51 #include "ui/gfx/canvas.h" |
| 51 #include "ui/gfx/font_list.h" | 52 #include "ui/gfx/font_list.h" |
| 52 #include "ui/gfx/selection_model.h" | 53 #include "ui/gfx/selection_model.h" |
| 53 #include "ui/strings/grit/ui_strings.h" | 54 #include "ui/strings/grit/ui_strings.h" |
| 54 #include "ui/views/border.h" | 55 #include "ui/views/border.h" |
| 55 #include "ui/views/button_drag_utils.h" | 56 #include "ui/views/button_drag_utils.h" |
| 56 #include "ui/views/controls/textfield/textfield.h" | 57 #include "ui/views/controls/textfield/textfield.h" |
| (...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 782 else | 783 else |
| 783 CloseOmniboxPopup(); | 784 CloseOmniboxPopup(); |
| 784 | 785 |
| 785 // Tell the model to reset itself. | 786 // Tell the model to reset itself. |
| 786 model()->OnKillFocus(); | 787 model()->OnKillFocus(); |
| 787 | 788 |
| 788 // Make sure the beginning of the text is visible. | 789 // Make sure the beginning of the text is visible. |
| 789 SelectRange(gfx::Range(0)); | 790 SelectRange(gfx::Range(0)); |
| 790 | 791 |
| 791 // The location bar needs to repaint without a focus ring. | 792 // The location bar needs to repaint without a focus ring. |
| 792 location_bar_view_->SchedulePaint(); | 793 if (ui::MaterialDesignController::IsModeMaterial()) |
| 794 location_bar_view_->SchedulePaint(); |
| 793 } | 795 } |
| 794 | 796 |
| 795 bool OmniboxViewViews::IsCommandIdEnabled(int command_id) const { | 797 bool OmniboxViewViews::IsCommandIdEnabled(int command_id) const { |
| 796 if (command_id == IDS_APP_PASTE) | 798 if (command_id == IDS_APP_PASTE) |
| 797 return !read_only() && !GetClipboardText().empty(); | 799 return !read_only() && !GetClipboardText().empty(); |
| 798 if (command_id == IDS_PASTE_AND_GO) | 800 if (command_id == IDS_PASTE_AND_GO) |
| 799 return !read_only() && model()->CanPasteAndGo(GetClipboardText()); | 801 return !read_only() && model()->CanPasteAndGo(GetClipboardText()); |
| 800 return Textfield::IsCommandIdEnabled(command_id) || | 802 return Textfield::IsCommandIdEnabled(command_id) || |
| 801 location_bar_view_->command_updater()->IsCommandEnabled(command_id); | 803 location_bar_view_->command_updater()->IsCommandEnabled(command_id); |
| 802 } | 804 } |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1072 paste_position + 1, IDS_PASTE_AND_GO, IDS_PASTE_AND_GO); | 1074 paste_position + 1, IDS_PASTE_AND_GO, IDS_PASTE_AND_GO); |
| 1073 | 1075 |
| 1074 menu_contents->AddSeparator(ui::NORMAL_SEPARATOR); | 1076 menu_contents->AddSeparator(ui::NORMAL_SEPARATOR); |
| 1075 | 1077 |
| 1076 // Minor note: We use IDC_ for command id here while the underlying textfield | 1078 // Minor note: We use IDC_ for command id here while the underlying textfield |
| 1077 // is using IDS_ for all its command ids. This is because views cannot depend | 1079 // is using IDS_ for all its command ids. This is because views cannot depend |
| 1078 // on IDC_ for now. | 1080 // on IDC_ for now. |
| 1079 menu_contents->AddItemWithStringId(IDC_EDIT_SEARCH_ENGINES, | 1081 menu_contents->AddItemWithStringId(IDC_EDIT_SEARCH_ENGINES, |
| 1080 IDS_EDIT_SEARCH_ENGINES); | 1082 IDS_EDIT_SEARCH_ENGINES); |
| 1081 } | 1083 } |
| OLD | NEW |