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

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

Issue 666133002: Standardize usage of virtual/override/final in components/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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_CLUSTER_SERVICE_H_ 5 #ifndef COMPONENTS_ENHANCED_BOOKMARKS_BOOKMARK_SERVER_CLUSTER_SERVICE_H_
6 #define COMPONENTS_ENHANCED_BOOKMARKS_BOOKMARK_SERVER_CLUSTER_SERVICE_H_ 6 #define COMPONENTS_ENHANCED_BOOKMARKS_BOOKMARK_SERVER_CLUSTER_SERVICE_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 20 matching lines...) Expand all
31 // 'en' or 'en-US'. Note that this code should only specify the language, not 31 // 'en' or 'en-US'. Note that this code should only specify the language, not
32 // the locale, so 'en_US' (english language with US locale) and 'en-GB_US' 32 // the locale, so 'en_US' (english language with US locale) and 'en-GB_US'
33 // (British english person in the US) are not language code. 33 // (British english person in the US) are not language code.
34 BookmarkServerClusterService( 34 BookmarkServerClusterService(
35 const std::string& application_language_code, 35 const std::string& application_language_code,
36 scoped_refptr<net::URLRequestContextGetter> request_context_getter, 36 scoped_refptr<net::URLRequestContextGetter> request_context_getter,
37 ProfileOAuth2TokenService* token_service, 37 ProfileOAuth2TokenService* token_service,
38 SigninManagerBase* signin_manager, 38 SigninManagerBase* signin_manager,
39 EnhancedBookmarkModel* enhanced_bookmark_model, 39 EnhancedBookmarkModel* enhanced_bookmark_model,
40 PrefService* pref_service); 40 PrefService* pref_service);
41 virtual ~BookmarkServerClusterService(); 41 ~BookmarkServerClusterService() override;
42 42
43 // Retrieves all the bookmarks associated with a cluster. The returned 43 // Retrieves all the bookmarks associated with a cluster. The returned
44 // BookmarkNodes are owned by the bookmark model, and one must listen to the 44 // BookmarkNodes are owned by the bookmark model, and one must listen to the
45 // model observer notification to clear them. 45 // model observer notification to clear them.
46 const std::vector<const BookmarkNode*> BookmarksForClusterNamed( 46 const std::vector<const BookmarkNode*> BookmarksForClusterNamed(
47 const std::string& cluster_name) const; 47 const std::string& cluster_name) const;
48 48
49 // Returns the clusters in which the passed bookmark is in, if any. 49 // Returns the clusters in which the passed bookmark is in, if any.
50 const std::vector<std::string> ClustersForBookmark( 50 const std::vector<std::string> ClustersForBookmark(
51 const BookmarkNode* bookmark) const; 51 const BookmarkNode* bookmark) const;
52 52
53 // Dynamically generates a vector of all clusters names. 53 // Dynamically generates a vector of all clusters names.
54 const std::vector<std::string> GetClusters() const; 54 const std::vector<std::string> GetClusters() const;
55 55
56 // Registers server cluster service prefs. 56 // Registers server cluster service prefs.
57 static void RegisterPrefs(user_prefs::PrefRegistrySyncable* registry); 57 static void RegisterPrefs(user_prefs::PrefRegistrySyncable* registry);
58 58
59 protected: 59 protected:
60 // BookmarkServerService methods. 60 // BookmarkServerService methods.
61 virtual scoped_ptr<net::URLFetcher> CreateFetcher() override; 61 scoped_ptr<net::URLFetcher> CreateFetcher() override;
62 virtual bool ProcessResponse(const std::string& response, 62 bool ProcessResponse(const std::string& response,
63 bool* should_notify) override; 63 bool* should_notify) override;
64 virtual void CleanAfterFailure() override; 64 void CleanAfterFailure() override;
65 65
66 // EnhancedBookmarkModelObserver methods. 66 // EnhancedBookmarkModelObserver methods.
67 virtual void EnhancedBookmarkModelLoaded() override; 67 void EnhancedBookmarkModelLoaded() override;
68 virtual void EnhancedBookmarkAdded(const BookmarkNode* node) override; 68 void EnhancedBookmarkAdded(const BookmarkNode* node) override;
69 virtual void EnhancedBookmarkRemoved(const BookmarkNode* node) override; 69 void EnhancedBookmarkRemoved(const BookmarkNode* node) override;
70 virtual void EnhancedBookmarkAllUserNodesRemoved() override; 70 void EnhancedBookmarkAllUserNodesRemoved() override;
71 virtual void EnhancedBookmarkRemoteIdChanged( 71 void EnhancedBookmarkRemoteIdChanged(const BookmarkNode* node,
72 const BookmarkNode* node, 72 const std::string& old_remote_id,
73 const std::string& old_remote_id, 73 const std::string& remote_id) override;
74 const std::string& remote_id) override;
75 74
76 private: 75 private:
77 FRIEND_TEST_ALL_PREFIXES(BookmarkServerServiceTest, Cluster); 76 FRIEND_TEST_ALL_PREFIXES(BookmarkServerServiceTest, Cluster);
78 FRIEND_TEST_ALL_PREFIXES(BookmarkServerServiceTest, SignOut); 77 FRIEND_TEST_ALL_PREFIXES(BookmarkServerServiceTest, SignOut);
79 FRIEND_TEST_ALL_PREFIXES(BookmarkServerServiceTest, Serialization); 78 FRIEND_TEST_ALL_PREFIXES(BookmarkServerServiceTest, Serialization);
80 FRIEND_TEST_ALL_PREFIXES(BookmarkServerServiceTest, SaveToPrefs); 79 FRIEND_TEST_ALL_PREFIXES(BookmarkServerServiceTest, SaveToPrefs);
81 FRIEND_TEST_ALL_PREFIXES(BookmarkServerServiceTest, BadAuth); 80 FRIEND_TEST_ALL_PREFIXES(BookmarkServerServiceTest, BadAuth);
82 FRIEND_TEST_ALL_PREFIXES(BookmarkServerServiceTest, EmptyAuth); 81 FRIEND_TEST_ALL_PREFIXES(BookmarkServerServiceTest, EmptyAuth);
83 FRIEND_TEST_ALL_PREFIXES(BookmarkServerServiceTest, 82 FRIEND_TEST_ALL_PREFIXES(BookmarkServerServiceTest,
84 ClearClusterMapOnRemoveAllBookmarks); 83 ClearClusterMapOnRemoveAllBookmarks);
85 84
86 // Overriden from SigninManagerBase::Observer. 85 // Overriden from SigninManagerBase::Observer.
87 virtual void GoogleSignedOut(const std::string& account_id, 86 void GoogleSignedOut(const std::string& account_id,
88 const std::string& username) override; 87 const std::string& username) override;
89 88
90 // Updates |cluster_data_| with the |cluster_map| and saves the result to 89 // Updates |cluster_data_| with the |cluster_map| and saves the result to
91 // profile prefs. All changes to |cluster_data_| should go through this method 90 // profile prefs. All changes to |cluster_data_| should go through this method
92 // to ensure profile prefs is always up to date. 91 // to ensure profile prefs is always up to date.
93 // TODO(noyau): This is probably a misuse of profile prefs. While the expected 92 // TODO(noyau): This is probably a misuse of profile prefs. While the expected
94 // amount of data is small (<1kb), it can theoretically reach megabytes in 93 // amount of data is small (<1kb), it can theoretically reach megabytes in
95 // size. 94 // size.
96 void SwapModel(ClusterMap* cluster_map); 95 void SwapModel(ClusterMap* cluster_map);
97 // Updates |cluster_data_| from profile prefs. 96 // Updates |cluster_data_| from profile prefs.
98 void LoadModel(); 97 void LoadModel();
(...skipping 17 matching lines...) Expand all
116 PrefService* pref_service_; 115 PrefService* pref_service_;
117 // The cluster data, a map from cluster name to a vector of stars.id. 116 // The cluster data, a map from cluster name to a vector of stars.id.
118 ClusterMap cluster_data_; 117 ClusterMap cluster_data_;
119 118
120 DISALLOW_COPY_AND_ASSIGN(BookmarkServerClusterService); 119 DISALLOW_COPY_AND_ASSIGN(BookmarkServerClusterService);
121 }; 120 };
122 121
123 } // namespace enhanced_bookmarks 122 } // namespace enhanced_bookmarks
124 123
125 #endif // COMPONENTS_ENHANCED_BOOKMARKS_BOOKMARK_SERVER_CLUSTER_SERVICE_H_ 124 #endif // COMPONENTS_ENHANCED_BOOKMARKS_BOOKMARK_SERVER_CLUSTER_SERVICE_H_
OLDNEW
« no previous file with comments | « components/enhanced_bookmarks/bookmark_image_service.h ('k') | components/enhanced_bookmarks/bookmark_server_search_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698