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 10 matching lines...) Expand all Loading... |
21 #include "chrome/browser/ui/omnibox/omnibox_popup_model.h" | 21 #include "chrome/browser/ui/omnibox/omnibox_popup_model.h" |
22 #include "chrome/browser/ui/view_ids.h" | 22 #include "chrome/browser/ui/view_ids.h" |
23 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 23 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
24 #include "chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.h" | 24 #include "chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.h" |
25 #include "chrome/browser/ui/views/settings_api_bubble_helper_views.h" | 25 #include "chrome/browser/ui/views/settings_api_bubble_helper_views.h" |
26 #include "chrome/grit/generated_resources.h" | 26 #include "chrome/grit/generated_resources.h" |
27 #include "components/bookmarks/browser/bookmark_node_data.h" | 27 #include "components/bookmarks/browser/bookmark_node_data.h" |
28 #include "components/omnibox/browser/autocomplete_input.h" | 28 #include "components/omnibox/browser/autocomplete_input.h" |
29 #include "components/omnibox/browser/autocomplete_match.h" | 29 #include "components/omnibox/browser/autocomplete_match.h" |
30 #include "components/omnibox/browser/omnibox_field_trial.h" | 30 #include "components/omnibox/browser/omnibox_field_trial.h" |
| 31 #include "components/search/search.h" |
31 #include "content/public/browser/web_contents.h" | 32 #include "content/public/browser/web_contents.h" |
32 #include "extensions/common/constants.h" | 33 #include "extensions/common/constants.h" |
33 #include "net/base/escape.h" | 34 #include "net/base/escape.h" |
34 #include "third_party/skia/include/core/SkColor.h" | 35 #include "third_party/skia/include/core/SkColor.h" |
35 #include "ui/accessibility/ax_view_state.h" | 36 #include "ui/accessibility/ax_view_state.h" |
36 #include "ui/base/clipboard/scoped_clipboard_writer.h" | 37 #include "ui/base/clipboard/scoped_clipboard_writer.h" |
37 #include "ui/base/dragdrop/drag_drop_types.h" | 38 #include "ui/base/dragdrop/drag_drop_types.h" |
38 #include "ui/base/dragdrop/os_exchange_data.h" | 39 #include "ui/base/dragdrop/os_exchange_data.h" |
39 #include "ui/base/ime/input_method.h" | 40 #include "ui/base/ime/input_method.h" |
40 #include "ui/base/ime/text_input_client.h" | 41 #include "ui/base/ime/text_input_client.h" |
(...skipping 1010 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1051 } | 1052 } |
1052 | 1053 |
1053 void OmniboxViewViews::UpdateContextMenu(ui::SimpleMenuModel* menu_contents) { | 1054 void OmniboxViewViews::UpdateContextMenu(ui::SimpleMenuModel* menu_contents) { |
1054 int paste_position = menu_contents->GetIndexOfCommandId(IDS_APP_PASTE); | 1055 int paste_position = menu_contents->GetIndexOfCommandId(IDS_APP_PASTE); |
1055 DCHECK_GE(paste_position, 0); | 1056 DCHECK_GE(paste_position, 0); |
1056 menu_contents->InsertItemWithStringIdAt( | 1057 menu_contents->InsertItemWithStringIdAt( |
1057 paste_position + 1, IDS_PASTE_AND_GO, IDS_PASTE_AND_GO); | 1058 paste_position + 1, IDS_PASTE_AND_GO, IDS_PASTE_AND_GO); |
1058 | 1059 |
1059 menu_contents->AddSeparator(ui::NORMAL_SEPARATOR); | 1060 menu_contents->AddSeparator(ui::NORMAL_SEPARATOR); |
1060 | 1061 |
1061 if (chrome::IsQueryExtractionEnabled()) { | 1062 if (search::IsQueryExtractionEnabled()) { |
1062 int select_all_position = menu_contents->GetIndexOfCommandId( | 1063 int select_all_position = menu_contents->GetIndexOfCommandId( |
1063 IDS_APP_SELECT_ALL); | 1064 IDS_APP_SELECT_ALL); |
1064 DCHECK_GE(select_all_position, 0); | 1065 DCHECK_GE(select_all_position, 0); |
1065 menu_contents->InsertItemWithStringIdAt( | 1066 menu_contents->InsertItemWithStringIdAt( |
1066 select_all_position + 1, IDS_SHOW_URL, IDS_SHOW_URL); | 1067 select_all_position + 1, IDS_SHOW_URL, IDS_SHOW_URL); |
1067 } | 1068 } |
1068 | 1069 |
1069 // Minor note: We use IDC_ for command id here while the underlying textfield | 1070 // Minor note: We use IDC_ for command id here while the underlying textfield |
1070 // is using IDS_ for all its command ids. This is because views cannot depend | 1071 // is using IDS_ for all its command ids. This is because views cannot depend |
1071 // on IDC_ for now. | 1072 // on IDC_ for now. |
1072 menu_contents->AddItemWithStringId(IDC_EDIT_SEARCH_ENGINES, | 1073 menu_contents->AddItemWithStringId(IDC_EDIT_SEARCH_ENGINES, |
1073 IDS_EDIT_SEARCH_ENGINES); | 1074 IDS_EDIT_SEARCH_ENGINES); |
1074 } | 1075 } |
OLD | NEW |