| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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 #include "chrome/browser/chromeos/login/signin/token_handle_fetcher.h" | 5 #include "chrome/browser/chromeos/login/signin/token_handle_fetcher.h" |
| 6 | 6 |
| 7 #include "base/metrics/histogram_macros.h" | 7 #include "base/metrics/histogram_macros.h" |
| 8 #include "chrome/browser/chromeos/login/signin/token_handle_util.h" | 8 #include "chrome/browser/chromeos/login/signin/token_handle_util.h" |
| 9 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 9 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| 11 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 11 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
| 12 #include "chrome/browser/signin/signin_manager_factory.h" | 12 #include "chrome/browser/signin/signin_manager_factory.h" |
| 13 #include "chrome/browser/signin/signin_manager_factory.h" | 13 #include "chrome/browser/signin/signin_manager_factory.h" |
| 14 #include "components/keyed_service/content/browser_context_keyed_service_shutdow
n_notifier_factory.h" | 14 #include "components/keyed_service/content/browser_context_keyed_service_shutdow
n_notifier_factory.h" |
| 15 #include "components/signin/core/browser/profile_oauth2_token_service.h" | 15 #include "components/signin/core/browser/profile_oauth2_token_service.h" |
| 16 #include "components/signin/core/browser/signin_manager.h" | 16 #include "components/signin/core/browser/signin_manager.h" |
| 17 #include "google_apis/gaia/gaia_constants.h" | 17 #include "google_apis/gaia/gaia_constants.h" |
| 18 | 18 |
| 19 namespace { | 19 namespace { |
| 20 const int kMaxRetries = 3; | 20 const int kMaxRetries = 3; |
| 21 | 21 |
| 22 class ShutdownNotifierFactory | 22 class ShutdownNotifierFactory |
| 23 : public BrowserContextKeyedServiceShutdownNotifierFactory { | 23 : public BrowserContextKeyedServiceShutdownNotifierFactory { |
| 24 public: | 24 public: |
| 25 static ShutdownNotifierFactory* GetInstance() { | 25 static ShutdownNotifierFactory* GetInstance() { |
| 26 return Singleton<ShutdownNotifierFactory>::get(); | 26 return base::Singleton<ShutdownNotifierFactory>::get(); |
| 27 } | 27 } |
| 28 | 28 |
| 29 private: | 29 private: |
| 30 friend struct DefaultSingletonTraits<ShutdownNotifierFactory>; | 30 friend struct base::DefaultSingletonTraits<ShutdownNotifierFactory>; |
| 31 | 31 |
| 32 ShutdownNotifierFactory() | 32 ShutdownNotifierFactory() |
| 33 : BrowserContextKeyedServiceShutdownNotifierFactory( | 33 : BrowserContextKeyedServiceShutdownNotifierFactory( |
| 34 "TokenHandleFetcher") { | 34 "TokenHandleFetcher") { |
| 35 DependsOn(ProfileOAuth2TokenServiceFactory::GetInstance()); | 35 DependsOn(ProfileOAuth2TokenServiceFactory::GetInstance()); |
| 36 } | 36 } |
| 37 ~ShutdownNotifierFactory() override {} | 37 ~ShutdownNotifierFactory() override {} |
| 38 | 38 |
| 39 DISALLOW_COPY_AND_ASSIGN(ShutdownNotifierFactory); | 39 DISALLOW_COPY_AND_ASSIGN(ShutdownNotifierFactory); |
| 40 }; | 40 }; |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 } | 148 } |
| 149 const base::TimeDelta duration = | 149 const base::TimeDelta duration = |
| 150 base::TimeTicks::Now() - tokeninfo_response_start_time_; | 150 base::TimeTicks::Now() - tokeninfo_response_start_time_; |
| 151 UMA_HISTOGRAM_TIMES("Login.TokenObtainResponseTime", duration); | 151 UMA_HISTOGRAM_TIMES("Login.TokenObtainResponseTime", duration); |
| 152 callback_.Run(user_id_, success); | 152 callback_.Run(user_id_, success); |
| 153 } | 153 } |
| 154 | 154 |
| 155 void TokenHandleFetcher::OnProfileDestroyed() { | 155 void TokenHandleFetcher::OnProfileDestroyed() { |
| 156 callback_.Run(user_id_, false); | 156 callback_.Run(user_id_, false); |
| 157 } | 157 } |
| OLD | NEW |