| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_UI_WEBUI_NTP_ANDROID_BOOKMARKS_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_NTP_ANDROID_BOOKMARKS_HANDLER_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_NTP_ANDROID_BOOKMARKS_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_NTP_ANDROID_BOOKMARKS_HANDLER_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/task/cancelable_task_tracker.h" |
| 9 #include "base/values.h" | 10 #include "base/values.h" |
| 10 #include "chrome/browser/android/bookmarks/managed_bookmarks_shim.h" | 11 #include "chrome/browser/android/bookmarks/managed_bookmarks_shim.h" |
| 11 #include "chrome/browser/android/bookmarks/partner_bookmarks_shim.h" | 12 #include "chrome/browser/android/bookmarks/partner_bookmarks_shim.h" |
| 12 #include "chrome/browser/bookmarks/base_bookmark_model_observer.h" | 13 #include "chrome/browser/bookmarks/base_bookmark_model_observer.h" |
| 13 #include "chrome/browser/favicon/favicon_service.h" | 14 #include "chrome/browser/favicon/favicon_service.h" |
| 14 #include "chrome/common/cancelable_task_tracker.h" | |
| 15 #include "content/public/browser/web_ui_message_handler.h" | 15 #include "content/public/browser/web_ui_message_handler.h" |
| 16 | 16 |
| 17 // The handler for Javascript messages related to the bookmarks. | 17 // The handler for Javascript messages related to the bookmarks. |
| 18 // | 18 // |
| 19 // In Javascript if getBookmarks() is called without any parameter, the 'Other | 19 // In Javascript if getBookmarks() is called without any parameter, the 'Other |
| 20 // Bookmark' folder and bookmark bar's bookmarks and folders are returned. | 20 // Bookmark' folder and bookmark bar's bookmarks and folders are returned. |
| 21 // If getBookmarks() is called with a valid bookmark folder id, the given | 21 // If getBookmarks() is called with a valid bookmark folder id, the given |
| 22 // folder's bookmarks and sub folders of it are returned. | 22 // folder's bookmarks and sub folders of it are returned. |
| 23 // | 23 // |
| 24 // All bookmarks and subfolder is returned by bookmarks() javascript callback | 24 // All bookmarks and subfolder is returned by bookmarks() javascript callback |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 // Contains the bookmarks managed via enterprise policy. | 102 // Contains the bookmarks managed via enterprise policy. |
| 103 scoped_ptr<ManagedBookmarksShim> managed_bookmarks_shim_; | 103 scoped_ptr<ManagedBookmarksShim> managed_bookmarks_shim_; |
| 104 | 104 |
| 105 // Whether the bookmark data has been requested by the UI yet. | 105 // Whether the bookmark data has been requested by the UI yet. |
| 106 bool bookmark_data_requested_; | 106 bool bookmark_data_requested_; |
| 107 | 107 |
| 108 // Indicates that extensive changes to the BookmarkModel is on-going. | 108 // Indicates that extensive changes to the BookmarkModel is on-going. |
| 109 bool extensive_changes_; | 109 bool extensive_changes_; |
| 110 | 110 |
| 111 // Used for loading bookmark node. | 111 // Used for loading bookmark node. |
| 112 CancelableTaskTracker cancelable_task_tracker_; | 112 base::CancelableTaskTracker cancelable_task_tracker_; |
| 113 | 113 |
| 114 // Returns true iff bookmark model and partner bookmarks shim are loaded. | 114 // Returns true iff bookmark model and partner bookmarks shim are loaded. |
| 115 bool AreModelsLoaded() const; | 115 bool AreModelsLoaded() const; |
| 116 | 116 |
| 117 // Notify the UI that a change occurred to the bookmark model. | 117 // Notify the UI that a change occurred to the bookmark model. |
| 118 void NotifyModelChanged(const base::DictionaryValue& status); | 118 void NotifyModelChanged(const base::DictionaryValue& status); |
| 119 | 119 |
| 120 // Generates the string encoded ID to be used by the NTP. | 120 // Generates the string encoded ID to be used by the NTP. |
| 121 std::string GetBookmarkIdForNtp(const BookmarkNode* node); | 121 std::string GetBookmarkIdForNtp(const BookmarkNode* node); |
| 122 | 122 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 bool IsEditable(const BookmarkNode* node) const; | 167 bool IsEditable(const BookmarkNode* node) const; |
| 168 | 168 |
| 169 // Returns true if |node| is the real root node (not the root node of the | 169 // Returns true if |node| is the real root node (not the root node of the |
| 170 // partner bookmarks shim nor the managed bookmark shim root). | 170 // partner bookmarks shim nor the managed bookmark shim root). |
| 171 bool IsRoot(const BookmarkNode* node) const; | 171 bool IsRoot(const BookmarkNode* node) const; |
| 172 | 172 |
| 173 DISALLOW_COPY_AND_ASSIGN(BookmarksHandler); | 173 DISALLOW_COPY_AND_ASSIGN(BookmarksHandler); |
| 174 }; | 174 }; |
| 175 | 175 |
| 176 #endif // CHROME_BROWSER_UI_WEBUI_NTP_ANDROID_BOOKMARKS_HANDLER_H_ | 176 #endif // CHROME_BROWSER_UI_WEBUI_NTP_ANDROID_BOOKMARKS_HANDLER_H_ |
| OLD | NEW |