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

Side by Side Diff: chrome/browser/ui/google_now/google_now_service.h

Issue 11434116: Geolocation request for Google Now (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cosmetics. Created 8 years 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 CHROME_BROWSER_UI_GOOGLE_NOW_GOOGLE_NOW_SERVICE_H_ 5 #ifndef CHROME_BROWSER_UI_GOOGLE_NOW_GOOGLE_NOW_SERVICE_H_
6 #define CHROME_BROWSER_UI_GOOGLE_NOW_GOOGLE_NOW_SERVICE_H_ 6 #define CHROME_BROWSER_UI_GOOGLE_NOW_GOOGLE_NOW_SERVICE_H_
7 7
8 #include "base/timer.h" 8 #include "base/timer.h"
9 #include "chrome/browser/profiles/profile_keyed_service.h" 9 #include "chrome/browser/profiles/profile_keyed_service.h"
10 10
(...skipping 30 matching lines...) Expand all
41 // Gets new cards from the server and shows them as notifications. 41 // Gets new cards from the server and shows them as notifications.
42 void UpdateCards(); 42 void UpdateCards();
43 43
44 // Schedules next cards update after the specified delay. 44 // Schedules next cards update after the specified delay.
45 void StartWaitingForNextUpdate(int64 delay_ms); 45 void StartWaitingForNextUpdate(int64 delay_ms);
46 void OnWaitingForNextUpdateEnds(); 46 void OnWaitingForNextUpdateEnds();
47 47
48 // Starts obtaining location of the machine. 48 // Starts obtaining location of the machine.
49 void StartObtainingGeolocation(); 49 void StartObtainingGeolocation();
50 void OnLocationObtained(const content::Geoposition& position); 50 void OnLocationObtained(const content::Geoposition& position);
51 void OnLocationRequestTimeout();
51 52
52 // Starts downloading cards from the server. 53 // Starts downloading cards from the server. If the position's Validate() call
54 // returns false, this means that the position is not available.
53 void StartServerRequest(const content::Geoposition& position); 55 void StartServerRequest(const content::Geoposition& position);
54 void OnServerRequestCompleted(net::URLRequest* request, int num_bytes); 56 void OnServerRequestCompleted(net::URLRequest* request, int num_bytes);
55 57
56 // Parses server response. Returns true if the parsing was successful. 58 // Parses server response. Returns true if the parsing was successful.
57 static bool ParseServerResponse(const net::URLRequest* request, int num_bytes, 59 static bool ParseServerResponse(const net::URLRequest* request, int num_bytes,
58 ServerResponse* server_response); 60 ServerResponse* server_response);
59 61
60 // Shows Google Now cards as notifications. 62 // Shows Google Now cards as notifications.
61 void ShowNotifications(const ServerResponse& server_response); 63 void ShowNotifications(const ServerResponse& server_response);
62 64
63 // The profile. 65 // The profile.
64 Profile* const profile_; 66 Profile* const profile_;
65 // Timer to schedule next cards update. 67 // Timer to schedule next cards update.
66 base::OneShotTimer<GoogleNowService> next_update_timer_; 68 base::OneShotTimer<GoogleNowService> next_update_timer_;
69 // Timer to cancel geolocation requests that take too long.
70 base::OneShotTimer<GoogleNowService> geolocation_request_timer_;
71 // Weak factory for the geolocation request callback.
72 base::WeakPtrFactory<GoogleNowService> geolocation_request_weak_factory_;
67 73
68 DISALLOW_COPY_AND_ASSIGN(GoogleNowService); 74 DISALLOW_COPY_AND_ASSIGN(GoogleNowService);
69 }; 75 };
70 76
71 #endif // CHROME_BROWSER_UI_GOOGLE_NOW_GOOGLE_NOW_SERVICE_H_ 77 #endif // CHROME_BROWSER_UI_GOOGLE_NOW_GOOGLE_NOW_SERVICE_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/google_now/google_now_service.cc » ('j') | chrome/browser/ui/google_now/google_now_service.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698