Chromium Code Reviews| Index: chrome/browser/ui/google_now/google_now_service.h |
| diff --git a/chrome/browser/ui/google_now/google_now_service.h b/chrome/browser/ui/google_now/google_now_service.h |
| index a48f4017a81b723cd827a26804b6c280740ce0ca..ccf09dcdadeec20e2e5e6e2d57dafd996824e916 100644 |
| --- a/chrome/browser/ui/google_now/google_now_service.h |
| +++ b/chrome/browser/ui/google_now/google_now_service.h |
| @@ -7,6 +7,7 @@ |
| #include "base/timer.h" |
| #include "chrome/browser/profiles/profile_keyed_service.h" |
| +#include "net/url_request/url_fetcher_delegate.h" |
| class Profile; |
| @@ -18,10 +19,6 @@ namespace content { |
| struct Geoposition; |
| } |
| -namespace net { |
| -class URLRequest; |
| -} |
| - |
| // The Google Now service gets Google Now cards from the server and shows them |
| // as Chrome notifications. |
| // The service performs periodic updating of Google Now cards. |
| @@ -29,7 +26,8 @@ class URLRequest; |
| // 1. Obtaining the location of the machine (asynchronous); |
| // 2. Making a server request (asynchronous); |
| // 3. Showing the cards as notifications. |
| -class GoogleNowService : public ProfileKeyedService { |
| +class GoogleNowService : public ProfileKeyedService, |
| + private net::URLFetcherDelegate { |
|
sky
2012/12/13 00:38:46
style guide says no private inheritance.
vadimt
2012/12/13 00:55:10
Done.
|
| public: |
| // Must call Init after construction. |
| explicit GoogleNowService(Profile* profile); |
| @@ -54,18 +52,21 @@ class GoogleNowService : public ProfileKeyedService { |
| void OnLocationObtained(const content::Geoposition& position); |
| void OnLocationRequestTimeout(); |
| + // Builds a URL for a server request. |
| + static std::string BuildRequestURL(const content::Geoposition& position); |
| // Starts downloading cards from the server. |
|
sky
2012/12/13 00:38:46
nit: newline between 56/57.
vadimt
2012/12/13 00:55:10
Done.
|
| void StartServerRequest(const content::Geoposition& position); |
| - void OnServerRequestCompleted(net::URLRequest* request, int num_bytes); |
| // Parses server response. Returns true if the parsing was successful. |
| - static bool ParseServerResponse(const net::URLRequest* request, |
| - int num_bytes, |
| + static bool ParseServerResponse(const std::string& response_string, |
| ServerResponse* server_response); |
| // Shows Google Now cards as notifications. |
| void ShowNotifications(const ServerResponse& server_response); |
| + // URLFetcherDelegate |
| + virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; |
| + |
| // The profile. |
| Profile* const profile_; |
| // Timer to schedule next cards update. |
| @@ -75,6 +76,8 @@ class GoogleNowService : public ProfileKeyedService { |
| // Weak factory for the geolocation request callback. Used to ensure |
| // geolocation request callback is not run after this object is destroyed. |
| base::WeakPtrFactory<GoogleNowService> geolocation_request_weak_factory_; |
| + // Fetcher for Google Now cards. |
| + scoped_ptr<net::URLFetcher> fetcher_; |
| DISALLOW_COPY_AND_ASSIGN(GoogleNowService); |
| }; |