| OLD | NEW |
| 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/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" |
| 11 #include "base/time.h" | 11 #include "base/time.h" |
| 12 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
| 13 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
| 14 #include "chrome/browser/history/history_notifications.h" | 14 #include "chrome/browser/history/history_notifications.h" |
| 15 #include "chrome/browser/history/in_memory_database.h" | 15 #include "chrome/browser/history/in_memory_database.h" |
| 16 #include "chrome/browser/history/url_database.h" | 16 #include "chrome/browser/history/url_database.h" |
| 17 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
| 18 #include "chrome/common/chrome_notification_types.h" | 18 #include "chrome/common/chrome_notification_types.h" |
| 19 #include "content/public/browser/notification_details.h" | 19 #include "content/public/browser/notification_details.h" |
| 20 #include "content/public/browser/notification_source.h" | 20 #include "content/public/browser/notification_source.h" |
| 21 | 21 |
| 22 namespace history { | 22 namespace history { |
| 23 | 23 |
| 24 InMemoryHistoryBackend::InMemoryHistoryBackend() | 24 InMemoryHistoryBackend::InMemoryHistoryBackend() |
| 25 : profile_(NULL) { | 25 : profile_(NULL) { |
| 26 } | 26 } |
| 27 | 27 |
| 28 InMemoryHistoryBackend::~InMemoryHistoryBackend() {} | 28 InMemoryHistoryBackend::~InMemoryHistoryBackend() {} |
| 29 | 29 |
| 30 bool InMemoryHistoryBackend::Init(const FilePath& history_filename, | 30 bool InMemoryHistoryBackend::Init(const base::FilePath& history_filename, |
| 31 URLDatabase* db) { | 31 URLDatabase* db) { |
| 32 db_.reset(new InMemoryDatabase); | 32 db_.reset(new InMemoryDatabase); |
| 33 return db_->InitFromDisk(history_filename); | 33 return db_->InitFromDisk(history_filename); |
| 34 } | 34 } |
| 35 | 35 |
| 36 void InMemoryHistoryBackend::AttachToHistoryService(Profile* profile) { | 36 void InMemoryHistoryBackend::AttachToHistoryService(Profile* profile) { |
| 37 if (!db_.get()) { | 37 if (!db_.get()) { |
| 38 NOTREACHED(); | 38 NOTREACHED(); |
| 39 return; | 39 return; |
| 40 } | 40 } |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 | 169 |
| 170 bool InMemoryHistoryBackend::HasKeyword(const GURL& url) { | 170 bool InMemoryHistoryBackend::HasKeyword(const GURL& url) { |
| 171 URLID id = db_->GetRowForURL(url, NULL); | 171 URLID id = db_->GetRowForURL(url, NULL); |
| 172 if (!id) | 172 if (!id) |
| 173 return false; | 173 return false; |
| 174 | 174 |
| 175 return db_->GetKeywordSearchTermRow(id, NULL); | 175 return db_->GetKeywordSearchTermRow(id, NULL); |
| 176 } | 176 } |
| 177 | 177 |
| 178 } // namespace history | 178 } // namespace history |
| OLD | NEW |