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

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
« no previous file with comments | « no previous file | chrome/browser/local_discovery/privetv2_session.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..c3e34e5efe7084b0d0a70e76804d1b303844150d
--- /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 success, const base::DictionaryValue& response)>
+ RequestCallback;
+
+ class Delegate {
+ public:
+ typedef base::Callback<void(bool confirm)> ConfirmationCallback;
+
+ virtual ~Delegate() {}
+
+ virtual void OnSetupConfirmationNeeded(
+ const std::string& confirmation_code,
+ 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_
« no previous file with comments | « no previous file | chrome/browser/local_discovery/privetv2_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698