| 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 1015 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1056 } | 1057 } |
| 1057 | 1058 |
| 1058 void OmniboxViewViews::UpdateContextMenu(ui::SimpleMenuModel* menu_contents) { | 1059 void OmniboxViewViews::UpdateContextMenu(ui::SimpleMenuModel* menu_contents) { |
| 1059 int paste_position = menu_contents->GetIndexOfCommandId(IDS_APP_PASTE); | 1060 int paste_position = menu_contents->GetIndexOfCommandId(IDS_APP_PASTE); |
| 1060 DCHECK_GE(paste_position, 0); | 1061 DCHECK_GE(paste_position, 0); |
| 1061 menu_contents->InsertItemWithStringIdAt( | 1062 menu_contents->InsertItemWithStringIdAt( |
| 1062 paste_position + 1, IDS_PASTE_AND_GO, IDS_PASTE_AND_GO); | 1063 paste_position + 1, IDS_PASTE_AND_GO, IDS_PASTE_AND_GO); |
| 1063 | 1064 |
| 1064 menu_contents->AddSeparator(ui::NORMAL_SEPARATOR); | 1065 menu_contents->AddSeparator(ui::NORMAL_SEPARATOR); |
| 1065 | 1066 |
| 1066 if (chrome::IsQueryExtractionEnabled()) { | 1067 if (search::IsQueryExtractionEnabled()) { |
| 1067 int select_all_position = menu_contents->GetIndexOfCommandId( | 1068 int select_all_position = menu_contents->GetIndexOfCommandId( |
| 1068 IDS_APP_SELECT_ALL); | 1069 IDS_APP_SELECT_ALL); |
| 1069 DCHECK_GE(select_all_position, 0); | 1070 DCHECK_GE(select_all_position, 0); |
| 1070 menu_contents->InsertItemWithStringIdAt( | 1071 menu_contents->InsertItemWithStringIdAt( |
| 1071 select_all_position + 1, IDS_SHOW_URL, IDS_SHOW_URL); | 1072 select_all_position + 1, IDS_SHOW_URL, IDS_SHOW_URL); |
| 1072 } | 1073 } |
| 1073 | 1074 |
| 1074 // Minor note: We use IDC_ for command id here while the underlying textfield | 1075 // Minor note: We use IDC_ for command id here while the underlying textfield |
| 1075 // is using IDS_ for all its command ids. This is because views cannot depend | 1076 // is using IDS_ for all its command ids. This is because views cannot depend |
| 1076 // on IDC_ for now. | 1077 // on IDC_ for now. |
| 1077 menu_contents->AddItemWithStringId(IDC_EDIT_SEARCH_ENGINES, | 1078 menu_contents->AddItemWithStringId(IDC_EDIT_SEARCH_ENGINES, |
| 1078 IDS_EDIT_SEARCH_ENGINES); | 1079 IDS_EDIT_SEARCH_ENGINES); |
| 1079 } | 1080 } |
| OLD | NEW |