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

Side by Side Diff: chrome/browser/ui/views/omnibox/omnibox_view_views.cc

Issue 23804002: Make OmniboxEditModel::UpdatePermanentText() fetch the new text itself rather (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 3 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 | Annotate | Revision Log
OLDNEW
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/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 if (state) 373 if (state)
374 SelectSelectionModel(state->selection_model); 374 SelectSelectionModel(state->selection_model);
375 375
376 // TODO(msw|oshima): Consider saving/restoring edit history. 376 // TODO(msw|oshima): Consider saving/restoring edit history.
377 ClearEditHistory(); 377 ClearEditHistory();
378 } 378 }
379 379
380 void OmniboxViewViews::Update() { 380 void OmniboxViewViews::Update() {
381 const ToolbarModel::SecurityLevel old_security_level = security_level_; 381 const ToolbarModel::SecurityLevel old_security_level = security_level_;
382 security_level_ = controller()->GetToolbarModel()->GetSecurityLevel(false); 382 security_level_ = controller()->GetToolbarModel()->GetSecurityLevel(false);
383 if (model()->UpdatePermanentText( 383 if (model()->UpdatePermanentText()) {
384 controller()->GetToolbarModel()->GetText(true))) {
385 // Tweak: if the user had all the text selected, select all the new text. 384 // Tweak: if the user had all the text selected, select all the new text.
386 // This makes one particular case better: the user clicks in the box to 385 // This makes one particular case better: the user clicks in the box to
387 // change it right before the permanent URL is changed. Since the new URL 386 // change it right before the permanent URL is changed. Since the new URL
388 // is still fully selected, the user's typing will replace the edit contents 387 // is still fully selected, the user's typing will replace the edit contents
389 // as they'd intended. 388 // as they'd intended.
390 const ui::Range range(GetSelectedRange()); 389 const ui::Range range(GetSelectedRange());
391 const bool was_select_all = (range.length() == text().length()); 390 const bool was_select_all = (range.length() == text().length());
392 391
393 RevertAll(); 392 RevertAll();
394 393
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
894 const string16 text(GetClipboardText()); 893 const string16 text(GetClipboardText());
895 if (!text.empty()) { 894 if (!text.empty()) {
896 // Record this paste, so we can do different behavior. 895 // Record this paste, so we can do different behavior.
897 model()->on_paste(); 896 model()->on_paste();
898 // Force a Paste operation to trigger the text_changed code in 897 // Force a Paste operation to trigger the text_changed code in
899 // OnAfterPossibleChange(), even if identical contents are pasted. 898 // OnAfterPossibleChange(), even if identical contents are pasted.
900 text_before_change_.clear(); 899 text_before_change_.clear();
901 InsertOrReplaceText(text); 900 InsertOrReplaceText(text);
902 } 901 }
903 } 902 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/omnibox/omnibox_view_browsertest.cc ('k') | chrome/browser/ui/views/omnibox/omnibox_view_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698