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

Side by Side Diff: chrome/browser/instant/instant_controller.cc

Issue 11192008: Set grey text in the omnibox irrespective of the verbatim state. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 2 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 | « no previous file | 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 (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/instant/instant_controller.h" 5 #include "chrome/browser/instant/instant_controller.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/i18n/case_conversion.h" 8 #include "base/i18n/case_conversion.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/time.h" 10 #include "base/time.h"
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 !suggestion_lower.compare(0, user_text_lower.size(), 561 !suggestion_lower.compare(0, user_text_lower.size(),
562 user_text_lower)) { 562 user_text_lower)) {
563 suggestion.text.assign(suggestion_lower, user_text_lower.size(), 563 suggestion.text.assign(suggestion_lower, user_text_lower.size(),
564 suggestion_lower.size() - user_text_lower.size()); 564 suggestion_lower.size() - user_text_lower.size());
565 } else { 565 } else {
566 suggestion.text.clear(); 566 suggestion.text.clear();
567 } 567 }
568 } 568 }
569 569
570 last_suggestion_ = suggestion; 570 last_suggestion_ = suggestion;
571 if (!last_verbatim_) 571 // Set the suggested text if the suggestion behavior is
572 // INSTANT_COMPLETE_NEVER irrespective of verbatim because in this case
573 // the suggested text does not get committed if the user presses enter.
574 if (suggestion.behavior == INSTANT_COMPLETE_NEVER || !last_verbatim_)
572 delegate_->SetSuggestedText(suggestion.text, suggestion.behavior); 575 delegate_->SetSuggestedText(suggestion.text, suggestion.behavior);
573 } 576 }
574 577
575 if (mode_ != SUGGEST) 578 if (mode_ != SUGGEST)
576 Show(100, INSTANT_SIZE_PERCENT); 579 Show(100, INSTANT_SIZE_PERCENT);
577 } 580 }
578 581
579 void InstantController::CommitInstantLoader(InstantLoader* loader) { 582 void InstantController::CommitInstantLoader(InstantLoader* loader) {
580 if (loader_ != loader || !is_showing_ || IsOutOfDate()) 583 if (loader_ != loader || !is_showing_ || IsOutOfDate())
581 return; 584 return;
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
816 iter->second > kMaxInstantSupportFailures) 819 iter->second > kMaxInstantSupportFailures)
817 return false; 820 return false;
818 821
819 return true; 822 return true;
820 } 823 }
821 824
822 bool InstantController::IsOutOfDate() const { 825 bool InstantController::IsOutOfDate() const {
823 return !last_active_tab_ || 826 return !last_active_tab_ ||
824 last_active_tab_ != delegate_->GetActiveTabContents(); 827 last_active_tab_ != delegate_->GetActiveTabContents();
825 } 828 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698