OLD | NEW |
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.h" | 5 #include "chrome/browser/autocomplete/autocomplete.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
654 matches_.end(), &AutocompleteMatch::MoreRelevant); | 654 matches_.end(), &AutocompleteMatch::MoreRelevant); |
655 matches_.resize(num_matches); | 655 matches_.resize(num_matches); |
656 | 656 |
657 default_match_ = begin(); | 657 default_match_ = begin(); |
658 | 658 |
659 // Set the alternate nav URL. | 659 // Set the alternate nav URL. |
660 alternate_nav_url_ = GURL(); | 660 alternate_nav_url_ = GURL(); |
661 if (((input.type() == AutocompleteInput::UNKNOWN) || | 661 if (((input.type() == AutocompleteInput::UNKNOWN) || |
662 (input.type() == AutocompleteInput::REQUESTED_URL)) && | 662 (input.type() == AutocompleteInput::REQUESTED_URL)) && |
663 (default_match_ != end()) && | 663 (default_match_ != end()) && |
664 (default_match_->transition != PageTransition::TYPED) && | 664 (default_match_->transition != content::PAGE_TRANSITION_TYPED) && |
665 (default_match_->transition != PageTransition::KEYWORD) && | 665 (default_match_->transition != content::PAGE_TRANSITION_KEYWORD) && |
666 (input.canonicalized_url() != default_match_->destination_url)) | 666 (input.canonicalized_url() != default_match_->destination_url)) |
667 alternate_nav_url_ = input.canonicalized_url(); | 667 alternate_nav_url_ = input.canonicalized_url(); |
668 } | 668 } |
669 | 669 |
670 bool AutocompleteResult::HasCopiedMatches() const { | 670 bool AutocompleteResult::HasCopiedMatches() const { |
671 for (ACMatches::const_iterator i = begin(); i != end(); ++i) { | 671 for (ACMatches::const_iterator i = begin(); i != end(); ++i) { |
672 if (i->from_previous) | 672 if (i->from_previous) |
673 return true; | 673 return true; |
674 } | 674 } |
675 return false; | 675 return false; |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1014 } | 1014 } |
1015 done_ = true; | 1015 done_ = true; |
1016 } | 1016 } |
1017 | 1017 |
1018 void AutocompleteController::StartExpireTimer() { | 1018 void AutocompleteController::StartExpireTimer() { |
1019 if (result_.HasCopiedMatches()) | 1019 if (result_.HasCopiedMatches()) |
1020 expire_timer_.Start(FROM_HERE, | 1020 expire_timer_.Start(FROM_HERE, |
1021 base::TimeDelta::FromMilliseconds(kExpireTimeMS), | 1021 base::TimeDelta::FromMilliseconds(kExpireTimeMS), |
1022 this, &AutocompleteController::ExpireCopiedEntries); | 1022 this, &AutocompleteController::ExpireCopiedEntries); |
1023 } | 1023 } |
OLD | NEW |