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

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

Issue 314303009: Comments and style nits. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fri 06/06/2014 10:50:14.11 Created 6 years, 6 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/privetv3_session.h
diff --git a/chrome/browser/local_discovery/privetv3_session.h b/chrome/browser/local_discovery/privetv3_session.h
index e2c41dec7333a2d5b6632b6549403eb26d4edc11..1bf0ca1f80f603c15ace9111575a622393b4e75e 100644
--- a/chrome/browser/local_discovery/privetv3_session.h
+++ b/chrome/browser/local_discovery/privetv3_session.h
@@ -9,53 +9,65 @@
#include "base/callback.h"
#include "base/memory/scoped_ptr.h"
-#include "base/values.h"
+
+namespace base {
+class DictionaryValue;
+}
namespace local_discovery {
class PrivetHTTPClient;
+// Manages secure communication between browser and local Privet device.
class PrivetV3Session {
public:
typedef base::Callback<
void(bool success, const base::DictionaryValue& response)>
RequestCallback;
+ // Delegate to be implemented by client code.
class Delegate {
public:
typedef base::Callback<void(bool confirm)> ConfirmationCallback;
virtual ~Delegate() {}
+ // Called when client code should prompt user to check |confirmation_code|.
virtual void OnSetupConfirmationNeeded(
const std::string& confirmation_code,
const ConfirmationCallback& callback) = 0;
+ // Called when session successfully establish and client code my call
+ // |CreateRequest| method.
virtual void OnSessionEstablished() = 0;
+ // Called when session setup fails.
virtual void OnCannotEstablishSession() = 0;
};
+ // Represents request in progress using secure session.
class Request {
public:
- virtual ~Request() {}
-
- virtual void Start() = 0;
+ ~Request() {}
+ void Start() {}
gene 2014/06/06 18:17:16 why did you remove virtual and pure virtual?
Vitaly Buka (NO REVIEWS) 2014/06/06 18:52:56 Done.
};
- virtual ~PrivetV3Session() {}
+ PrivetV3Session(scoped_ptr<PrivetHTTPClient> client, Delegate* delegate);
- static scoped_ptr<PrivetV3Session> Create(PrivetHTTPClient* client);
+ ~PrivetV3Session();
- // Establish a session, will call |OnSetupConfirmationNeeded| and then
+ // Establishes a session, will call |OnSetupConfirmationNeeded| and then
// |OnSessionEstablished|.
- virtual void Start() = 0;
+ void Start();
+
+ // Create a single /privet/v3/session/call request.
+ // Must be called only after receiving |OnSessionEstablished|.
+ scoped_ptr<Request> CreateRequest(const std::string& api_name,
+ const base::DictionaryValue& request,
+ const RequestCallback& callback);
- // Create a single /privet/v2/session/call request.
- virtual scoped_ptr<Request> CreateRequest(
- const char* api_name,
- const base::DictionaryValue& request,
- const RequestCallback& callback);
+ private:
+ DISALLOW_COPY_AND_ASSIGN(PrivetV3Session);
};
} // namespace local_discovery
« no previous file with comments | « chrome/browser/local_discovery/privet_http_asynchronous_factory.h ('k') | chrome/browser/local_discovery/privetv3_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698