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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 | 226 |
227 void OmniboxViewViews::ResetTabState(content::WebContents* web_contents) { | 227 void OmniboxViewViews::ResetTabState(content::WebContents* web_contents) { |
228 web_contents->SetUserData(OmniboxState::kKey, nullptr); | 228 web_contents->SetUserData(OmniboxState::kKey, nullptr); |
229 } | 229 } |
230 | 230 |
231 void OmniboxViewViews::Update() { | 231 void OmniboxViewViews::Update() { |
232 const security_state::SecurityStateModel::SecurityLevel old_security_level = | 232 const security_state::SecurityStateModel::SecurityLevel old_security_level = |
233 security_level_; | 233 security_level_; |
234 UpdateSecurityLevel(); | 234 UpdateSecurityLevel(); |
235 if (model()->UpdatePermanentText()) { | 235 if (model()->UpdatePermanentText()) { |
236 // Something visibly changed. Re-enable URL replacement. | |
237 controller()->GetToolbarModel()->set_url_replacement_enabled(true); | |
238 model()->UpdatePermanentText(); | |
239 | |
240 // Select all the new text if the user had all the old text selected, or if | 236 // Select all the new text if the user had all the old text selected, or if |
241 // there was no previous text (for new tab page URL replacement extensions). | 237 // there was no previous text (for new tab page URL replacement extensions). |
242 // This makes one particular case better: the user clicks in the box to | 238 // This makes one particular case better: the user clicks in the box to |
243 // change it right before the permanent URL is changed. Since the new URL | 239 // change it right before the permanent URL is changed. Since the new URL |
244 // is still fully selected, the user's typing will replace the edit contents | 240 // is still fully selected, the user's typing will replace the edit contents |
245 // as they'd intended. | 241 // as they'd intended. |
246 const bool was_select_all = IsSelectAll(); | 242 const bool was_select_all = IsSelectAll(); |
247 const bool was_reversed = GetSelectedRange().is_reversed(); | 243 const bool was_reversed = GetSelectedRange().is_reversed(); |
248 | 244 |
249 RevertAll(); | 245 RevertAll(); |
(...skipping 834 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1084 paste_position + 1, IDS_PASTE_AND_GO, IDS_PASTE_AND_GO); | 1080 paste_position + 1, IDS_PASTE_AND_GO, IDS_PASTE_AND_GO); |
1085 | 1081 |
1086 menu_contents->AddSeparator(ui::NORMAL_SEPARATOR); | 1082 menu_contents->AddSeparator(ui::NORMAL_SEPARATOR); |
1087 | 1083 |
1088 // Minor note: We use IDC_ for command id here while the underlying textfield | 1084 // Minor note: We use IDC_ for command id here while the underlying textfield |
1089 // is using IDS_ for all its command ids. This is because views cannot depend | 1085 // is using IDS_ for all its command ids. This is because views cannot depend |
1090 // on IDC_ for now. | 1086 // on IDC_ for now. |
1091 menu_contents->AddItemWithStringId(IDC_EDIT_SEARCH_ENGINES, | 1087 menu_contents->AddItemWithStringId(IDC_EDIT_SEARCH_ENGINES, |
1092 IDS_EDIT_SEARCH_ENGINES); | 1088 IDS_EDIT_SEARCH_ENGINES); |
1093 } | 1089 } |
OLD | NEW |