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

Unified Diff: chrome/browser/local_discovery/privetv2_session.h

Issue 299123003: PrivetV2 SetupFlow, Session and SetupOperation interfaces (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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: chrome/browser/local_discovery/privetv2_session.h
diff --git a/chrome/browser/local_discovery/privetv2_session.h b/chrome/browser/local_discovery/privetv2_session.h
new file mode 100644
index 0000000000000000000000000000000000000000..552e5ce0e232b6cc668db448fde97139210d83f1
--- /dev/null
+++ b/chrome/browser/local_discovery/privetv2_session.h
@@ -0,0 +1,63 @@
+// Copyright 2014 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_LOCAL_DISCOVERY_PRIVETV2_SESSION_H_
+#define CHROME_BROWSER_LOCAL_DISCOVERY_PRIVETV2_SESSION_H_
+
+#include <string>
+
+#include "base/callback.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/values.h"
+
+namespace local_discovery {
+
+class PrivetHTTPClient;
+
+class PrivetV2Session {
+ public:
+ typedef base::Callback<void(bool confirm)> ConfirmationCallback;
+
+ typedef base::Callback<
+ void(bool success, const base::DictionaryValue& response)>
+ RequestCallback;
+
+ class Delegate {
+ public:
+ virtual ~Delegate() {}
+
+ virtual void OnSetupConfirmationNeeded(
+ const std::string& confirmation_code,
Vitaly Buka (NO REVIEWS) 2014/05/23 17:22:09 callbacks should be in Delegate scope
Noam Samuel 2014/05/23 17:30:09 Done.
+ const ConfirmationCallback& callback) = 0;
+
+ virtual void OnSessionEstablished() = 0;
+
+ virtual void OnCannotEstablishSession() = 0;
+ };
+
+ class Request {
+ public:
+ virtual ~Request() {}
+
+ virtual void Start() = 0;
+ };
+
+ virtual ~PrivetV2Session() {}
+
+ static scoped_ptr<PrivetV2Session> Create(PrivetHTTPClient* client);
+
+ // Establish a session, will call |OnSetupConfirmationNeeded| and then
+ // |OnSessionEstablished|.
+ virtual void Start() = 0;
+
+ // Create a single /privet/v2/session/call request.
+ virtual scoped_ptr<Request> CreateRequest(
+ const char* api_name,
+ const base::DictionaryValue& request,
+ const RequestCallback& callback);
+};
+
+} // namespace local_discovery
+
+#endif // CHROME_BROWSER_LOCAL_DISCOVERY_PRIVETV2_SESSION_H_

Powered by Google App Engine
This is Rietveld 408576698