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 |
11 #include "components/enhanced_bookmarks/enhanced_bookmark_model_observer.h" | 11 #include "components/enhanced_bookmarks/enhanced_bookmark_model_observer.h" |
12 #include "google_apis/gaia/google_service_auth_error.h" | 12 #include "google_apis/gaia/google_service_auth_error.h" |
13 #include "google_apis/gaia/oauth2_token_service.h" | 13 #include "google_apis/gaia/oauth2_token_service.h" |
14 #include "net/url_request/url_fetcher.h" | 14 #include "net/url_request/url_fetcher.h" |
15 #include "net/url_request/url_fetcher_delegate.h" | 15 #include "net/url_request/url_fetcher_delegate.h" |
16 #include "net/url_request/url_request_context_getter.h" | 16 #include "net/url_request/url_request_context_getter.h" |
17 | 17 |
18 class ProfileOAuth2TokenService; | 18 class ProfileOAuth2TokenService; |
19 class SigninManagerBase; | 19 class SigninManagerBase; |
| 20 |
| 21 namespace bookmarks { |
20 class BookmarkNode; | 22 class BookmarkNode; |
| 23 } |
21 | 24 |
22 namespace enhanced_bookmarks { | 25 namespace enhanced_bookmarks { |
23 | 26 |
24 class BookmarkServerService; | 27 class BookmarkServerService; |
25 class EnhancedBookmarkModel; | 28 class EnhancedBookmarkModel; |
26 | 29 |
27 class BookmarkServerServiceObserver { | 30 class BookmarkServerServiceObserver { |
28 public: | 31 public: |
29 virtual void OnChange(BookmarkServerService* service) = 0; | 32 virtual void OnChange(BookmarkServerService* service) = 0; |
30 | 33 |
(...skipping 15 matching lines...) Expand all Loading... |
46 SigninManagerBase* signin_manager, | 49 SigninManagerBase* signin_manager, |
47 EnhancedBookmarkModel* enhanced_bookmark_model); | 50 EnhancedBookmarkModel* enhanced_bookmark_model); |
48 ~BookmarkServerService() override; | 51 ~BookmarkServerService() override; |
49 | 52 |
50 virtual void AddObserver(BookmarkServerServiceObserver* observer); | 53 virtual void AddObserver(BookmarkServerServiceObserver* observer); |
51 void RemoveObserver(BookmarkServerServiceObserver* observer); | 54 void RemoveObserver(BookmarkServerServiceObserver* observer); |
52 | 55 |
53 protected: | 56 protected: |
54 // Retrieves a bookmark by using its remote id. Returns null if nothing | 57 // Retrieves a bookmark by using its remote id. Returns null if nothing |
55 // matches. | 58 // matches. |
56 virtual const BookmarkNode* BookmarkForRemoteId( | 59 virtual const bookmarks::BookmarkNode* BookmarkForRemoteId( |
57 const std::string& remote_id) const; | 60 const std::string& remote_id) const; |
58 const std::string RemoteIDForBookmark(const BookmarkNode* bookmark) const; | 61 const std::string RemoteIDForBookmark( |
| 62 const bookmarks::BookmarkNode* bookmark) const; |
59 | 63 |
60 // Cancels the ongoing request, if any. | 64 // Cancels the ongoing request, if any. |
61 void Cancel(); | 65 void Cancel(); |
62 | 66 |
63 // Notifies the observers that something changed. | 67 // Notifies the observers that something changed. |
64 void Notify(); | 68 void Notify(); |
65 | 69 |
66 // Triggers a fetch. | 70 // Triggers a fetch. |
67 void TriggerTokenRequest(bool cancel_previous); | 71 void TriggerTokenRequest(bool cancel_previous); |
68 | 72 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 // To have access to the right context getter for the profile. | 120 // To have access to the right context getter for the profile. |
117 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; | 121 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; |
118 // The fetcher used to query the server. | 122 // The fetcher used to query the server. |
119 scoped_ptr<net::URLFetcher> url_fetcher_; | 123 scoped_ptr<net::URLFetcher> url_fetcher_; |
120 | 124 |
121 DISALLOW_COPY_AND_ASSIGN(BookmarkServerService); | 125 DISALLOW_COPY_AND_ASSIGN(BookmarkServerService); |
122 }; | 126 }; |
123 } // namespace enhanced_bookmarks | 127 } // namespace enhanced_bookmarks |
124 | 128 |
125 #endif // COMPONENTS_ENHANCED_BOOKMARKS_BOOKMARK_SERVER_SERVICE_H_ | 129 #endif // COMPONENTS_ENHANCED_BOOKMARKS_BOOKMARK_SERVER_SERVICE_H_ |
| 130 |
OLD | NEW |