Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(622)

Side by Side Diff: components/omnibox/browser/omnibox_edit_model.cc

Issue 2763063002: [omnibox] Narrow condition for resetting selection (Closed)
Patch Set: Restored include file Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/omnibox/browser/omnibox_edit_model.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 "components/omnibox/browser/omnibox_edit_model.h" 5 #include "components/omnibox/browser/omnibox_edit_model.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 if (perm_url.SchemeIs(url::kHttpScheme) && url->SchemeIs(url::kHttpScheme) && 331 if (perm_url.SchemeIs(url::kHttpScheme) && url->SchemeIs(url::kHttpScheme) &&
332 perm_url.host_piece() == url->host_piece()) { 332 perm_url.host_piece() == url->host_piece()) {
333 *write_url = true; 333 *write_url = true;
334 base::string16 http = base::ASCIIToUTF16(url::kHttpScheme) + 334 base::string16 http = base::ASCIIToUTF16(url::kHttpScheme) +
335 base::ASCIIToUTF16(url::kStandardSchemeSeparator); 335 base::ASCIIToUTF16(url::kStandardSchemeSeparator);
336 if (text->compare(0, http.length(), http) != 0) 336 if (text->compare(0, http.length(), http) != 0)
337 *text = http + *text; 337 *text = http + *text;
338 } 338 }
339 } 339 }
340 340
341 bool OmniboxEditModel::text_update_in_progress() const {
342 return permanent_text_ !=
343 controller_->GetToolbarModel()->GetFormattedURL(nullptr);
Peter Kasting 2017/03/21 22:47:18 Why would the |permanent_text_| be out of sync wit
Kevin Bailey 2017/03/23 13:14:37 The comment in ::OnBlur() implies that some update
Peter Kasting 2017/03/23 21:52:12 The paragraph I wrote describes the place this is
Kevin Bailey 2017/04/10 18:49:30 I haven't seen anything different. The code was my
344 }
345
341 void OmniboxEditModel::SetInputInProgress(bool in_progress) { 346 void OmniboxEditModel::SetInputInProgress(bool in_progress) {
342 if (in_progress && !user_input_since_focus_) { 347 if (in_progress && !user_input_since_focus_) {
343 base::TimeTicks now = base::TimeTicks::Now(); 348 base::TimeTicks now = base::TimeTicks::Now();
344 DCHECK(last_omnibox_focus_ <= now); 349 DCHECK(last_omnibox_focus_ <= now);
345 UMA_HISTOGRAM_TIMES(kFocusToEditTimeHistogram, now - last_omnibox_focus_); 350 UMA_HISTOGRAM_TIMES(kFocusToEditTimeHistogram, now - last_omnibox_focus_);
346 user_input_since_focus_ = true; 351 user_input_since_focus_ = true;
347 } 352 }
348 353
349 if (user_input_in_progress_ == in_progress) 354 if (user_input_in_progress_ == in_progress)
350 return; 355 return;
(...skipping 1036 matching lines...) Expand 10 before | Expand all | Expand 10 after
1387 // Update state and notify view if the omnibox has focus and the caret 1392 // Update state and notify view if the omnibox has focus and the caret
1388 // visibility changed. 1393 // visibility changed.
1389 const bool was_caret_visible = is_caret_visible(); 1394 const bool was_caret_visible = is_caret_visible();
1390 focus_state_ = state; 1395 focus_state_ = state;
1391 if (focus_state_ != OMNIBOX_FOCUS_NONE && 1396 if (focus_state_ != OMNIBOX_FOCUS_NONE &&
1392 is_caret_visible() != was_caret_visible) 1397 is_caret_visible() != was_caret_visible)
1393 view_->ApplyCaretVisibility(); 1398 view_->ApplyCaretVisibility();
1394 1399
1395 client_->OnFocusChanged(focus_state_, reason); 1400 client_->OnFocusChanged(focus_state_, reason);
1396 } 1401 }
OLDNEW
« no previous file with comments | « components/omnibox/browser/omnibox_edit_model.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698