ProfileOAuth2TokenService* token_service,
SigninManagerBase* signin_manager,
EnhancedBookmarkModel* enhanced_bookmark_model);
- virtual ~BookmarkServerService();
+ ~BookmarkServerService() override;
- void AddObserver(BookmarkServerServiceObserver* observer);
+ virtual void AddObserver(BookmarkServerServiceObserver* observer);
void RemoveObserver(BookmarkServerServiceObserver* observer);
protected:
const std::string& remote_id) const;
const std::string RemoteIDForBookmark(const BookmarkNode* bookmark) const;
+ // Cancels the ongoing request, if any.
+ void Cancel();
+
// Notifies the observers that something changed.
void Notify();
void TriggerTokenRequest(bool cancel_previous);
// Build the query to send to the server. Returns a newly created url_fetcher.
- virtual net::URLFetcher* CreateFetcher() = 0;
+ virtual scoped_ptr<net::URLFetcher> CreateFetcher() = 0;
// Processes the response to the query. Returns true on successful parsing,
// false on failure. The implementation can assume that |should_notify| is set
virtual void CleanAfterFailure() = 0;
// EnhancedBookmarkModelObserver:
- virtual void EnhancedBookmarkModelShuttingDown() OVERRIDE;
+ void EnhancedBookmarkModelShuttingDown() override;
SigninManagerBase* GetSigninManager();
// Cached pointer to the bookmarks model.
EnhancedBookmarkModel* model_; // weak
+ protected:
+ // The observers.
+ ObserverList<BookmarkServerServiceObserver> observers_;
+
private:
FRIEND_TEST_ALL_PREFIXES(BookmarkServerServiceTest, Cluster);
+ FRIEND_TEST_ALL_PREFIXES(BookmarkServerServiceTest, SignOut);
FRIEND_TEST_ALL_PREFIXES(BookmarkServerServiceTest,
ClearClusterMapOnRemoveAllBookmarks);
// net::URLFetcherDelegate methods. Called when the query is finished.
- virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE;
+ void OnURLFetchComplete(const net::URLFetcher* source) override;
// OAuth2TokenService::Consumer methods.
- virtual void OnGetTokenSuccess(const OAuth2TokenService::Request* request,
- const std::string& access_token,
- const base::Time& expiration_time) OVERRIDE;
- virtual void OnGetTokenFailure(const OAuth2TokenService::Request* request,
- const GoogleServiceAuthError& error) OVERRIDE;
+ void OnGetTokenSuccess(const OAuth2TokenService::Request* request,
+ const std::string& access_token,
+ const base::Time& expiration_time) override;
+ void OnGetTokenFailure(const OAuth2TokenService::Request* request,
+ const GoogleServiceAuthError& error) override;
- // The observers.
- ObserverList<BookmarkServerServiceObserver> observers_;
// The Auth service is used to get a token for auth with the server.
ProfileOAuth2TokenService* token_service_; // Weak
// The request to the token service.
scoped_refptr<net::URLRequestContextGetter> request_context_getter_;
// The fetcher used to query the server.
scoped_ptr<net::URLFetcher> url_fetcher_;
- // A map from stars.id to bookmark nodes. With no null entries.
- std::map<std::string, const BookmarkNode*> starsid_to_bookmark_;
DISALLOW_COPY_AND_ASSIGN(BookmarkServerService);
};