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

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

Issue 8872036: Profiles: Move NetworkActionPredictor to the ProfileKeyedService framework. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Remove dtor Created 9 years 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
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/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
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();
92 } 91 }
93 92
94 void NetworkActionPredictor::RegisterTransitionalMatches( 93 void NetworkActionPredictor::RegisterTransitionalMatches(
95 const string16& user_text, 94 const string16& user_text,
96 const AutocompleteResult& result) { 95 const AutocompleteResult& result) {
97 if (prerender::GetOmniboxHeuristicToUse() != 96 if (prerender::GetOmniboxHeuristicToUse() !=
98 prerender::OMNIBOX_HEURISTIC_EXACT_FULL) { 97 prerender::OMNIBOX_HEURISTIC_EXACT_FULL) {
99 return; 98 return;
100 } 99 }
101 if (user_text.length() < kMinimumUserTextLength) 100 if (user_text.length() < kMinimumUserTextLength)
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 case AutocompleteMatch::SEARCH_SUGGEST: 181 case AutocompleteMatch::SEARCH_SUGGEST:
183 // A match that uses a non-default search engine (e.g. for tab-to-search). 182 // A match that uses a non-default search engine (e.g. for tab-to-search).
184 case AutocompleteMatch::SEARCH_OTHER_ENGINE: 183 case AutocompleteMatch::SEARCH_OTHER_ENGINE:
185 return true; 184 return true;
186 185
187 default: 186 default:
188 return false; 187 return false;
189 } 188 }
190 } 189 }
191 190
191 void NetworkActionPredictor::Shutdown() {
192 db_->OnPredictorDestroyed();
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
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 }
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/network_action_predictor.h ('k') | chrome/browser/autocomplete/network_action_predictor_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698