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

Unified Diff: blimp/client/core/context/assignment_fetcher.h

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/assignment_fetcher.h
diff --git a/blimp/client/core/context/assignment_fetcher.h b/blimp/client/core/context/assignment_fetcher.h
new file mode 100644
index 0000000000000000000000000000000000000000..d9c9d42d0841f7a1b84179f4cce5236eb22a77b3
--- /dev/null
+++ b/blimp/client/core/context/assignment_fetcher.h
@@ -0,0 +1,68 @@
+// 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 BLIMP_CLIENT_CORE_CONTEXT_ASSIGNMENT_FETCHER_H_
+#define BLIMP_CLIENT_CORE_CONTEXT_ASSIGNMENT_FETCHER_H_
+
+#include <memory>
+#include <string>
+
+#include "blimp/client/core/session/assignment_source.h"
+#include "blimp/client/core/session/identity_source.h"
+
+namespace blimp {
+namespace client {
+
+class AssignmentFetcher {
David Trainor- moved to gerrit 2016/10/13 03:52:29 This might be better off in core/session
+ public:
+ AssignmentFetcher(
+ base::Callback<void(AssignmentRequestResult, const Assignment&)>
+ assignment_receieved_callback,
David Trainor- moved to gerrit 2016/10/13 03:52:29 receieved -> received
+ scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner,
+ scoped_refptr<base::SingleThreadTaskRunner> file_thread_task_runner);
+
+ ~AssignmentFetcher();
+
+ void Fetch(BlimpClientContextDelegate* delegate);
+
+ IdentitySource* GetIdentitySource();
+
+ private:
+ // Called when an OAuth2 token is received. Will then ask the
+ // AssignmentSource for an Assignment with this token.
+ void OnAuthTokenReceived(const std::string& client_auth_token);
+
+ // Create IdentitySource which provides user sign in states and OAuth2 token
+ // service.
+ void CreateIdentitySource();
+
+ // Returns the URL to use for connections to the assigner. Used to construct
+ // the AssignmentSource.
+ GURL GetAssignerURL();
+
+ base::Callback<void(AssignmentRequestResult, const Assignment&)>
+ assignment_received_callback_;
+
+ // The task runner to use for IO operations.
+ scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner_;
+
+ // The task runner to use for file operations.
+ scoped_refptr<base::SingleThreadTaskRunner> file_thread_task_runner_;
+
+ // The AssignmentSource is used when the user of AssignmentFetcher calls
+ // Fetch() to get a valid assignment and later connect to the engine.
+ std::unique_ptr<AssignmentSource> assignment_source_;
+
+ // Provide OAuth2 token and propagate account sign in states change.
+ std::unique_ptr<IdentitySource> identity_source_;
+
+ BlimpClientContextDelegate* delegate_ = nullptr;
+
+ DISALLOW_COPY_AND_ASSIGN(AssignmentFetcher);
+};
+
+} // namespace client
+} // namespace blimp
+
+#endif // BLIMP_CLIENT_CORE_CONTEXT_ASSIGNMENT_FETCHER_H_

Powered by Google App Engine
This is Rietveld 408576698