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

Unified Diff: blimp/client/core/context/blimp_client_context_impl.cc

Issue 2406403003: Clean up Assignment Create in BlimpClientContextImpl. (Closed)
Patch Set: Minor comment change. Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: blimp/client/core/context/blimp_client_context_impl.cc
diff --git a/blimp/client/core/context/blimp_client_context_impl.cc b/blimp/client/core/context/blimp_client_context_impl.cc
index e9eda6ae2de473637f806adc9f7556721a620a36..f6536c16c06ecbde097ac3199e7a91a5d8e43c1f 100644
--- a/blimp/client/core/context/blimp_client_context_impl.cc
+++ b/blimp/client/core/context/blimp_client_context_impl.cc
@@ -40,9 +40,6 @@ namespace client {
namespace {
-const char kDefaultAssignerUrl[] =
- "https://blimp-pa.googleapis.com/v1/assignment";
-
void DropConnectionOnIOThread(ClientNetworkComponents* net_components) {
net_components->GetBrowserConnectionHandler()->DropCurrentConnection();
}
@@ -105,6 +102,11 @@ BlimpClientContextImpl::BlimpClientContextImpl(
thread_pipe_manager_ = base::MakeUnique<ThreadPipeManager>(
io_thread_task_runner_, net_components_->GetBrowserConnectionHandler());
+ assignment_fetcher_ = base::MakeUnique<AssignmentFetcher>(
+ base::Bind(&BlimpClientContextImpl::OnAssignmentReceived,
+ weak_factory_.GetWeakPtr()),
+ io_thread_task_runner_, file_thread_task_runner_);
+
RegisterFeatures();
InitializeSettings();
@@ -135,9 +137,7 @@ std::unique_ptr<BlimpContents> BlimpClientContextImpl::CreateBlimpContents(
}
void BlimpClientContextImpl::Connect() {
- // Start Blimp authentication flow. The OAuth2 token will be used in
- // assignment source.
- GetIdentitySource()->Connect();
+ assignment_fetcher_->Fetch(delegate_);
}
void BlimpClientContextImpl::ConnectWithAssignment(
@@ -153,29 +153,8 @@ BlimpClientContextImpl::CreateFeedbackData() {
return CreateBlimpFeedbackData(blimp_contents_manager_.get());
}
-void BlimpClientContextImpl::OnAuthTokenReceived(
- const std::string& client_auth_token) {
- if (!assignment_source_) {
- assignment_source_.reset(new AssignmentSource(
- GetAssignerURL(), io_thread_task_runner_, file_thread_task_runner_));
- }
-
- VLOG(1) << "Trying to get assignment.";
- assignment_source_->GetAssignment(
- client_auth_token,
- base::Bind(&BlimpClientContextImpl::OnAssignmentReceived,
- weak_factory_.GetWeakPtr()));
-}
-
-GURL BlimpClientContextImpl::GetAssignerURL() {
- return GURL(kDefaultAssignerUrl);
-}
-
IdentitySource* BlimpClientContextImpl::GetIdentitySource() {
- if (!identity_source_) {
- CreateIdentitySource();
- }
- return identity_source_.get();
+ return assignment_fetcher_->GetIdentitySource();
David Trainor- moved to gerrit 2016/10/13 03:52:29 I wonder if we can pass the IdentityProvider direc
CJ 2016/10/13 21:19:16 Yeah I'm pretty out of the loop when it comes to s
David Trainor- moved to gerrit 2016/10/20 16:50:32 Don't worry about this for now, I/we can look into
CJ 2016/10/20 20:52:57 Acknowledged.
}
ConnectionStatus* BlimpClientContextImpl::GetConnectionStatus() {
@@ -243,12 +222,6 @@ void BlimpClientContextImpl::DropConnection() {
FROM_HERE, base::Bind(&DropConnectionOnIOThread, net_components_.get()));
}
-void BlimpClientContextImpl::CreateIdentitySource() {
- identity_source_ = base::MakeUnique<IdentitySource>(
- delegate_, base::Bind(&BlimpClientContextImpl::OnAuthTokenReceived,
- base::Unretained(this)));
-}
-
void BlimpClientContextImpl::OnImageDecodeError() {
// Currently we just drop the connection on image decoding error.
DropConnection();

Powered by Google App Engine
This is Rietveld 408576698