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

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

Issue 23780002: Actual cancelation of registration when cancel buttons pressed (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_PRIVET_HTTP_IMPL_H_ 5 #ifndef CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_HTTP_IMPL_H_
6 #define CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_HTTP_IMPL_H_ 6 #define CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_HTTP_IMPL_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 virtual void OnParsedJson(PrivetURLFetcher* fetcher, 59 virtual void OnParsedJson(PrivetURLFetcher* fetcher,
60 const base::DictionaryValue* value, 60 const base::DictionaryValue* value,
61 bool has_error) OVERRIDE; 61 bool has_error) OVERRIDE;
62 62
63 virtual void OnPrivetInfoDone(PrivetInfoOperation* operation, 63 virtual void OnPrivetInfoDone(PrivetInfoOperation* operation,
64 int http_code, 64 int http_code,
65 const base::DictionaryValue* value) OVERRIDE; 65 const base::DictionaryValue* value) OVERRIDE;
66 66
67 virtual PrivetHTTPClient* GetHTTPClient() OVERRIDE; 67 virtual PrivetHTTPClient* GetHTTPClient() OVERRIDE;
68 private: 68 private:
69 class Cancelation : public PrivetURLFetcher::Delegate {
70 public:
71 Cancelation(PrivetHTTPClientImpl* privet_client,
72 const std::string& user);
73 virtual ~Cancelation();
74
75 virtual void OnError(PrivetURLFetcher* fetcher,
76 PrivetURLFetcher::ErrorType error) OVERRIDE;
77
78 virtual void OnParsedJson(PrivetURLFetcher* fetcher,
79 const base::DictionaryValue* value,
80 bool has_error) OVERRIDE;
81
82 void Cleanup();
83
84 private:
85 scoped_ptr<PrivetURLFetcher> url_fetcher_;
86 };
87
69 // Arguments is JSON value from request. 88 // Arguments is JSON value from request.
70 typedef base::Callback<void(const base::DictionaryValue&)> 89 typedef base::Callback<void(const base::DictionaryValue&)>
71 ResponseHandler; 90 ResponseHandler;
72 91
73 void StartResponse(const base::DictionaryValue& value); 92 void StartResponse(const base::DictionaryValue& value);
74 void GetClaimTokenResponse(const base::DictionaryValue& value); 93 void GetClaimTokenResponse(const base::DictionaryValue& value);
75 void CompleteResponse(const base::DictionaryValue& value); 94 void CompleteResponse(const base::DictionaryValue& value);
76 95
77 void StartInfoOperation(); 96 void StartInfoOperation();
78 97
79 void SendRequest(const std::string& action); 98 void SendRequest(const std::string& action);
80 99
81 bool PrivetErrorTransient(const std::string& error); 100 bool PrivetErrorTransient(const std::string& error);
82 101
102 static GURL GetURLForActionAndUser(
103 PrivetHTTPClientImpl* privet_client,
104 const std::string& action,
105 const std::string& user);
106
83 std::string user_; 107 std::string user_;
84 std::string current_action_; 108 std::string current_action_;
85 scoped_ptr<PrivetURLFetcher> url_fetcher_; 109 scoped_ptr<PrivetURLFetcher> url_fetcher_;
86 PrivetRegisterOperation::Delegate* delegate_; 110 PrivetRegisterOperation::Delegate* delegate_;
87 PrivetHTTPClientImpl* privet_client_; 111 PrivetHTTPClientImpl* privet_client_;
88 ResponseHandler next_response_handler_; 112 ResponseHandler next_response_handler_;
89 // Required to ensure destroying completed register operations doesn't cause 113 // Required to ensure destroying completed register operations doesn't cause
90 // extraneous cancelations. 114 // extraneous cancelations.
91 bool ongoing_; 115 bool ongoing_;
92 scoped_ptr<PrivetInfoOperation> info_operation_; 116 scoped_ptr<PrivetInfoOperation> info_operation_;
(...skipping 27 matching lines...) Expand all
120 144
121 private: 145 private:
122 std::string name_; 146 std::string name_;
123 PrivetURLFetcherFactory fetcher_factory_; 147 PrivetURLFetcherFactory fetcher_factory_;
124 net::HostPortPair host_port_; 148 net::HostPortPair host_port_;
125 scoped_ptr<base::DictionaryValue> cached_info_; 149 scoped_ptr<base::DictionaryValue> cached_info_;
126 }; 150 };
127 151
128 } // namespace local_discovery 152 } // namespace local_discovery
129 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_HTTP_IMPL_H_ 153 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_HTTP_IMPL_H_
OLDNEW
« no previous file with comments | « chrome/browser/local_discovery/privet_constants.cc ('k') | chrome/browser/local_discovery/privet_http_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698