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

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

Issue 839193002: Move ServiceAccessType into //components/keyed_service (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compilation on android Created 5 years, 11 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
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/autocomplete/history_provider.h" 5 #include "chrome/browser/autocomplete/history_provider.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
11 #include "chrome/browser/bookmarks/bookmark_model_factory.h" 11 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
12 #include "chrome/browser/history/history_service.h" 12 #include "chrome/browser/history/history_service.h"
13 #include "chrome/browser/history/history_service_factory.h" 13 #include "chrome/browser/history/history_service_factory.h"
14 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/common/url_constants.h" 15 #include "chrome/common/url_constants.h"
16 #include "components/bookmarks/browser/bookmark_model.h" 16 #include "components/bookmarks/browser/bookmark_model.h"
17 #include "components/history/core/browser/in_memory_url_index_types.h" 17 #include "components/history/core/browser/in_memory_url_index_types.h"
18 #include "components/omnibox/autocomplete_input.h" 18 #include "components/omnibox/autocomplete_input.h"
19 #include "components/omnibox/autocomplete_match.h" 19 #include "components/omnibox/autocomplete_match.h"
20 #include "url/url_util.h" 20 #include "url/url_util.h"
21 21
22 void HistoryProvider::DeleteMatch(const AutocompleteMatch& match) { 22 void HistoryProvider::DeleteMatch(const AutocompleteMatch& match) {
23 DCHECK(done_); 23 DCHECK(done_);
24 DCHECK(profile_); 24 DCHECK(profile_);
25 DCHECK(match.deletable); 25 DCHECK(match.deletable);
26 26
27 HistoryService* const history_service = 27 HistoryService* const history_service = HistoryServiceFactory::GetForProfile(
28 HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); 28 profile_, ServiceAccessType::EXPLICIT_ACCESS);
29 29
30 // Delete the underlying URL along with all its visits from the history DB. 30 // Delete the underlying URL along with all its visits from the history DB.
31 // The resulting HISTORY_URLS_DELETED notification will also cause all caches 31 // The resulting HISTORY_URLS_DELETED notification will also cause all caches
32 // and indices to drop any data they might have stored pertaining to the URL. 32 // and indices to drop any data they might have stored pertaining to the URL.
33 DCHECK(history_service); 33 DCHECK(history_service);
34 DCHECK(match.destination_url.is_valid()); 34 DCHECK(match.destination_url.is_valid());
35 history_service->DeleteURL(match.destination_url); 35 history_service->DeleteURL(match.destination_url);
36 36
37 DeleteMatchFromMatches(match); 37 DeleteMatchFromMatches(match);
38 } 38 }
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 do { 100 do {
101 offset += matches[i].length; 101 offset += matches[i].length;
102 ++i; 102 ++i;
103 } while ((i < match_count) && (offset == matches[i].offset)); 103 } while ((i < match_count) && (offset == matches[i].offset));
104 if (offset < text_length) 104 if (offset < text_length)
105 spans.push_back(ACMatchClassification(offset, url_style)); 105 spans.push_back(ACMatchClassification(offset, url_style));
106 } 106 }
107 107
108 return spans; 108 return spans;
109 } 109 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698