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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_BOOKMARKS_CHROME_BOOKMARK_CLIENT_H_
6 #define CHROME_BROWSER_BOOKMARKS_CHROME_BOOKMARK_CLIENT_H_
8 #include "base/compiler_specific.h"
9 #include "components/bookmarks/browser/base_bookmark_model_observer.h"
10 #include "components/bookmarks/browser/bookmark_client.h"
11 #include "components/keyed_service/core/keyed_service.h"
12 #include "content/public/browser/notification_observer.h"
13 #include "content/public/browser/notification_registrar.h"
18 class ChromeBookmarkClient
: public BookmarkClient
,
19 public content::NotificationObserver
,
21 public BaseBookmarkModelObserver
{
23 // |index_urls| says whether URLs should be stored in the BookmarkIndex
24 // in addition to bookmark titles.
25 ChromeBookmarkClient(Profile
* profile
, bool index_urls
);
26 virtual ~ChromeBookmarkClient();
28 // Returns the BookmarkModel that corresponds to this ChromeBookmarkClient.
29 BookmarkModel
* model() { return model_
.get(); }
32 virtual bool PreferTouchIcon() OVERRIDE
;
33 virtual base::CancelableTaskTracker::TaskId
GetFaviconImageForURL(
36 int desired_size_in_dip
,
37 const FaviconImageCallback
& callback
,
38 base::CancelableTaskTracker
* tracker
) OVERRIDE
;
39 virtual bool SupportsTypedCountForNodes() OVERRIDE
;
40 virtual void GetTypedCountForNodes(
42 NodeTypedCountPairs
* node_typed_count_pairs
) OVERRIDE
;
43 virtual bool IsPermanentNodeVisible(int node_type
) OVERRIDE
;
44 virtual void RecordAction(const base::UserMetricsAction
& action
) OVERRIDE
;
46 // content::NotificationObserver:
47 virtual void Observe(int type
,
48 const content::NotificationSource
& source
,
49 const content::NotificationDetails
& details
) OVERRIDE
;
52 virtual void Shutdown() OVERRIDE
;
55 // BaseBookmarkModelObserver:
56 virtual void BookmarkModelChanged() OVERRIDE
;
57 virtual void BookmarkNodeRemoved(BookmarkModel
* model
,
58 const BookmarkNode
* parent
,
60 const BookmarkNode
* node
,
61 const std::set
<GURL
>& removed_urls
) OVERRIDE
;
62 virtual void BookmarkAllNodesRemoved(
64 const std::set
<GURL
>& removed_urls
) OVERRIDE
;
68 content::NotificationRegistrar registrar_
;
70 scoped_ptr
<BookmarkModel
> model_
;
72 DISALLOW_COPY_AND_ASSIGN(ChromeBookmarkClient
);
75 #endif // CHROME_BROWSER_BOOKMARKS_CHROME_BOOKMARK_CLIENT_H_