Comments and style nits.

Removed unnecessary static PrivetV3Session::Create method.

BUG=372843

Review URL: https://codereview.chromium.org/314303009

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@275558 0039d316-1c4b-4281-b951-d872f2087c98
parent 8d2266c6
...@@ -159,7 +159,7 @@ class PrivetLocalPrintOperation { ...@@ -159,7 +159,7 @@ class PrivetLocalPrintOperation {
virtual PrivetHTTPClient* GetHTTPClient() = 0; virtual PrivetHTTPClient* GetHTTPClient() = 0;
}; };
// Privet HTTP client. Must not outlive the operations it creates. // Privet HTTP client. Must outlive the operations it creates.
class PrivetHTTPClient { class PrivetHTTPClient {
public: public:
virtual ~PrivetHTTPClient() {} virtual ~PrivetHTTPClient() {}
......
...@@ -21,7 +21,7 @@ class PrivetHTTPClient; ...@@ -21,7 +21,7 @@ class PrivetHTTPClient;
class ServiceDiscoveryClient; class ServiceDiscoveryClient;
class PrivetHTTPResolution { class PrivetHTTPResolution {
public: public:
virtual ~PrivetHTTPResolution() {} virtual ~PrivetHTTPResolution() {}
virtual void Start() = 0; virtual void Start() = 0;
virtual const std::string& GetName() = 0; virtual const std::string& GetName() = 0;
......
...@@ -5,12 +5,24 @@ ...@@ -5,12 +5,24 @@
#include "chrome/browser/local_discovery/privetv3_session.h" #include "chrome/browser/local_discovery/privetv3_session.h"
#include "base/logging.h" #include "base/logging.h"
#include "chrome/browser/local_discovery/privet_http.h"
namespace local_discovery { namespace local_discovery {
scoped_ptr<PrivetV3Session> PrivetV3Session::Create(PrivetHTTPClient* client) { PrivetV3Session::Delegate::~Delegate() {
NOTIMPLEMENTED(); }
return scoped_ptr<PrivetV3Session>();
PrivetV3Session::Request::~Request() {
}
PrivetV3Session::PrivetV3Session(scoped_ptr<PrivetHTTPClient> client,
Delegate* delegate) {
}
PrivetV3Session::~PrivetV3Session() {
}
void PrivetV3Session::Start() {
} }
} // namespace local_discovery } // namespace local_discovery
...@@ -9,53 +9,64 @@ ...@@ -9,53 +9,64 @@
#include "base/callback.h" #include "base/callback.h"
#include "base/memory/scoped_ptr.h" #include "base/memory/scoped_ptr.h"
#include "base/values.h"
namespace base {
class DictionaryValue;
}
namespace local_discovery { namespace local_discovery {
class PrivetHTTPClient; class PrivetHTTPClient;
// Manages secure communication between browser and local Privet device.
class PrivetV3Session { class PrivetV3Session {
public: public:
typedef base::Callback< typedef base::Callback<
void(bool success, const base::DictionaryValue& response)> void(bool success, const base::DictionaryValue& response)>
RequestCallback; RequestCallback;
// Delegate to be implemented by client code.
class Delegate { class Delegate {
public: public:
typedef base::Callback<void(bool confirm)> ConfirmationCallback; typedef base::Callback<void(bool confirm)> ConfirmationCallback;
virtual ~Delegate() {} virtual ~Delegate();
// Called when client code should prompt user to check |confirmation_code|.
virtual void OnSetupConfirmationNeeded( virtual void OnSetupConfirmationNeeded(
const std::string& confirmation_code, const std::string& confirmation_code,
const ConfirmationCallback& callback) = 0; const ConfirmationCallback& callback) = 0;
// Called when session successfully establish and client code my call
// |CreateRequest| method.
virtual void OnSessionEstablished() = 0; virtual void OnSessionEstablished() = 0;
// Called when session setup fails.
virtual void OnCannotEstablishSession() = 0; virtual void OnCannotEstablishSession() = 0;
}; };
// Represents request in progress using secure session.
class Request { class Request {
public: public:
virtual ~Request() {} virtual ~Request();
virtual void Start() = 0; virtual void Start() = 0;
}; };
virtual ~PrivetV3Session() {} PrivetV3Session(scoped_ptr<PrivetHTTPClient> client, Delegate* delegate);
~PrivetV3Session();
static scoped_ptr<PrivetV3Session> Create(PrivetHTTPClient* client); // Establishes a session, will call |OnSetupConfirmationNeeded| and then
// Establish a session, will call |OnSetupConfirmationNeeded| and then
// |OnSessionEstablished|. // |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. private:
virtual scoped_ptr<Request> CreateRequest( DISALLOW_COPY_AND_ASSIGN(PrivetV3Session);
const char* api_name,
const base::DictionaryValue& request,
const RequestCallback& callback);
}; };
} // namespace local_discovery } // namespace local_discovery
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment