| Index: chrome/browser/chromeos/arc/arc_opt_in_manager_impl.h
|
| diff --git a/chrome/browser/chromeos/arc/arc_opt_in_manager_impl.h b/chrome/browser/chromeos/arc/arc_opt_in_manager_impl.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..c84a473a6eecfe5e4a7f25b9b54d7b28a2d69c4f
|
| --- /dev/null
|
| +++ b/chrome/browser/chromeos/arc/arc_opt_in_manager_impl.h
|
| @@ -0,0 +1,64 @@
|
| +// Copyright 2016 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef CHROME_BROWSER_CHROMEOS_ARC_ARC_OPT_IN_MANAGER_IMPL_H_
|
| +#define CHROME_BROWSER_CHROMEOS_ARC_ARC_OPT_IN_MANAGER_IMPL_H_
|
| +
|
| +#include "base/macros.h"
|
| +#include "base/memory/scoped_ptr.h"
|
| +#include "base/observer_list.h"
|
| +#include "base/threading/thread_checker.h"
|
| +#include "components/arc/opt_in/arc_opt_in_manager.h"
|
| +#include "net/url_request/url_fetcher_delegate.h"
|
| +
|
| +class GURL;
|
| +class Profile;
|
| +
|
| +namespace net {
|
| +class URLFetcher;
|
| +} // namespace net
|
| +
|
| +namespace arc {
|
| +
|
| +class ArcOptInManagerImpl : public ArcOptInManager,
|
| + public net::URLFetcherDelegate {
|
| + public:
|
| + ArcOptInManagerImpl();
|
| + ~ArcOptInManagerImpl() override;
|
| +
|
| + // ArcOptInManager overrides.
|
| + void SetProfile(Profile* profile) override;
|
| + State state() const override;
|
| + void SetAuthTokenAndStartArc(const std::string auth_token) override;
|
| + std::string GetAuthToken() override;
|
| + void AddObserver(Observer* observer) override;
|
| + void RemoveObserver(Observer* observer) override;
|
| +
|
| + // net::URLFetcherDelegate overrides.
|
| + void OnURLFetchComplete(const net::URLFetcher* source) override;
|
| +
|
| + // Helper function to compose target URL, also is used in test.
|
| + static GURL CreateURL(Profile* profile);
|
| +
|
| + private:
|
| + void FetchToken();
|
| + // Finds auth token in cookies.
|
| + static bool ParseAuthToken(const net::URLFetcher* source, std::string* token);
|
| +
|
| + // Unowned pointer;
|
| + Profile* profile_ = nullptr;
|
| +
|
| + base::ThreadChecker thread_checker_;
|
| +
|
| + State state_ = State::DISABLE;
|
| + base::ObserverList<Observer> observer_list_;
|
| + scoped_ptr<net::URLFetcher> auth_fetcher_;
|
| + std::string auth_token_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(ArcOptInManagerImpl);
|
| +};
|
| +
|
| +} // namespace arc
|
| +
|
| +#endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_OPT_IN_MANAGER_IMPL_H_
|
|
|