| OLD | NEW |
| 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_SUGGESTIONS_SUGGESTIONS_SERVICE_H_ | 5 #ifndef COMPONENTS_SUGGESTIONS_SUGGESTIONS_SERVICE_H_ |
| 6 #define COMPONENTS_SUGGESTIONS_SUGGESTIONS_SERVICE_H_ | 6 #define COMPONENTS_SUGGESTIONS_SUGGESTIONS_SERVICE_H_ |
| 7 | 7 |
| 8 #include <stdint.h> |
| 9 |
| 8 #include <string> | 10 #include <string> |
| 9 #include <vector> | 11 #include <vector> |
| 10 | 12 |
| 11 #include "base/basictypes.h" | |
| 12 #include "base/callback.h" | 13 #include "base/callback.h" |
| 13 #include "base/cancelable_callback.h" | 14 #include "base/cancelable_callback.h" |
| 14 #include "base/gtest_prod_util.h" | 15 #include "base/gtest_prod_util.h" |
| 16 #include "base/macros.h" |
| 15 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
| 16 #include "base/memory/weak_ptr.h" | 18 #include "base/memory/weak_ptr.h" |
| 17 #include "base/threading/thread_checker.h" | 19 #include "base/threading/thread_checker.h" |
| 18 #include "base/time/time.h" | 20 #include "base/time/time.h" |
| 19 #include "components/keyed_service/core/keyed_service.h" | 21 #include "components/keyed_service/core/keyed_service.h" |
| 20 #include "components/suggestions/image_manager.h" | 22 #include "components/suggestions/image_manager.h" |
| 21 #include "components/suggestions/proto/suggestions.pb.h" | 23 #include "components/suggestions/proto/suggestions.pb.h" |
| 22 #include "components/suggestions/suggestions_utils.h" | 24 #include "components/suggestions/suggestions_utils.h" |
| 23 #include "net/url_request/url_fetcher_delegate.h" | 25 #include "net/url_request/url_fetcher_delegate.h" |
| 24 #include "url/gurl.h" | 26 #include "url/gurl.h" |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 // Helpers to build the various suggestions URLs. These are static members | 130 // Helpers to build the various suggestions URLs. These are static members |
| 129 // rather than local functions in the .cc file to make them accessible to | 131 // rather than local functions in the .cc file to make them accessible to |
| 130 // tests. | 132 // tests. |
| 131 static GURL BuildSuggestionsURL(); | 133 static GURL BuildSuggestionsURL(); |
| 132 static std::string BuildSuggestionsBlacklistURLPrefix(); | 134 static std::string BuildSuggestionsBlacklistURLPrefix(); |
| 133 static GURL BuildSuggestionsBlacklistURL(const GURL& candidate_url); | 135 static GURL BuildSuggestionsBlacklistURL(const GURL& candidate_url); |
| 134 static GURL BuildSuggestionsBlacklistClearURL(); | 136 static GURL BuildSuggestionsBlacklistClearURL(); |
| 135 | 137 |
| 136 // Sets default timestamp for suggestions which do not have expiry timestamp. | 138 // Sets default timestamp for suggestions which do not have expiry timestamp. |
| 137 void SetDefaultExpiryTimestamp(SuggestionsProfile* suggestions, | 139 void SetDefaultExpiryTimestamp(SuggestionsProfile* suggestions, |
| 138 int64 timestamp_usec); | 140 int64_t timestamp_usec); |
| 139 | 141 |
| 140 // Issues a network request if there isn't already one happening. | 142 // Issues a network request if there isn't already one happening. |
| 141 void IssueRequestIfNoneOngoing(const GURL& url); | 143 void IssueRequestIfNoneOngoing(const GURL& url); |
| 142 | 144 |
| 143 // Issues a network request for suggestions (fetch, blacklist, or clear | 145 // Issues a network request for suggestions (fetch, blacklist, or clear |
| 144 // blacklist, depending on |url|). |access_token| is used only if OAuth2 | 146 // blacklist, depending on |url|). |access_token| is used only if OAuth2 |
| 145 // authentication is enabled. | 147 // authentication is enabled. |
| 146 void IssueSuggestionsRequest(const GURL& url, | 148 void IssueSuggestionsRequest(const GURL& url, |
| 147 const std::string& access_token); | 149 const std::string& access_token); |
| 148 | 150 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 | 222 |
| 221 // For callbacks may be run after destruction. | 223 // For callbacks may be run after destruction. |
| 222 base::WeakPtrFactory<SuggestionsService> weak_ptr_factory_; | 224 base::WeakPtrFactory<SuggestionsService> weak_ptr_factory_; |
| 223 | 225 |
| 224 DISALLOW_COPY_AND_ASSIGN(SuggestionsService); | 226 DISALLOW_COPY_AND_ASSIGN(SuggestionsService); |
| 225 }; | 227 }; |
| 226 | 228 |
| 227 } // namespace suggestions | 229 } // namespace suggestions |
| 228 | 230 |
| 229 #endif // COMPONENTS_SUGGESTIONS_SUGGESTIONS_SERVICE_H_ | 231 #endif // COMPONENTS_SUGGESTIONS_SUGGESTIONS_SERVICE_H_ |
| OLD | NEW |