Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(46)

Side by Side Diff: components/enhanced_bookmarks/bookmark_server_service.h

Issue 641473002: Revert of Bring up of the enhanced bookmarks cluster service. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@intermediary2
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 // Notifies the observers that something changed. 60 // Notifies the observers that something changed.
61 void Notify(); 61 void Notify();
62 62
63 // Triggers a fetch. 63 // Triggers a fetch.
64 void TriggerTokenRequest(bool cancel_previous); 64 void TriggerTokenRequest(bool cancel_previous);
65 65
66 // Build the query to send to the server. Returns a newly created url_fetcher. 66 // Build the query to send to the server. Returns a newly created url_fetcher.
67 virtual scoped_ptr<net::URLFetcher> CreateFetcher() = 0; 67 virtual net::URLFetcher* CreateFetcher() = 0;
68 68
69 // Processes the response to the query. Returns true on successful parsing, 69 // Processes the response to the query. Returns true on successful parsing,
70 // false on failure. The implementation can assume that |should_notify| is set 70 // false on failure. The implementation can assume that |should_notify| is set
71 // to true by default, if changed to false there will be no OnChange 71 // to true by default, if changed to false there will be no OnChange
72 // notification send. 72 // notification send.
73 virtual bool ProcessResponse(const std::string& response, 73 virtual bool ProcessResponse(const std::string& response,
74 bool* should_notify) = 0; 74 bool* should_notify) = 0;
75 75
76 // If the token can't be retrieved or the query fails this method is called. 76 // If the token can't be retrieved or the query fails this method is called.
77 virtual void CleanAfterFailure() = 0; 77 virtual void CleanAfterFailure() = 0;
78 78
79 // EnhancedBookmarkModelObserver: 79 // EnhancedBookmarkModelObserver:
80 virtual void EnhancedBookmarkModelShuttingDown() override; 80 virtual void EnhancedBookmarkModelShuttingDown() override;
81 81
82 SigninManagerBase* GetSigninManager(); 82 SigninManagerBase* GetSigninManager();
83 83
84 // Cached pointer to the bookmarks model. 84 // Cached pointer to the bookmarks model.
85 EnhancedBookmarkModel* model_; // weak 85 EnhancedBookmarkModel* model_; // weak
86 86
87 private: 87 private:
88 FRIEND_TEST_ALL_PREFIXES(BookmarkServerServiceTest, Cluster); 88 FRIEND_TEST_ALL_PREFIXES(BookmarkServerServiceTest, Cluster);
89 FRIEND_TEST_ALL_PREFIXES(BookmarkServerServiceTest, SignOut);
90 FRIEND_TEST_ALL_PREFIXES(BookmarkServerServiceTest, 89 FRIEND_TEST_ALL_PREFIXES(BookmarkServerServiceTest,
91 ClearClusterMapOnRemoveAllBookmarks); 90 ClearClusterMapOnRemoveAllBookmarks);
92 91
93 // net::URLFetcherDelegate methods. Called when the query is finished. 92 // net::URLFetcherDelegate methods. Called when the query is finished.
94 virtual void OnURLFetchComplete(const net::URLFetcher* source) override; 93 virtual void OnURLFetchComplete(const net::URLFetcher* source) override;
95 94
96 // OAuth2TokenService::Consumer methods. 95 // OAuth2TokenService::Consumer methods.
97 virtual void OnGetTokenSuccess(const OAuth2TokenService::Request* request, 96 virtual void OnGetTokenSuccess(const OAuth2TokenService::Request* request,
98 const std::string& access_token, 97 const std::string& access_token,
99 const base::Time& expiration_time) override; 98 const base::Time& expiration_time) override;
100 virtual void OnGetTokenFailure(const OAuth2TokenService::Request* request, 99 virtual void OnGetTokenFailure(const OAuth2TokenService::Request* request,
101 const GoogleServiceAuthError& error) override; 100 const GoogleServiceAuthError& error) override;
102 101
103 // The observers. 102 // The observers.
104 ObserverList<BookmarkServerServiceObserver> observers_; 103 ObserverList<BookmarkServerServiceObserver> observers_;
105 // The Auth service is used to get a token for auth with the server. 104 // The Auth service is used to get a token for auth with the server.
106 ProfileOAuth2TokenService* token_service_; // Weak 105 ProfileOAuth2TokenService* token_service_; // Weak
107 // The request to the token service. 106 // The request to the token service.
108 scoped_ptr<OAuth2TokenService::Request> token_request_; 107 scoped_ptr<OAuth2TokenService::Request> token_request_;
109 // To get the currently signed in user. 108 // To get the currently signed in user.
110 SigninManagerBase* signin_manager_; // Weak 109 SigninManagerBase* signin_manager_; // Weak
111 // To have access to the right context getter for the profile. 110 // To have access to the right context getter for the profile.
112 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; 111 scoped_refptr<net::URLRequestContextGetter> request_context_getter_;
113 // The fetcher used to query the server. 112 // The fetcher used to query the server.
114 scoped_ptr<net::URLFetcher> url_fetcher_; 113 scoped_ptr<net::URLFetcher> url_fetcher_;
114 // A map from stars.id to bookmark nodes. With no null entries.
115 std::map<std::string, const BookmarkNode*> starsid_to_bookmark_;
115 116
116 DISALLOW_COPY_AND_ASSIGN(BookmarkServerService); 117 DISALLOW_COPY_AND_ASSIGN(BookmarkServerService);
117 }; 118 };
118 } // namespace enhanced_bookmarks 119 } // namespace enhanced_bookmarks
119 120
120 #endif // COMPONENTS_ENHANCED_BOOKMARKS_BOOKMARK_SERVER_SERVICE_H_ 121 #endif // COMPONENTS_ENHANCED_BOOKMARKS_BOOKMARK_SERVER_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698