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

Side by Side Diff: components/signin/core/browser/device_activity_fetcher.h

Issue 1087933002: Cross Device Promo - Main Eligibility Flow (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more alexei comments (histogram summaries, small refactorings) Created 5 years, 7 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
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef COMPONENTS_SIGNIN_CORE_BROWSER_DEVICE_ACTVITIY_FETCHER_H_
6 #define COMPONENTS_SIGNIN_CORE_BROWSER_DEVICE_ACTVITIY_FETCHER_H_
7
8 #include <vector>
9
10 #include "base/time/time.h"
11 #include "base/timer/timer.h"
12 #include "google_apis/gaia/gaia_auth_consumer.h"
13 #include "net/base/backoff_entry.h"
14 #include "net/url_request/url_fetcher_delegate.h"
15
16 class GaiaAuthFetcher;
17 class SigninClient;
18
19 namespace net {
20 class URLFetcher;
21 }
22
23 class DeviceActivityFetcher : public GaiaAuthConsumer,
24 public net::URLFetcherDelegate {
25 public:
26 struct DeviceActivity {
27 base::Time last_active;
28 std::string name;
Alexei Svitkine (slow) 2015/05/19 19:59:44 Add #include <string>
Mike Lerman 2015/05/19 20:54:04 Done.
29 };
30
31 class Observer {
32 public:
33 virtual void OnFetchDeviceActivitySuccess(
34 const std::vector<DeviceActivityFetcher::DeviceActivity>& devices) = 0;
35 virtual void OnFetchDeviceActivityFailure() {}
36 };
37
38 DeviceActivityFetcher(SigninClient* signin_client,
39 DeviceActivityFetcher::Observer* observer);
40 ~DeviceActivityFetcher() override;
41
42 void Start();
43 void Stop();
44
45 // Overridden from GaiaAuthConsumer
Alexei Svitkine (slow) 2015/05/19 19:59:44 Nit: Use the other comment format I mentioned.
Mike Lerman 2015/05/19 20:54:04 Done.
46 void OnListIdpSessionsSuccess(const std::string& login_hint) override;
47 void OnListIdpSessionsError(const GoogleServiceAuthError& error) override;
48 void OnGetTokenResponseSuccess(const ClientOAuthResult& result) override;
49 void OnGetTokenResponseError(const GoogleServiceAuthError& error) override;
50
51 // Overridden from URLFetcherDelegate
Alexei Svitkine (slow) 2015/05/19 19:59:44 Ditto.
Mike Lerman 2015/05/19 20:54:04 Done.
52 void OnURLFetchComplete(const net::URLFetcher* source) override;
53
54 private:
55 void StartFetchingListIdpSessions();
56 void StartFetchingGetTokenResponse();
57 void StartFetchingListDevices();
58
59 // Gaia fetcher used for acquiring an access token.
60 scoped_ptr<GaiaAuthFetcher> gaia_auth_fetcher_;
Alexei Svitkine (slow) 2015/05/19 19:59:44 include scoped_ptr header
Mike Lerman 2015/05/19 20:54:04 Done.
61 // URL Fetcher used for calling List Devices.
62 scoped_ptr<net::URLFetcher> url_fetcher_;
63
64 // If either fetcher fails, retry with exponential backoff.
65 net::BackoffEntry fetcher_backoff_;
66 base::OneShotTimer<DeviceActivityFetcher> fetcher_timer_;
67 int fetcher_retries_;
68
69 std::string access_token_;
70 std::string login_hint_;
71
72 SigninClient* signin_client_; // Weak pointer.
73 Observer* observer_;
74
75 DISALLOW_COPY_AND_ASSIGN(DeviceActivityFetcher);
76 };
77
78 #endif // COMPONENTS_SIGNIN_CORE_BROWSER_DEVICE_ACTVITIY_FETCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698