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

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

Issue 815983002: Topsites become keyedService based. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: For trybot 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/chrome_history_client.h" 5 #include "chrome/browser/history/chrome_history_client.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "chrome/browser/chrome_notification_types.h" 8 #include "chrome/browser/chrome_notification_types.h"
9 #include "chrome/browser/history/history_notifications.h" 9 #include "chrome/browser/history/history_notifications.h"
10 #include "chrome/browser/history/top_sites.h" 10 #include "chrome/browser/history/top_sites.h"
11 #include "chrome/browser/ui/profile_error_dialog.h" 11 #include "chrome/browser/ui/profile_error_dialog.h"
12 #include "chrome/common/chrome_version_info.h" 12 #include "chrome/common/chrome_version_info.h"
13 #include "chrome/grit/chromium_strings.h" 13 #include "chrome/grit/chromium_strings.h"
14 #include "chrome/grit/generated_resources.h" 14 #include "chrome/grit/generated_resources.h"
15 #include "components/bookmarks/browser/bookmark_model.h" 15 #include "components/bookmarks/browser/bookmark_model.h"
16 #include "content/public/browser/notification_service.h" 16 #include "content/public/browser/notification_service.h"
17 17
18 using bookmarks::BookmarkModel; 18 using bookmarks::BookmarkModel;
19 19
20 ChromeHistoryClient::ChromeHistoryClient(BookmarkModel* bookmark_model, 20 ChromeHistoryClient::ChromeHistoryClient(
21 Profile* profile, 21 BookmarkModel* bookmark_model,
22 history::TopSites* top_sites) 22 Profile* profile,
23 const scoped_refptr<history::TopSites>& top_sites)
23 : bookmark_model_(bookmark_model), 24 : bookmark_model_(bookmark_model),
24 profile_(profile), 25 profile_(profile),
25 top_sites_(top_sites) { 26 top_sites_(top_sites) {
26 DCHECK(bookmark_model_); 27 DCHECK(bookmark_model_);
27 if (top_sites_) 28 if (top_sites_)
28 top_sites_->AddObserver(this); 29 top_sites_->AddObserver(this);
29 } 30 }
30 31
31 ChromeHistoryClient::~ChromeHistoryClient() { 32 ChromeHistoryClient::~ChromeHistoryClient() {
32 if (top_sites_) 33 if (top_sites_)
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 // (meaning if we invoked HistoryService::Cleanup now, we would deadlock). To 79 // (meaning if we invoked HistoryService::Cleanup now, we would deadlock). To
79 // break the deadlock we tell BookmarkModel it's about to be deleted so that 80 // break the deadlock we tell BookmarkModel it's about to be deleted so that
80 // it can release the signal history is waiting on, allowing history to 81 // it can release the signal history is waiting on, allowing history to
81 // shutdown (HistoryService::Cleanup to complete). In such a scenario history 82 // shutdown (HistoryService::Cleanup to complete). In such a scenario history
82 // sees an incorrect view of bookmarks, but it's better than a deadlock. 83 // sees an incorrect view of bookmarks, but it's better than a deadlock.
83 bookmark_model_->Shutdown(); 84 bookmark_model_->Shutdown();
84 } 85 }
85 86
86 void ChromeHistoryClient::TopSitesLoaded(history::TopSites* top_sites) { 87 void ChromeHistoryClient::TopSitesLoaded(history::TopSites* top_sites) {
87 content::NotificationService::current()->Notify( 88 content::NotificationService::current()->Notify(
88 chrome::NOTIFICATION_TOP_SITES_LOADED, 89 chrome::NOTIFICATION_TOP_SITES_LOADED, content::Source<Profile>(profile_),
89 content::Source<Profile>(profile_),
90 content::Details<history::TopSites>(top_sites)); 90 content::Details<history::TopSites>(top_sites));
91 } 91 }
92 92
93 void ChromeHistoryClient::TopSitesChanged(history::TopSites* top_sites) { 93 void ChromeHistoryClient::TopSitesChanged(history::TopSites* top_sites) {
94 content::NotificationService::current()->Notify( 94 content::NotificationService::current()->Notify(
95 chrome::NOTIFICATION_TOP_SITES_CHANGED, 95 chrome::NOTIFICATION_TOP_SITES_CHANGED,
96 content::Source<history::TopSites>(top_sites), 96 content::Source<history::TopSites>(top_sites),
97 content::NotificationService::NoDetails()); 97 content::NotificationService::NoDetails());
98 } 98 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698