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

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

Issue 1205603002: Remove dependency of HistoryServiceFactory on ChromeBookmarkClientFactory (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@split_history_client
Patch Set: Created 5 years, 6 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 #ifndef CHROME_BROWSER_HISTORY_CHROME_HISTORY_CLIENT_H_ 5 #ifndef CHROME_BROWSER_HISTORY_CHROME_HISTORY_CLIENT_H_
6 #define CHROME_BROWSER_HISTORY_CHROME_HISTORY_CLIENT_H_ 6 #define CHROME_BROWSER_HISTORY_CHROME_HISTORY_CLIENT_H_
7 7
8 #include <set>
9
10 #include "base/callback_forward.h"
11 #include "base/callback_list.h"
8 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "components/bookmarks/browser/bookmark_model_observer.h"
9 #include "components/history/core/browser/history_client.h" 15 #include "components/history/core/browser/history_client.h"
10 16
17 class GURL;
18
11 namespace bookmarks { 19 namespace bookmarks {
12 class BookmarkModel; 20 class BookmarkModel;
21 class BookmarkNode;
13 } 22 }
14 23
15 // This class implements history::HistoryClient to abstract operations that 24 // This class implements history::HistoryClient to abstract operations that
16 // depend on Chrome environment. 25 // depend on Chrome environment.
17 class ChromeHistoryClient : public history::HistoryClient { 26 class ChromeHistoryClient : public history::HistoryClient,
27 public bookmarks::BookmarkModelObserver {
18 public: 28 public:
19 explicit ChromeHistoryClient(bookmarks::BookmarkModel* bookmark_model); 29 explicit ChromeHistoryClient(bookmarks::BookmarkModel* bookmark_model);
20 ~ChromeHistoryClient() override; 30 ~ChromeHistoryClient() override;
21 31
22 // history::HistoryClient implementation. 32 // history::HistoryClient implementation.
33 void Init(history::HistoryService* history_service) override;
23 void Shutdown() override; 34 void Shutdown() override;
24 bool CanAddURL(const GURL& url) override; 35 bool CanAddURL(const GURL& url) override;
25 void NotifyProfileError(sql::InitStatus init_status) override; 36 void NotifyProfileError(sql::InitStatus init_status) override;
26 scoped_ptr<history::HistoryBackendClient> CreateBackendClient() override; 37 scoped_ptr<history::HistoryBackendClient> CreateBackendClient() override;
27 38
28 private: 39 private:
40 // bookmarks::BookmarkModelObserver implementation.
41 void BookmarkNodeRemoved(bookmarks::BookmarkModel* bookmark_model,
42 const bookmarks::BookmarkNode* parent,
43 int old_index,
44 const bookmarks::BookmarkNode* node,
45 const std::set<GURL>& removed_url) override;
46 void BookmarkAllUserNodesRemoved(bookmarks::BookmarkModel* bookmark_model,
47 const std::set<GURL>& removed_urls) override;
48
29 // BookmarkModel instance providing access to bookmarks. May be null during 49 // BookmarkModel instance providing access to bookmarks. May be null during
30 // testing but must outlive ChromeHistoryClient if non-null. 50 // testing but must outlive ChromeHistoryClient if non-null.
31 bookmarks::BookmarkModel* bookmark_model_; 51 bookmarks::BookmarkModel* bookmark_model_;
32 52
53 // Callback invoked when URLs are removed from BookmarkModel.
54 base::Callback<void(const std::set<GURL>&)> on_bookmarks_removed_;
55
56 // Subscription for notifications of changes to favicons.
57 scoped_ptr<base::CallbackList<void(const std::set<GURL>&)>::Subscription>
58 favicon_changed_subscription_;
59
33 DISALLOW_COPY_AND_ASSIGN(ChromeHistoryClient); 60 DISALLOW_COPY_AND_ASSIGN(ChromeHistoryClient);
34 }; 61 };
35 62
36 #endif // CHROME_BROWSER_HISTORY_CHROME_HISTORY_CLIENT_H_ 63 #endif // CHROME_BROWSER_HISTORY_CHROME_HISTORY_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698