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 {
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 {
public:
virtual ~PrivetHTTPClient() {}
......
......@@ -21,7 +21,7 @@ class PrivetHTTPClient;
class ServiceDiscoveryClient;
class PrivetHTTPResolution {
public:
public:
virtual ~PrivetHTTPResolution() {}
virtual void Start() = 0;
virtual const std::string& GetName() = 0;
......
......@@ -5,12 +5,24 @@
#include "chrome/browser/local_discovery/privetv3_session.h"
#include "base/logging.h"
#include "chrome/browser/local_discovery/privet_http.h"
namespace local_discovery {
scoped_ptr<PrivetV3Session> PrivetV3Session::Create(PrivetHTTPClient* client) {
NOTIMPLEMENTED();
return scoped_ptr<PrivetV3Session>();
PrivetV3Session::Delegate::~Delegate() {
}
PrivetV3Session::Request::~Request() {
}
PrivetV3Session::PrivetV3Session(scoped_ptr<PrivetHTTPClient> client,
Delegate* delegate) {
}
PrivetV3Session::~PrivetV3Session() {
}
void PrivetV3Session::Start() {
}
} // namespace local_discovery
......@@ -9,53 +9,64 @@
#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() {}
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 ~Request();
virtual void Start() = 0;
};
virtual ~PrivetV3Session() {}
PrivetV3Session(scoped_ptr<PrivetHTTPClient> client, Delegate* delegate);
~PrivetV3Session();
static scoped_ptr<PrivetV3Session> Create(PrivetHTTPClient* client);
// 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
......
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