OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_ANDROID_BOOKMARKS_PARTNER_BOOKMARKS_SHIM_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_BOOKMARKS_PARTNER_BOOKMARKS_SHIM_H_ |
6 #define CHROME_BROWSER_ANDROID_BOOKMARKS_PARTNER_BOOKMARKS_SHIM_H_ | 6 #define CHROME_BROWSER_ANDROID_BOOKMARKS_PARTNER_BOOKMARKS_SHIM_H_ |
7 | 7 |
| 8 #include <stdint.h> |
| 9 |
8 #include "base/android/jni_weak_ref.h" | 10 #include "base/android/jni_weak_ref.h" |
| 11 #include "base/macros.h" |
9 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
10 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
11 #include "base/supports_user_data.h" | 14 #include "base/supports_user_data.h" |
12 #include "components/bookmarks/browser/bookmark_model.h" | 15 #include "components/bookmarks/browser/bookmark_model.h" |
13 #include "url/gurl.h" | 16 #include "url/gurl.h" |
14 | 17 |
15 class PrefService; | 18 class PrefService; |
16 | 19 |
17 namespace content { | 20 namespace content { |
18 class BrowserContext; | 21 class BrowserContext; |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 // Called just before everything got destroyed | 79 // Called just before everything got destroyed |
77 virtual void ShimBeingDeleted(PartnerBookmarksShim*) {} | 80 virtual void ShimBeingDeleted(PartnerBookmarksShim*) {} |
78 protected: | 81 protected: |
79 virtual ~Observer() {} | 82 virtual ~Observer() {} |
80 }; | 83 }; |
81 | 84 |
82 void AddObserver(Observer* observer); | 85 void AddObserver(Observer* observer); |
83 void RemoveObserver(Observer* observer); | 86 void RemoveObserver(Observer* observer); |
84 | 87 |
85 // PartnerBookmarksShim versions of BookmarkModel/BookmarkNode methods | 88 // PartnerBookmarksShim versions of BookmarkModel/BookmarkNode methods |
86 const bookmarks::BookmarkNode* GetNodeByID(int64 id) const; | 89 const bookmarks::BookmarkNode* GetNodeByID(int64_t id) const; |
87 base::string16 GetTitle(const bookmarks::BookmarkNode* node) const; | 90 base::string16 GetTitle(const bookmarks::BookmarkNode* node) const; |
88 | 91 |
89 bool IsPartnerBookmark(const bookmarks::BookmarkNode* node) const; | 92 bool IsPartnerBookmark(const bookmarks::BookmarkNode* node) const; |
90 const bookmarks::BookmarkNode* GetPartnerBookmarksRoot() const; | 93 const bookmarks::BookmarkNode* GetPartnerBookmarksRoot() const; |
91 | 94 |
92 // Sets the root node of the partner bookmarks and notifies any observers that | 95 // Sets the root node of the partner bookmarks and notifies any observers that |
93 // the shim has now been loaded. Takes ownership of |root_node|. | 96 // the shim has now been loaded. Takes ownership of |root_node|. |
94 void SetPartnerBookmarksRoot(bookmarks::BookmarkNode* root_node); | 97 void SetPartnerBookmarksRoot(bookmarks::BookmarkNode* root_node); |
95 | 98 |
96 // Used as a "unique" identifier of the partner bookmark node for the purposes | 99 // Used as a "unique" identifier of the partner bookmark node for the purposes |
(...skipping 22 matching lines...) Expand all Loading... |
119 | 122 |
120 // For testing: re-enables partner bookmarks editing. | 123 // For testing: re-enables partner bookmarks editing. |
121 static void EnablePartnerBookmarksEditing(); | 124 static void EnablePartnerBookmarksEditing(); |
122 | 125 |
123 private: | 126 private: |
124 explicit PartnerBookmarksShim(PrefService* prefs); | 127 explicit PartnerBookmarksShim(PrefService* prefs); |
125 ~PartnerBookmarksShim() override; | 128 ~PartnerBookmarksShim() override; |
126 | 129 |
127 const bookmarks::BookmarkNode* GetNodeByID( | 130 const bookmarks::BookmarkNode* GetNodeByID( |
128 const bookmarks::BookmarkNode* parent, | 131 const bookmarks::BookmarkNode* parent, |
129 int64 id) const; | 132 int64_t id) const; |
130 void ReloadNodeMapping(); | 133 void ReloadNodeMapping(); |
131 void SaveNodeMapping(); | 134 void SaveNodeMapping(); |
132 | 135 |
133 scoped_ptr<bookmarks::BookmarkNode> partner_bookmarks_root_; | 136 scoped_ptr<bookmarks::BookmarkNode> partner_bookmarks_root_; |
134 PrefService* prefs_; | 137 PrefService* prefs_; |
135 NodeRenamingMap node_rename_remove_map_; | 138 NodeRenamingMap node_rename_remove_map_; |
136 | 139 |
137 // The observers. | 140 // The observers. |
138 base::ObserverList<Observer> observers_; | 141 base::ObserverList<Observer> observers_; |
139 | 142 |
140 DISALLOW_COPY_AND_ASSIGN(PartnerBookmarksShim); | 143 DISALLOW_COPY_AND_ASSIGN(PartnerBookmarksShim); |
141 }; | 144 }; |
142 | 145 |
143 #endif // CHROME_BROWSER_ANDROID_BOOKMARKS_PARTNER_BOOKMARKS_SHIM_H_ | 146 #endif // CHROME_BROWSER_ANDROID_BOOKMARKS_PARTNER_BOOKMARKS_SHIM_H_ |
OLD | NEW |