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

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: Remove change to BookmarkModelObserver and use BaseBookmarkModelObserver 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/base_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::BaseBookmarkModelObserver {
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::BaseBookmarkModelObserver implementation.
41 void BookmarkModelChanged() override;
42
43 // bookmarks::BookmarkModelObserver implementation.
44 void BookmarkNodeRemoved(bookmarks::BookmarkModel* bookmark_model,
45 const bookmarks::BookmarkNode* parent,
46 int old_index,
47 const bookmarks::BookmarkNode* node,
48 const std::set<GURL>& removed_url) override;
49 void BookmarkAllUserNodesRemoved(bookmarks::BookmarkModel* bookmark_model,
50 const std::set<GURL>& removed_urls) override;
51
29 // BookmarkModel instance providing access to bookmarks. May be null during 52 // BookmarkModel instance providing access to bookmarks. May be null during
30 // testing but must outlive ChromeHistoryClient if non-null. 53 // testing but must outlive ChromeHistoryClient if non-null.
31 bookmarks::BookmarkModel* bookmark_model_; 54 bookmarks::BookmarkModel* bookmark_model_;
32 55
56 // Callback invoked when URLs are removed from BookmarkModel.
57 base::Callback<void(const std::set<GURL>&)> on_bookmarks_removed_;
58
59 // Subscription for notifications of changes to favicons.
60 scoped_ptr<base::CallbackList<void(const std::set<GURL>&)>::Subscription>
61 favicon_changed_subscription_;
62
33 DISALLOW_COPY_AND_ASSIGN(ChromeHistoryClient); 63 DISALLOW_COPY_AND_ASSIGN(ChromeHistoryClient);
34 }; 64 };
35 65
36 #endif // CHROME_BROWSER_HISTORY_CHROME_HISTORY_CLIENT_H_ 66 #endif // CHROME_BROWSER_HISTORY_CHROME_HISTORY_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698