X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fcomponents%2Fenhanced_bookmarks%2Fbookmark_server_service.h;h=9f2fd52e91e9ea7e4a33558b92df43fb7c5ab2c2;hb=1afa4dd80ef85af7c90efaea6959db1d92330844;hp=041b5c685ff79ec886625a375a877528463d346b;hpb=90762837333c13ccf56f2ad88e4481fc71e8d281;p=platform%2Fframework%2Fweb%2Fcrosswalk.git diff --git a/src/components/enhanced_bookmarks/bookmark_server_service.h b/src/components/enhanced_bookmarks/bookmark_server_service.h index 041b5c6..9f2fd52 100644 --- a/src/components/enhanced_bookmarks/bookmark_server_service.h +++ b/src/components/enhanced_bookmarks/bookmark_server_service.h @@ -45,9 +45,9 @@ class BookmarkServerService : protected net::URLFetcherDelegate, 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: @@ -57,6 +57,9 @@ class BookmarkServerService : protected net::URLFetcherDelegate, 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(); @@ -64,7 +67,7 @@ class BookmarkServerService : protected net::URLFetcherDelegate, 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 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 @@ -77,30 +80,33 @@ class BookmarkServerService : protected net::URLFetcherDelegate, 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 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 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. @@ -111,8 +117,6 @@ class BookmarkServerService : protected net::URLFetcherDelegate, scoped_refptr request_context_getter_; // The fetcher used to query the server. scoped_ptr url_fetcher_; - // A map from stars.id to bookmark nodes. With no null entries. - std::map starsid_to_bookmark_; DISALLOW_COPY_AND_ASSIGN(BookmarkServerService); };