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

Side by Side Diff: chrome/browser/autocomplete/autocomplete_edit.cc

Issue 6028010: Fixes bug in handling of openning background tabs by way of clicking (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 11 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/autocomplete/autocomplete_edit.h" 5 #include "chrome/browser/autocomplete/autocomplete_edit.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 422
423 if (template_url) { 423 if (template_url) {
424 UserMetrics::RecordAction(UserMetricsAction("AcceptedKeyword"), profile_); 424 UserMetrics::RecordAction(UserMetricsAction("AcceptedKeyword"), profile_);
425 template_url_model->IncrementUsageCount(template_url); 425 template_url_model->IncrementUsageCount(template_url);
426 } 426 }
427 427
428 // NOTE: We purposefully don't increment the usage count of the default 428 // NOTE: We purposefully don't increment the usage count of the default
429 // search engine, if applicable; see comments in template_url.h. 429 // search engine, if applicable; see comments in template_url.h.
430 } 430 }
431 431
432 controller_->OnAutocompleteWillAccept(); 432 if (disposition != NEW_BACKGROUND_TAB) {
433 433 controller_->OnAutocompleteWillAccept();
434 if (disposition != NEW_BACKGROUND_TAB)
435 view_->RevertAll(); // Revert the box to its unedited state 434 view_->RevertAll(); // Revert the box to its unedited state
435 }
436 controller_->OnAutocompleteAccept(url, disposition, transition, 436 controller_->OnAutocompleteAccept(url, disposition, transition,
437 alternate_nav_url); 437 alternate_nav_url);
438 } 438 }
439 439
440 bool AutocompleteEditModel::IsPopupOpen() const {
441 return popup_->IsOpen();
442 }
443
440 void AutocompleteEditModel::AcceptKeyword() { 444 void AutocompleteEditModel::AcceptKeyword() {
441 view_->OnBeforePossibleChange(); 445 view_->OnBeforePossibleChange();
442 view_->SetWindowTextAndCaretPos(std::wstring(), 0); 446 view_->SetWindowTextAndCaretPos(std::wstring(), 0);
443 is_keyword_hint_ = false; 447 is_keyword_hint_ = false;
444 keyword_ui_state_ = KEYWORD; 448 keyword_ui_state_ = KEYWORD;
445 view_->OnAfterPossibleChange(); 449 view_->OnAfterPossibleChange();
446 just_deleted_text_ = false; // OnAfterPossibleChange() erroneously sets this 450 just_deleted_text_ = false; // OnAfterPossibleChange() erroneously sets this
447 // since the edit contents have disappeared. It 451 // since the edit contents have disappeared. It
448 // doesn't really matter, but we clear it to be 452 // doesn't really matter, but we clear it to be
449 // consistent. 453 // consistent.
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
836 i->inline_autocomplete_offset != std::wstring::npos) { 840 i->inline_autocomplete_offset != std::wstring::npos) {
837 suggested_text = WideToUTF16(i->fill_into_edit.substr( 841 suggested_text = WideToUTF16(i->fill_into_edit.substr(
838 i->inline_autocomplete_offset)); 842 i->inline_autocomplete_offset));
839 break; 843 break;
840 } 844 }
841 } 845 }
842 } 846 }
843 } 847 }
844 controller_->OnSetSuggestedSearchText(suggested_text); 848 controller_->OnSetSuggestedSearchText(suggested_text);
845 } 849 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698