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/network_action_predictor.h" | 5 #include "chrome/browser/autocomplete/network_action_predictor.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
81 new std::vector<NetworkActionPredictorDatabase::Row>(); | 81 new std::vector<NetworkActionPredictorDatabase::Row>(); |
82 content::BrowserThread::PostTaskAndReply( | 82 content::BrowserThread::PostTaskAndReply( |
83 content::BrowserThread::DB, FROM_HERE, | 83 content::BrowserThread::DB, FROM_HERE, |
84 base::Bind(&NetworkActionPredictorDatabase::GetAllRows, db_, rows), | 84 base::Bind(&NetworkActionPredictorDatabase::GetAllRows, db_, rows), |
85 base::Bind(&NetworkActionPredictor::CreateCaches, AsWeakPtr(), | 85 base::Bind(&NetworkActionPredictor::CreateCaches, AsWeakPtr(), |
86 base::Owned(rows))); | 86 base::Owned(rows))); |
87 | 87 |
88 } | 88 } |
89 | 89 |
90 NetworkActionPredictor::~NetworkActionPredictor() { | 90 NetworkActionPredictor::~NetworkActionPredictor() { |
91 db_->OnPredictorDestroyed(); | 91 db_->OnPredictorDestroyed(); |
dominich
2011/12/12 16:58:39
This should be moved to Shutdown.
Elliot Glaysher
2011/12/12 18:16:15
Done.
| |
92 } | 92 } |
93 | 93 |
94 void NetworkActionPredictor::RegisterTransitionalMatches( | 94 void NetworkActionPredictor::RegisterTransitionalMatches( |
95 const string16& user_text, | 95 const string16& user_text, |
96 const AutocompleteResult& result) { | 96 const AutocompleteResult& result) { |
97 if (prerender::GetOmniboxHeuristicToUse() != | 97 if (prerender::GetOmniboxHeuristicToUse() != |
98 prerender::OMNIBOX_HEURISTIC_EXACT_FULL) { | 98 prerender::OMNIBOX_HEURISTIC_EXACT_FULL) { |
99 return; | 99 return; |
100 } | 100 } |
101 if (user_text.length() < kMinimumUserTextLength) | 101 if (user_text.length() < kMinimumUserTextLength) |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
182 case AutocompleteMatch::SEARCH_SUGGEST: | 182 case AutocompleteMatch::SEARCH_SUGGEST: |
183 // A match that uses a non-default search engine (e.g. for tab-to-search). | 183 // A match that uses a non-default search engine (e.g. for tab-to-search). |
184 case AutocompleteMatch::SEARCH_OTHER_ENGINE: | 184 case AutocompleteMatch::SEARCH_OTHER_ENGINE: |
185 return true; | 185 return true; |
186 | 186 |
187 default: | 187 default: |
188 return false; | 188 return false; |
189 } | 189 } |
190 } | 190 } |
191 | 191 |
192 void NetworkActionPredictor::Shutdown() { | |
193 } | |
194 | |
192 void NetworkActionPredictor::Observe( | 195 void NetworkActionPredictor::Observe( |
193 int type, | 196 int type, |
194 const content::NotificationSource& source, | 197 const content::NotificationSource& source, |
195 const content::NotificationDetails& details) { | 198 const content::NotificationDetails& details) { |
196 switch (type) { | 199 switch (type) { |
197 case chrome::NOTIFICATION_HISTORY_URLS_DELETED: { | 200 case chrome::NOTIFICATION_HISTORY_URLS_DELETED: { |
198 DCHECK(initialized_); | 201 DCHECK(initialized_); |
199 const content::Details<const history::URLsDeletedDetails> | 202 const content::Details<const history::URLsDeletedDetails> |
200 urls_deleted_details = | 203 urls_deleted_details = |
201 content::Details<const history::URLsDeletedDetails>(details); | 204 content::Details<const history::URLsDeletedDetails>(details); |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
472 | 475 |
473 content::BrowserThread::PostTask(content::BrowserThread::DB, FROM_HERE, | 476 content::BrowserThread::PostTask(content::BrowserThread::DB, FROM_HERE, |
474 base::Bind(&NetworkActionPredictorDatabase::CommitTransaction, db_)); | 477 base::Bind(&NetworkActionPredictorDatabase::CommitTransaction, db_)); |
475 } | 478 } |
476 | 479 |
477 NetworkActionPredictor::TransitionalMatch::TransitionalMatch() { | 480 NetworkActionPredictor::TransitionalMatch::TransitionalMatch() { |
478 } | 481 } |
479 | 482 |
480 NetworkActionPredictor::TransitionalMatch::~TransitionalMatch() { | 483 NetworkActionPredictor::TransitionalMatch::~TransitionalMatch() { |
481 } | 484 } |
OLD | NEW |