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" |
11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
12 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
13 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
15 #include "build/build_config.h" | 15 #include "build/build_config.h" |
16 #include "chrome/app/chrome_command_ids.h" | 16 #include "chrome/app/chrome_command_ids.h" |
17 #include "chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h" | 17 #include "chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h" |
18 #include "chrome/browser/command_updater.h" | 18 #include "chrome/browser/command_updater.h" |
19 #include "chrome/browser/search/search.h" | |
20 #include "chrome/browser/ui/omnibox/chrome_omnibox_client.h" | 19 #include "chrome/browser/ui/omnibox/chrome_omnibox_client.h" |
21 #include "chrome/browser/ui/omnibox/clipboard_utils.h" | 20 #include "chrome/browser/ui/omnibox/clipboard_utils.h" |
22 #include "chrome/browser/ui/view_ids.h" | 21 #include "chrome/browser/ui/view_ids.h" |
23 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 22 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
24 #include "chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.h" | 23 #include "chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.h" |
25 #include "chrome/grit/generated_resources.h" | 24 #include "chrome/grit/generated_resources.h" |
26 #include "components/bookmarks/browser/bookmark_node_data.h" | 25 #include "components/bookmarks/browser/bookmark_node_data.h" |
27 #include "components/omnibox/browser/autocomplete_input.h" | 26 #include "components/omnibox/browser/autocomplete_input.h" |
28 #include "components/omnibox/browser/autocomplete_match.h" | 27 #include "components/omnibox/browser/autocomplete_match.h" |
29 #include "components/omnibox/browser/omnibox_edit_controller.h" | 28 #include "components/omnibox/browser/omnibox_edit_controller.h" |
30 #include "components/omnibox/browser/omnibox_edit_model.h" | 29 #include "components/omnibox/browser/omnibox_edit_model.h" |
31 #include "components/omnibox/browser/omnibox_field_trial.h" | 30 #include "components/omnibox/browser/omnibox_field_trial.h" |
32 #include "components/omnibox/browser/omnibox_popup_model.h" | 31 #include "components/omnibox/browser/omnibox_popup_model.h" |
33 #include "components/search/search.h" | |
34 #include "components/toolbar/toolbar_model.h" | 32 #include "components/toolbar/toolbar_model.h" |
35 #include "content/public/browser/web_contents.h" | 33 #include "content/public/browser/web_contents.h" |
36 #include "extensions/common/constants.h" | 34 #include "extensions/common/constants.h" |
37 #include "grit/components_strings.h" | 35 #include "grit/components_strings.h" |
38 #include "net/base/escape.h" | 36 #include "net/base/escape.h" |
39 #include "third_party/skia/include/core/SkColor.h" | 37 #include "third_party/skia/include/core/SkColor.h" |
40 #include "ui/accessibility/ax_view_state.h" | 38 #include "ui/accessibility/ax_view_state.h" |
41 #include "ui/base/clipboard/scoped_clipboard_writer.h" | 39 #include "ui/base/clipboard/scoped_clipboard_writer.h" |
42 #include "ui/base/dragdrop/drag_drop_types.h" | 40 #include "ui/base/dragdrop/drag_drop_types.h" |
43 #include "ui/base/dragdrop/os_exchange_data.h" | 41 #include "ui/base/dragdrop/os_exchange_data.h" |
(...skipping 1045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1089 } | 1087 } |
1090 | 1088 |
1091 void OmniboxViewViews::UpdateContextMenu(ui::SimpleMenuModel* menu_contents) { | 1089 void OmniboxViewViews::UpdateContextMenu(ui::SimpleMenuModel* menu_contents) { |
1092 int paste_position = menu_contents->GetIndexOfCommandId(IDS_APP_PASTE); | 1090 int paste_position = menu_contents->GetIndexOfCommandId(IDS_APP_PASTE); |
1093 DCHECK_GE(paste_position, 0); | 1091 DCHECK_GE(paste_position, 0); |
1094 menu_contents->InsertItemWithStringIdAt( | 1092 menu_contents->InsertItemWithStringIdAt( |
1095 paste_position + 1, IDS_PASTE_AND_GO, IDS_PASTE_AND_GO); | 1093 paste_position + 1, IDS_PASTE_AND_GO, IDS_PASTE_AND_GO); |
1096 | 1094 |
1097 menu_contents->AddSeparator(ui::NORMAL_SEPARATOR); | 1095 menu_contents->AddSeparator(ui::NORMAL_SEPARATOR); |
1098 | 1096 |
1099 if (search::IsQueryExtractionEnabled()) { | |
1100 int select_all_position = menu_contents->GetIndexOfCommandId( | |
1101 IDS_APP_SELECT_ALL); | |
1102 DCHECK_GE(select_all_position, 0); | |
1103 menu_contents->InsertItemWithStringIdAt( | |
1104 select_all_position + 1, IDS_SHOW_URL, IDS_SHOW_URL); | |
Peter Kasting
2016/08/09 20:55:13
Make sure that removing IDS_SHOW_URL and all its h
Marc Treib
2016/08/10 12:53:40
Yup, that's already on my list :)
| |
1105 } | |
1106 | |
1107 // Minor note: We use IDC_ for command id here while the underlying textfield | 1097 // Minor note: We use IDC_ for command id here while the underlying textfield |
1108 // is using IDS_ for all its command ids. This is because views cannot depend | 1098 // is using IDS_ for all its command ids. This is because views cannot depend |
1109 // on IDC_ for now. | 1099 // on IDC_ for now. |
1110 menu_contents->AddItemWithStringId(IDC_EDIT_SEARCH_ENGINES, | 1100 menu_contents->AddItemWithStringId(IDC_EDIT_SEARCH_ENGINES, |
1111 IDS_EDIT_SEARCH_ENGINES); | 1101 IDS_EDIT_SEARCH_ENGINES); |
1112 } | 1102 } |
OLD | NEW |