Chromium Code Reviews| 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 "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| 11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 12 #include "chrome/app/chrome_command_ids.h" | 12 #include "chrome/app/chrome_command_ids.h" |
| 13 #include "chrome/browser/autocomplete/autocomplete_input.h" | 13 #include "chrome/browser/autocomplete/autocomplete_input.h" |
| 14 #include "chrome/browser/autocomplete/autocomplete_match.h" | 14 #include "chrome/browser/autocomplete/autocomplete_match.h" |
| 15 #include "chrome/browser/bookmarks/bookmark_node_data.h" | 15 #include "chrome/browser/bookmarks/bookmark_node_data.h" |
| 16 #include "chrome/browser/command_updater.h" | 16 #include "chrome/browser/command_updater.h" |
| 17 #include "chrome/browser/omnibox/omnibox_field_trial.h" | |
| 17 #include "chrome/browser/search/search.h" | 18 #include "chrome/browser/search/search.h" |
| 18 #include "chrome/browser/ui/omnibox/omnibox_edit_controller.h" | 19 #include "chrome/browser/ui/omnibox/omnibox_edit_controller.h" |
| 19 #include "chrome/browser/ui/omnibox/omnibox_edit_model.h" | 20 #include "chrome/browser/ui/omnibox/omnibox_edit_model.h" |
| 20 #include "chrome/browser/ui/omnibox/omnibox_popup_model.h" | 21 #include "chrome/browser/ui/omnibox/omnibox_popup_model.h" |
| 21 #include "chrome/browser/ui/view_ids.h" | 22 #include "chrome/browser/ui/view_ids.h" |
| 22 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 23 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
| 23 #include "chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.h" | 24 #include "chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.h" |
| 24 #include "chrome/browser/ui/views/settings_api_bubble_helper_views.h" | 25 #include "chrome/browser/ui/views/settings_api_bubble_helper_views.h" |
| 25 #include "chrome/browser/ui/views/website_settings/website_settings_popup_view.h " | 26 #include "chrome/browser/ui/views/website_settings/website_settings_popup_view.h " |
| 26 #include "content/public/browser/web_contents.h" | 27 #include "content/public/browser/web_contents.h" |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 219 // BrowserView::ActiveTabChanged(). | 220 // BrowserView::ActiveTabChanged(). |
| 220 SelectRange(state->selection); | 221 SelectRange(state->selection); |
| 221 saved_selection_for_focus_change_ = state->saved_selection_for_focus_change; | 222 saved_selection_for_focus_change_ = state->saved_selection_for_focus_change; |
| 222 } | 223 } |
| 223 | 224 |
| 224 // TODO(msw|oshima): Consider saving/restoring edit history. | 225 // TODO(msw|oshima): Consider saving/restoring edit history. |
| 225 ClearEditHistory(); | 226 ClearEditHistory(); |
| 226 } | 227 } |
| 227 | 228 |
| 228 void OmniboxViewViews::Update() { | 229 void OmniboxViewViews::Update() { |
| 229 if (chrome::ShouldDisplayOriginChip() || chrome::ShouldDisplayOriginChipV2()) | 230 if (chrome::ShouldDisplayOriginChip() || |
| 231 chrome::ShouldDisplayOriginChipV2() || | |
| 232 OmniboxFieldTrial::DisplayHintTextWhenPossible()) | |
| 230 set_placeholder_text(GetHintText()); | 233 set_placeholder_text(GetHintText()); |
|
Peter Kasting
2014/04/22 23:40:21
See bug 363805: This will probably result in showi
Mark P
2014/04/22 23:42:55
I don't mind hint text in tab-to-search mode. But
| |
| 231 | 234 |
| 232 const ToolbarModel::SecurityLevel old_security_level = security_level_; | 235 const ToolbarModel::SecurityLevel old_security_level = security_level_; |
| 233 security_level_ = controller()->GetToolbarModel()->GetSecurityLevel(false); | 236 security_level_ = controller()->GetToolbarModel()->GetSecurityLevel(false); |
| 234 if (model()->UpdatePermanentText()) { | 237 if (model()->UpdatePermanentText()) { |
| 235 // Something visibly changed. Re-enable URL replacement. | 238 // Something visibly changed. Re-enable URL replacement. |
| 236 controller()->GetToolbarModel()->set_url_replacement_enabled(true); | 239 controller()->GetToolbarModel()->set_url_replacement_enabled(true); |
| 237 model()->UpdatePermanentText(); | 240 model()->UpdatePermanentText(); |
| 238 | 241 |
| 239 // Select all the new text if the user had all the old text selected, or if | 242 // Select all the new text if the user had all the old text selected, or if |
| 240 // there was no previous text (for new tab page URL replacement extensions). | 243 // there was no previous text (for new tab page URL replacement extensions). |
| (...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1048 menu_contents->InsertItemWithStringIdAt( | 1051 menu_contents->InsertItemWithStringIdAt( |
| 1049 select_all_position + 1, IDS_SHOW_URL, IDS_SHOW_URL); | 1052 select_all_position + 1, IDS_SHOW_URL, IDS_SHOW_URL); |
| 1050 } | 1053 } |
| 1051 | 1054 |
| 1052 // Minor note: We use IDC_ for command id here while the underlying textfield | 1055 // Minor note: We use IDC_ for command id here while the underlying textfield |
| 1053 // is using IDS_ for all its command ids. This is because views cannot depend | 1056 // is using IDS_ for all its command ids. This is because views cannot depend |
| 1054 // on IDC_ for now. | 1057 // on IDC_ for now. |
| 1055 menu_contents->AddItemWithStringId(IDC_EDIT_SEARCH_ENGINES, | 1058 menu_contents->AddItemWithStringId(IDC_EDIT_SEARCH_ENGINES, |
| 1056 IDS_EDIT_SEARCH_ENGINES); | 1059 IDS_EDIT_SEARCH_ENGINES); |
| 1057 } | 1060 } |
| OLD | NEW |