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

Side by Side Diff: chrome/browser/chromeos/arc/arc_opt_in_manager_impl.h

Issue 1618193003: arc: Pass auth token from Chrome to ARC instance. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: minor formating Created 4 years, 11 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 2016 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 CHROME_BROWSER_CHROMEOS_ARC_ARC_OPT_IN_MANAGER_IMPL_H_
6 #define CHROME_BROWSER_CHROMEOS_ARC_ARC_OPT_IN_MANAGER_IMPL_H_
7
8 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/observer_list.h"
11 #include "base/threading/thread_checker.h"
12 #include "components/arc/opt_in/arc_opt_in_manager.h"
13 #include "net/url_request/url_fetcher_delegate.h"
14
15 class GURL;
16 class Profile;
17
18 namespace net {
19 class URLFetcher;
20 } // namespace net
21
22 namespace arc {
23
24 class ArcOptInManagerImpl : public ArcOptInManager,
lhc(google) 2016/01/22 22:18:33 You should be able to s/ArcOptInManager/ArcService
khmel 2016/01/23 00:41:43 I moved code to ArcAuthService. It seems the right
25 public net::URLFetcherDelegate {
26 public:
27 ArcOptInManagerImpl();
28 ~ArcOptInManagerImpl() override;
29
30 // ArcOptInManager overrides.
31 void SetProfile(Profile* profile) override;
32 State state() const override;
33 void SetAuthTokenAndStartArc(const std::string auth_token) override;
34 std::string GetAuthToken() override;
35 void AddObserver(Observer* observer) override;
36 void RemoveObserver(Observer* observer) override;
37
38 // net::URLFetcherDelegate overrides.
39 void OnURLFetchComplete(const net::URLFetcher* source) override;
40
41 // Helper function to compose target URL, also is used in test.
42 static GURL CreateURL(Profile* profile);
43
44 private:
45 void FetchToken();
46 // Finds auth token in cookies.
47 static bool ParseAuthToken(const net::URLFetcher* source, std::string* token);
48
49 // Unowned pointer;
50 Profile* profile_ = nullptr;
lhc(google) 2016/01/22 22:18:33 If you end up taking the Profile* in the construct
khmel 2016/01/23 00:41:43 Actually profile_ can be and should be changed. Ar
51
52 base::ThreadChecker thread_checker_;
53
54 State state_ = State::DISABLE;
55 base::ObserverList<Observer> observer_list_;
56 scoped_ptr<net::URLFetcher> auth_fetcher_;
57 std::string auth_token_;
58
59 DISALLOW_COPY_AND_ASSIGN(ArcOptInManagerImpl);
60 };
61
62 } // namespace arc
63
64 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_OPT_IN_MANAGER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698