 Chromium Code Reviews
 Chromium Code Reviews Issue 12039053:
  Fix cursor position for default provider searches in keyword mode.  (Closed) 
  Base URL: http://git.chromium.org/git/chromium.git@trunk
    
  
    Issue 12039053:
  Fix cursor position for default provider searches in keyword mode.  (Closed) 
  Base URL: http://git.chromium.org/git/chromium.git@trunk| 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/autocomplete/autocomplete_input.h" | 5 #include "chrome/browser/autocomplete/autocomplete_input.h" | 
| 6 | 6 | 
| 7 #include "base/string_util.h" | 7 #include "base/string_util.h" | 
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" | 
| 9 #include "chrome/browser/external_protocol/external_protocol_handler.h" | 9 #include "chrome/browser/external_protocol/external_protocol_handler.h" | 
| 10 #include "chrome/browser/net/url_fixer_upper.h" | 10 #include "chrome/browser/net/url_fixer_upper.h" | 
| (...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 491 | 491 | 
| 492 void AutocompleteInput::UpdateText(const string16& text, | 492 void AutocompleteInput::UpdateText(const string16& text, | 
| 493 size_t cursor_position, | 493 size_t cursor_position, | 
| 494 const url_parse::Parsed& parts) { | 494 const url_parse::Parsed& parts) { | 
| 495 DCHECK(cursor_position <= text.length() || cursor_position == string16::npos); | 495 DCHECK(cursor_position <= text.length() || cursor_position == string16::npos); | 
| 496 text_ = text; | 496 text_ = text; | 
| 497 cursor_position_ = cursor_position; | 497 cursor_position_ = cursor_position; | 
| 498 parts_ = parts; | 498 parts_ = parts; | 
| 499 } | 499 } | 
| 500 | 500 | 
| 501 // TODO: This method does not take into account |parts_|, because | |
| 502 // url_parse::Parsed struct does not provide == operator. | |
| 501 bool AutocompleteInput::Equals(const AutocompleteInput& other) const { | 503 bool AutocompleteInput::Equals(const AutocompleteInput& other) const { | 
| 
Mark P
2013/01/24 04:07:21
Can you add a reminder by the block of variable de
 
Bart N.
2013/01/24 18:32:04
Done.
 | |
| 502 return (text_ == other.text_) && | 504 return (text_ == other.text_) && | 
| 503 (cursor_position_ == other.cursor_position_) && | 505 (cursor_position_ == other.cursor_position_) && | 
| 506 (desired_tld_ == other.desired_tld_) && | |
| 504 (type_ == other.type_) && | 507 (type_ == other.type_) && | 
| 505 (desired_tld_ == other.desired_tld_) && | |
| 506 (scheme_ == other.scheme_) && | 508 (scheme_ == other.scheme_) && | 
| 509 (canonicalized_url_ == other.canonicalized_url_) && | |
| 507 (prevent_inline_autocomplete_ == other.prevent_inline_autocomplete_) && | 510 (prevent_inline_autocomplete_ == other.prevent_inline_autocomplete_) && | 
| 508 (prefer_keyword_ == other.prefer_keyword_) && | 511 (prefer_keyword_ == other.prefer_keyword_) && | 
| 512 (allow_exact_keyword_match_ == other.allow_exact_keyword_match_) && | |
| 509 (matches_requested_ == other.matches_requested_); | 513 (matches_requested_ == other.matches_requested_); | 
| 510 } | 514 } | 
| 511 | 515 | 
| 512 void AutocompleteInput::Clear() { | 516 void AutocompleteInput::Clear() { | 
| 513 text_.clear(); | 517 text_.clear(); | 
| 514 cursor_position_ = string16::npos; | 518 cursor_position_ = string16::npos; | 
| 519 desired_tld_.clear(); | |
| 515 type_ = INVALID; | 520 type_ = INVALID; | 
| 516 parts_ = url_parse::Parsed(); | 521 parts_ = url_parse::Parsed(); | 
| 517 scheme_.clear(); | 522 scheme_.clear(); | 
| 518 desired_tld_.clear(); | 523 canonicalized_url_ = GURL(); | 
| 519 prevent_inline_autocomplete_ = false; | 524 prevent_inline_autocomplete_ = false; | 
| 520 prefer_keyword_ = false; | 525 prefer_keyword_ = false; | 
| 526 allow_exact_keyword_match_ = false; | |
| 527 matches_requested_ = ALL_MATCHES; | |
| 521 } | 528 } | 
| OLD | NEW |