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/history/in_memory_history_backend.h" | 5 #include "chrome/browser/history/in_memory_history_backend.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 if (index_.get()) | 34 if (index_.get()) |
35 index_->ShutDown(); | 35 index_->ShutDown(); |
36 } | 36 } |
37 | 37 |
38 bool InMemoryHistoryBackend::Init(const FilePath& history_filename, | 38 bool InMemoryHistoryBackend::Init(const FilePath& history_filename, |
39 const FilePath& history_dir, | 39 const FilePath& history_dir, |
40 URLDatabase* db, | 40 URLDatabase* db, |
41 const std::string& languages) { | 41 const std::string& languages) { |
42 db_.reset(new InMemoryDatabase); | 42 db_.reset(new InMemoryDatabase); |
43 bool success = db_->InitFromDisk(history_filename); | 43 bool success = db_->InitFromDisk(history_filename); |
44 if (CommandLine::ForCurrentProcess()->HasSwitch( | 44 if (!CommandLine::ForCurrentProcess()->HasSwitch( |
45 switches::kEnableHistoryQuickProvider) && | |
46 !CommandLine::ForCurrentProcess()->HasSwitch( | |
47 switches::kDisableHistoryQuickProvider)) { | 45 switches::kDisableHistoryQuickProvider)) { |
48 index_.reset(new InMemoryURLIndex(history_dir)); | 46 index_.reset(new InMemoryURLIndex(history_dir)); |
49 | |
50 index_->Init(db, languages); | 47 index_->Init(db, languages); |
51 } | 48 } |
52 return success; | 49 return success; |
53 } | 50 } |
54 | 51 |
55 void InMemoryHistoryBackend::AttachToHistoryService(Profile* profile) { | 52 void InMemoryHistoryBackend::AttachToHistoryService(Profile* profile) { |
56 if (!db_.get()) { | 53 if (!db_.get()) { |
57 NOTREACHED(); | 54 NOTREACHED(); |
58 return; | 55 return; |
59 } | 56 } |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 | 188 |
192 bool InMemoryHistoryBackend::HasKeyword(const GURL& url) { | 189 bool InMemoryHistoryBackend::HasKeyword(const GURL& url) { |
193 URLID id = db_->GetRowForURL(url, NULL); | 190 URLID id = db_->GetRowForURL(url, NULL); |
194 if (!id) | 191 if (!id) |
195 return false; | 192 return false; |
196 | 193 |
197 return db_->GetKeywordSearchTermRow(id, NULL); | 194 return db_->GetKeywordSearchTermRow(id, NULL); |
198 } | 195 } |
199 | 196 |
200 } // namespace history | 197 } // namespace history |
OLD | NEW |