| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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 "blimp/client/core/session/identity_source.h" | 5 #include "blimp/client/core/session/identity_source.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 if (account_id.empty()) { | 59 if (account_id.empty()) { |
| 60 VLOG(1) << "User is not signed in before connection to Blimp engine."; | 60 VLOG(1) << "User is not signed in before connection to Blimp engine."; |
| 61 return; | 61 return; |
| 62 } | 62 } |
| 63 | 63 |
| 64 account_id_ = account_id; | 64 account_id_ = account_id; |
| 65 is_fetching_token_ = true; | 65 is_fetching_token_ = true; |
| 66 FetchAuthToken(); | 66 FetchAuthToken(); |
| 67 } | 67 } |
| 68 | 68 |
| 69 std::string IdentitySource::GetActiveUsername() { |
| 70 return identity_provider_->GetActiveUsername(); |
| 71 } |
| 72 |
| 69 // Add sign in state observer. | 73 // Add sign in state observer. |
| 70 void IdentitySource::AddObserver(IdentityProvider::Observer* observer) { | 74 void IdentitySource::AddObserver(IdentityProvider::Observer* observer) { |
| 71 DCHECK(identity_provider_); | 75 DCHECK(identity_provider_); |
| 72 identity_provider_->AddObserver(observer); | 76 identity_provider_->AddObserver(observer); |
| 73 } | 77 } |
| 74 | 78 |
| 75 // Remove sign in state observer. | 79 // Remove sign in state observer. |
| 76 void IdentitySource::RemoveObserver(IdentityProvider::Observer* observer) { | 80 void IdentitySource::RemoveObserver(IdentityProvider::Observer* observer) { |
| 77 DCHECK(identity_provider_); | 81 DCHECK(identity_provider_); |
| 78 identity_provider_->RemoveObserver(observer); | 82 identity_provider_->RemoveObserver(observer); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 OAuth2TokenService::ScopeSet scopes; | 140 OAuth2TokenService::ScopeSet scopes; |
| 137 scopes.insert(kOAuth2TokenScope); | 141 scopes.insert(kOAuth2TokenScope); |
| 138 token_request_ = token_service->StartRequest(account_id_, scopes, this); | 142 token_request_ = token_service->StartRequest(account_id_, scopes, this); |
| 139 } else { | 143 } else { |
| 140 identity_provider_->AddActiveAccountRefreshTokenObserver(this); | 144 identity_provider_->AddActiveAccountRefreshTokenObserver(this); |
| 141 } | 145 } |
| 142 } | 146 } |
| 143 | 147 |
| 144 } // namespace client | 148 } // namespace client |
| 145 } // namespace blimp | 149 } // namespace blimp |
| OLD | NEW |