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

Unified Diff: chrome/browser/remoting/directory_add_request.h

Issue 6036001: Move directory code from chrome/service to chrome/browser. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 10 years 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
« no previous file with comments | « no previous file | chrome/browser/remoting/directory_add_request.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/remoting/directory_add_request.h
diff --git a/chrome/browser/remoting/directory_add_request.h b/chrome/browser/remoting/directory_add_request.h
new file mode 100644
index 0000000000000000000000000000000000000000..9e644ba2e25c3e8a1c72e58745b3069b9809cf0e
--- /dev/null
+++ b/chrome/browser/remoting/directory_add_request.h
@@ -0,0 +1,74 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_REMOTING_DIRECTORY_ADD_REQUEST_H_
+#define CHROME_BROWSER_REMOTING_DIRECTORY_ADD_REQUEST_H_
+
+#include <string>
+
+#include "base/callback.h"
+#include "base/scoped_ptr.h"
+#include "chrome/common/remoting/chromoting_host_info.h"
+#include "chrome/common/net/url_fetcher.h"
+#include "googleurl/src/gurl.h"
+
+namespace remoting {
+
+// A class implements REST API insert call for the Chromoting directory service.
dmac 2010/12/17 22:05:46 // A class that implements the REST API insert cal
Sergey Ulanov 2010/12/17 22:33:07 In all our docs the service is called Chromoting d
+class DirectoryAddRequest : public URLFetcher::Delegate {
+ public:
+ enum Result {
+ // Host was added successfully.
+ SUCCESS,
+ // Invalid authentication token.
+ ERROR_AUTH,
+ // Server rejested request because it was invalid. This may
dmac 2010/12/17 22:05:46 Server rejected the
Sergey Ulanov 2010/12/17 22:33:07 Done.
+ // happen, for example, if the specified public key was invalid.
dmac 2010/12/17 22:05:46 get rid of , for example,
Sergey Ulanov 2010/12/17 22:33:07 Done.
+ ERROR_INVALID_REQUEST,
+ // Host is already registered.
+ ERROR_EXISTS,
+ // Internal server error.
+ ERROR_INTERNAL,
+ // Timeout expired.
+ ERROR_TIMEOUT,
+ // Some other error, e.g. network failure.
+ ERROR_OTHER,
+ };
+
+ // Callback called when request is finished. The second parameter
+ // contains error message in case of an error. Error message may not
dmac 2010/12/17 22:05:46 an error message . The error message
Sergey Ulanov 2010/12/17 22:33:07 Done.
+ // be localized, and should be used for logging, but not shown to
+ // the user.
+ typedef Callback2<Result, const std::string&>::Type DoneCallback;
+
+ DirectoryAddRequest();
+ ~DirectoryAddRequest();
+
+ // Add this computer as host. Use the token for
dmac 2010/12/17 22:05:46 as a host. |done_callback| is called when the req
Sergey Ulanov 2010/12/17 22:33:07 Done.
+ // authentication. |done_callback| is called when request is
+ // finished. Request can be cancelled by destorying this object.
+ void AddHost(const remoting::ChromotingHostInfo& host_info,
+ const std::string& auth_token,
+ DoneCallback* done_callback);
+
+ // URLFetcher::Delegate implementation.
+ virtual void OnURLFetchComplete(const URLFetcher* source,
+ const GURL& url,
+ const URLRequestStatus& status,
+ int response_code,
+ const ResponseCookies& cookies,
+ const std::string& data);
+
+ private:
+ friend class DirectoryAddRequestTest;
+
+ scoped_ptr<DoneCallback> done_callback_;
+ scoped_ptr<URLFetcher> fetcher_;
+
+ DISALLOW_COPY_AND_ASSIGN(DirectoryAddRequest);
+};
+
+} // namespace remoting
+
+#endif // CHROME_BROWSER_REMOTING_DIRECTORY_ADD_REQUEST_H_
« no previous file with comments | « no previous file | chrome/browser/remoting/directory_add_request.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698