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

Side by Side Diff: chrome/browser/history/in_memory_history_backend.cc

Issue 642623004: Rename VisitDatabaseObserver to HistoryServiceObserver (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@373326
Patch Set: Created 6 years, 2 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/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 10 matching lines...) Expand all
21 #include "content/public/browser/notification_source.h" 21 #include "content/public/browser/notification_source.h"
22 22
23 namespace history { 23 namespace history {
24 24
25 InMemoryHistoryBackend::InMemoryHistoryBackend() 25 InMemoryHistoryBackend::InMemoryHistoryBackend()
26 : profile_(nullptr), history_service_(nullptr) { 26 : profile_(nullptr), history_service_(nullptr) {
27 } 27 }
28 28
29 InMemoryHistoryBackend::~InMemoryHistoryBackend() { 29 InMemoryHistoryBackend::~InMemoryHistoryBackend() {
30 if (history_service_) 30 if (history_service_)
31 history_service_->RemoveHistoryServiceObserver(this); 31 history_service_->RemoveObserver(this);
32 } 32 }
33 33
34 bool InMemoryHistoryBackend::Init(const base::FilePath& history_filename) { 34 bool InMemoryHistoryBackend::Init(const base::FilePath& history_filename) {
35 db_.reset(new InMemoryDatabase); 35 db_.reset(new InMemoryDatabase);
36 return db_->InitFromDisk(history_filename); 36 return db_->InitFromDisk(history_filename);
37 } 37 }
38 38
39 void InMemoryHistoryBackend::AttachToHistoryService( 39 void InMemoryHistoryBackend::AttachToHistoryService(
40 Profile* profile, 40 Profile* profile,
41 HistoryService* history_service) { 41 HistoryService* history_service) {
42 if (!db_) { 42 if (!db_) {
43 NOTREACHED(); 43 NOTREACHED();
44 return; 44 return;
45 } 45 }
46 46
47 DCHECK(history_service); 47 DCHECK(history_service);
48 history_service_ = history_service; 48 history_service_ = history_service;
49 history_service_->AddHistoryServiceObserver(this); 49 history_service_->AddObserver(this);
50 50
51 profile_ = profile; 51 profile_ = profile;
52 52
53 // TODO(evanm): this is currently necessitated by generate_profile, which 53 // TODO(evanm): this is currently necessitated by generate_profile, which
54 // runs without a browser process. generate_profile should really create 54 // runs without a browser process. generate_profile should really create
55 // a browser process, at which point this check can then be nuked. 55 // a browser process, at which point this check can then be nuked.
56 if (!g_browser_process) 56 if (!g_browser_process)
57 return; 57 return;
58 58
59 // Register for the notifications we care about. 59 // Register for the notifications we care about.
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 } 153 }
154 154
155 void InMemoryHistoryBackend::OnKeywordSearchTermDeleted( 155 void InMemoryHistoryBackend::OnKeywordSearchTermDeleted(
156 const KeywordSearchDeletedDetails& details) { 156 const KeywordSearchDeletedDetails& details) {
157 // For simplicity, this will not remove the corresponding URLRow, but this is 157 // For simplicity, this will not remove the corresponding URLRow, but this is
158 // okay, as the main database does not do so either. 158 // okay, as the main database does not do so either.
159 db_->DeleteKeywordSearchTermForURL(details.url_row_id); 159 db_->DeleteKeywordSearchTermForURL(details.url_row_id);
160 } 160 }
161 161
162 } // namespace history 162 } // namespace history
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698