OLD | NEW |
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 COMPONENTS_ENHANCED_BOOKMARKS_BOOKMARK_SERVER_SERVICE_H_ | 5 #ifndef COMPONENTS_ENHANCED_BOOKMARKS_BOOKMARK_SERVER_SERVICE_H_ |
6 #define COMPONENTS_ENHANCED_BOOKMARKS_BOOKMARK_SERVER_SERVICE_H_ | 6 #define COMPONENTS_ENHANCED_BOOKMARKS_BOOKMARK_SERVER_SERVICE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 virtual void AddObserver(BookmarkServerServiceObserver* observer); | 50 virtual void AddObserver(BookmarkServerServiceObserver* observer); |
51 void RemoveObserver(BookmarkServerServiceObserver* observer); | 51 void RemoveObserver(BookmarkServerServiceObserver* observer); |
52 | 52 |
53 protected: | 53 protected: |
54 // Retrieves a bookmark by using its remote id. Returns null if nothing | 54 // Retrieves a bookmark by using its remote id. Returns null if nothing |
55 // matches. | 55 // matches. |
56 virtual const BookmarkNode* BookmarkForRemoteId( | 56 virtual const BookmarkNode* BookmarkForRemoteId( |
57 const std::string& remote_id) const; | 57 const std::string& remote_id) const; |
58 const std::string RemoteIDForBookmark(const BookmarkNode* bookmark) const; | 58 const std::string RemoteIDForBookmark(const BookmarkNode* bookmark) const; |
59 | 59 |
| 60 // Cancels the ongoing request, if any. |
| 61 void Cancel(); |
| 62 |
60 // Notifies the observers that something changed. | 63 // Notifies the observers that something changed. |
61 void Notify(); | 64 void Notify(); |
62 | 65 |
63 // Triggers a fetch. | 66 // Triggers a fetch. |
64 void TriggerTokenRequest(bool cancel_previous); | 67 void TriggerTokenRequest(bool cancel_previous); |
65 | 68 |
66 // Build the query to send to the server. Returns a newly created url_fetcher. | 69 // Build the query to send to the server. Returns a newly created url_fetcher. |
67 virtual scoped_ptr<net::URLFetcher> CreateFetcher() = 0; | 70 virtual scoped_ptr<net::URLFetcher> CreateFetcher() = 0; |
68 | 71 |
69 // Processes the response to the query. Returns true on successful parsing, | 72 // Processes the response to the query. Returns true on successful parsing, |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 // To have access to the right context getter for the profile. | 116 // To have access to the right context getter for the profile. |
114 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; | 117 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; |
115 // The fetcher used to query the server. | 118 // The fetcher used to query the server. |
116 scoped_ptr<net::URLFetcher> url_fetcher_; | 119 scoped_ptr<net::URLFetcher> url_fetcher_; |
117 | 120 |
118 DISALLOW_COPY_AND_ASSIGN(BookmarkServerService); | 121 DISALLOW_COPY_AND_ASSIGN(BookmarkServerService); |
119 }; | 122 }; |
120 } // namespace enhanced_bookmarks | 123 } // namespace enhanced_bookmarks |
121 | 124 |
122 #endif // COMPONENTS_ENHANCED_BOOKMARKS_BOOKMARK_SERVER_SERVICE_H_ | 125 #endif // COMPONENTS_ENHANCED_BOOKMARKS_BOOKMARK_SERVER_SERVICE_H_ |
OLD | NEW |