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

Side by Side Diff: chrome/browser/local_discovery/privetv3_session.h

Issue 318283002: Added new GCD/Privet interfaces. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_LOCAL_DISCOVERY_PRIVETV3_SESSION_H_ 5 #ifndef CHROME_BROWSER_LOCAL_DISCOVERY_PRIVETV3_SESSION_H_
6 #define CHROME_BROWSER_LOCAL_DISCOVERY_PRIVETV3_SESSION_H_ 6 #define CHROME_BROWSER_LOCAL_DISCOVERY_PRIVETV3_SESSION_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 12
13 namespace base { 13 namespace base {
14 class DictionaryValue; 14 class DictionaryValue;
15 } 15 }
16 16
17 namespace local_discovery { 17 namespace local_discovery {
18 18
19 class PrivetHTTPClient; 19 class PrivetV3HTTPClient;
20 20
21 // Manages secure communication between browser and local Privet device. 21 // Manages secure communication between browser and local Privet device.
22 class PrivetV3Session { 22 class PrivetV3Session {
23 public: 23 public:
24 typedef base::Callback< 24 typedef base::Callback<
25 void(bool success, const base::DictionaryValue& response)> 25 void(bool success, const base::DictionaryValue& response)>
26 RequestCallback; 26 RequestCallback;
27 27
28 // Delegate to be implemented by client code. 28 // Delegate to be implemented by client code.
29 class Delegate { 29 class Delegate {
(...skipping 15 matching lines...) Expand all
45 virtual void OnCannotEstablishSession() = 0; 45 virtual void OnCannotEstablishSession() = 0;
46 }; 46 };
47 47
48 // Represents request in progress using secure session. 48 // Represents request in progress using secure session.
49 class Request { 49 class Request {
50 public: 50 public:
51 virtual ~Request(); 51 virtual ~Request();
52 virtual void Start() = 0; 52 virtual void Start() = 0;
53 }; 53 };
54 54
55 PrivetV3Session(scoped_ptr<PrivetHTTPClient> client, Delegate* delegate); 55 PrivetV3Session(scoped_ptr<PrivetV3HTTPClient> client, Delegate* delegate);
56 ~PrivetV3Session(); 56 ~PrivetV3Session();
57 57
58 // Establishes a session, will call |OnSetupConfirmationNeeded| and then 58 // Establishes a session, will call |OnSetupConfirmationNeeded| and then
59 // |OnSessionEstablished|. 59 // |OnSessionEstablished|.
60 void Start(); 60 void Start();
61 61
62 // Create a single /privet/v3/session/call request. 62 // Create a single /privet/v3/session/call request.
63 // Must be called only after receiving |OnSessionEstablished|. 63 // Must be called only after receiving |OnSessionEstablished|.
64 scoped_ptr<Request> CreateRequest(const std::string& api_name, 64 scoped_ptr<Request> CreateRequest(const std::string& api_name,
65 const base::DictionaryValue& request, 65 const base::DictionaryValue& request,
66 const RequestCallback& callback); 66 const RequestCallback& callback);
67 67
68 private: 68 private:
69 DISALLOW_COPY_AND_ASSIGN(PrivetV3Session); 69 DISALLOW_COPY_AND_ASSIGN(PrivetV3Session);
70 }; 70 };
71 71
72 } // namespace local_discovery 72 } // namespace local_discovery
73 73
74 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_PRIVETV3_SESSION_H_ 74 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_PRIVETV3_SESSION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698