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

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

Issue 665133004: Skip enhanced bookmarks cluster requests if it's not being used. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed patch set 1 comments 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 29 matching lines...) Expand all
40 private OAuth2TokenService::Consumer, 40 private OAuth2TokenService::Consumer,
41 public EnhancedBookmarkModelObserver { 41 public EnhancedBookmarkModelObserver {
42 public: 42 public:
43 BookmarkServerService( 43 BookmarkServerService(
44 scoped_refptr<net::URLRequestContextGetter> request_context_getter, 44 scoped_refptr<net::URLRequestContextGetter> request_context_getter,
45 ProfileOAuth2TokenService* token_service, 45 ProfileOAuth2TokenService* token_service,
46 SigninManagerBase* signin_manager, 46 SigninManagerBase* signin_manager,
47 EnhancedBookmarkModel* enhanced_bookmark_model); 47 EnhancedBookmarkModel* enhanced_bookmark_model);
48 virtual ~BookmarkServerService(); 48 virtual ~BookmarkServerService();
49 49
50 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 // Notifies the observers that something changed. 60 // Notifies the observers that something changed.
(...skipping 16 matching lines...) Expand all
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 protected:
88 // The observers.
89 ObserverList<BookmarkServerServiceObserver> observers_;
90
87 private: 91 private:
88 FRIEND_TEST_ALL_PREFIXES(BookmarkServerServiceTest, Cluster); 92 FRIEND_TEST_ALL_PREFIXES(BookmarkServerServiceTest, Cluster);
89 FRIEND_TEST_ALL_PREFIXES(BookmarkServerServiceTest, SignOut); 93 FRIEND_TEST_ALL_PREFIXES(BookmarkServerServiceTest, SignOut);
90 FRIEND_TEST_ALL_PREFIXES(BookmarkServerServiceTest, 94 FRIEND_TEST_ALL_PREFIXES(BookmarkServerServiceTest,
91 ClearClusterMapOnRemoveAllBookmarks); 95 ClearClusterMapOnRemoveAllBookmarks);
92 96
93 // net::URLFetcherDelegate methods. Called when the query is finished. 97 // net::URLFetcherDelegate methods. Called when the query is finished.
94 virtual void OnURLFetchComplete(const net::URLFetcher* source) override; 98 virtual void OnURLFetchComplete(const net::URLFetcher* source) override;
95 99
96 // OAuth2TokenService::Consumer methods. 100 // OAuth2TokenService::Consumer methods.
97 virtual void OnGetTokenSuccess(const OAuth2TokenService::Request* request, 101 virtual void OnGetTokenSuccess(const OAuth2TokenService::Request* request,
98 const std::string& access_token, 102 const std::string& access_token,
99 const base::Time& expiration_time) override; 103 const base::Time& expiration_time) override;
100 virtual void OnGetTokenFailure(const OAuth2TokenService::Request* request, 104 virtual void OnGetTokenFailure(const OAuth2TokenService::Request* request,
101 const GoogleServiceAuthError& error) override; 105 const GoogleServiceAuthError& error) override;
102 106
103 // The observers.
104 ObserverList<BookmarkServerServiceObserver> observers_;
105 // The Auth service is used to get a token for auth with the server. 107 // The Auth service is used to get a token for auth with the server.
106 ProfileOAuth2TokenService* token_service_; // Weak 108 ProfileOAuth2TokenService* token_service_; // Weak
107 // The request to the token service. 109 // The request to the token service.
108 scoped_ptr<OAuth2TokenService::Request> token_request_; 110 scoped_ptr<OAuth2TokenService::Request> token_request_;
109 // To get the currently signed in user. 111 // To get the currently signed in user.
110 SigninManagerBase* signin_manager_; // Weak 112 SigninManagerBase* signin_manager_; // Weak
111 // To have access to the right context getter for the profile. 113 // To have access to the right context getter for the profile.
112 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; 114 scoped_refptr<net::URLRequestContextGetter> request_context_getter_;
113 // The fetcher used to query the server. 115 // The fetcher used to query the server.
114 scoped_ptr<net::URLFetcher> url_fetcher_; 116 scoped_ptr<net::URLFetcher> url_fetcher_;
115 117
116 DISALLOW_COPY_AND_ASSIGN(BookmarkServerService); 118 DISALLOW_COPY_AND_ASSIGN(BookmarkServerService);
117 }; 119 };
118 } // namespace enhanced_bookmarks 120 } // namespace enhanced_bookmarks
119 121
120 #endif // COMPONENTS_ENHANCED_BOOKMARKS_BOOKMARK_SERVER_SERVICE_H_ 122 #endif // COMPONENTS_ENHANCED_BOOKMARKS_BOOKMARK_SERVER_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698