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" |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 | 222 |
223 void OmniboxViewViews::Update() { | 223 void OmniboxViewViews::Update() { |
224 if (chrome::ShouldDisplayOriginChip() || chrome::ShouldDisplayOriginChipV2()) | 224 if (chrome::ShouldDisplayOriginChip() || chrome::ShouldDisplayOriginChipV2()) |
225 set_placeholder_text(GetHintText()); | 225 set_placeholder_text(GetHintText()); |
226 | 226 |
227 const ToolbarModel::SecurityLevel old_security_level = security_level_; | 227 const ToolbarModel::SecurityLevel old_security_level = security_level_; |
228 security_level_ = controller()->GetToolbarModel()->GetSecurityLevel(false); | 228 security_level_ = controller()->GetToolbarModel()->GetSecurityLevel(false); |
229 if (model()->UpdatePermanentText()) { | 229 if (model()->UpdatePermanentText()) { |
230 // Something visibly changed. Re-enable URL replacement. | 230 // Something visibly changed. Re-enable URL replacement. |
231 controller()->GetToolbarModel()->set_url_replacement_enabled(true); | 231 controller()->GetToolbarModel()->set_url_replacement_enabled(true); |
| 232 controller()->GetToolbarModel()->set_origin_chip_enabled(true); |
232 model()->UpdatePermanentText(); | 233 model()->UpdatePermanentText(); |
233 | 234 |
234 // Select all the new text if the user had all the old text selected, or if | 235 // Select all the new text if the user had all the old text selected, or if |
235 // there was no previous text (for new tab page URL replacement extensions). | 236 // there was no previous text (for new tab page URL replacement extensions). |
236 // This makes one particular case better: the user clicks in the box to | 237 // This makes one particular case better: the user clicks in the box to |
237 // change it right before the permanent URL is changed. Since the new URL | 238 // change it right before the permanent URL is changed. Since the new URL |
238 // is still fully selected, the user's typing will replace the edit contents | 239 // is still fully selected, the user's typing will replace the edit contents |
239 // as they'd intended. | 240 // as they'd intended. |
240 const bool was_select_all = IsSelectAll(); | 241 const bool was_select_all = IsSelectAll(); |
241 const bool was_reversed = GetSelectedRange().is_reversed(); | 242 const bool was_reversed = GetSelectedRange().is_reversed(); |
(...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1045 menu_contents->InsertItemWithStringIdAt( | 1046 menu_contents->InsertItemWithStringIdAt( |
1046 select_all_position + 1, IDS_SHOW_URL, IDS_SHOW_URL); | 1047 select_all_position + 1, IDS_SHOW_URL, IDS_SHOW_URL); |
1047 } | 1048 } |
1048 | 1049 |
1049 // Minor note: We use IDC_ for command id here while the underlying textfield | 1050 // Minor note: We use IDC_ for command id here while the underlying textfield |
1050 // is using IDS_ for all its command ids. This is because views cannot depend | 1051 // is using IDS_ for all its command ids. This is because views cannot depend |
1051 // on IDC_ for now. | 1052 // on IDC_ for now. |
1052 menu_contents->AddItemWithStringId(IDC_EDIT_SEARCH_ENGINES, | 1053 menu_contents->AddItemWithStringId(IDC_EDIT_SEARCH_ENGINES, |
1053 IDS_EDIT_SEARCH_ENGINES); | 1054 IDS_EDIT_SEARCH_ENGINES); |
1054 } | 1055 } |
OLD | NEW |