Chromium Code Reviews| Index: remoting/host/connection_block_checker.h |
| diff --git a/remoting/host/connection_block_checker.h b/remoting/host/connection_block_checker.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..9fe0fdd4422fcbbf175c295a76d202281ad91cf5 |
| --- /dev/null |
| +++ b/remoting/host/connection_block_checker.h |
| @@ -0,0 +1,55 @@ |
| +// Copyright (c) 2012 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 REMOTING_HOST_CONNECTION_BLOCK_CHECKER_H_ |
| +#define REMOTING_HOST_CONNECTION_BLOCK_CHECKER_H_ |
| + |
| +#include "net/url_request/url_fetcher_delegate.h" |
| + |
| +namespace remoting { |
| + |
| +class ChromotingHostContext; |
| + |
| +class ConnectionBlockChecker : public net::URLFetcherDelegate { |
| + public: |
| + enum Status { |
| + UNKNOWN, |
| + ALLOW, |
| + DENY, |
|
Sergey Ulanov
2012/08/28 00:33:42
UNKNOWN/DENY distinction is not reliable, so I thi
garykac
2012/08/29 00:07:15
Removed.
|
| + }; |
| + |
| + ConnectionBlockChecker(ChromotingHostContext* context, |
| + std::string talkgadget_prefix); |
| + virtual ~ConnectionBlockChecker() {} |
|
Sergey Ulanov
2012/08/28 00:33:42
move destructor implementation to the .cc file. cl
garykac
2012/08/29 00:07:15
Done.
|
| + |
| + Status GetStatus(); |
| + |
| + private: |
| + // net::URLFetcherDelegate interface. |
| + virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; |
| + |
| + ChromotingHostContext* context_; |
| + |
| + // URL fetcher used to verify access to the host talkgadget. |
| + scoped_ptr<net::URLFetcher> url_fetcher_; |
| + |
| + // The string pre-pended to '.talkgadget.google.com' to create the full |
| + // talkgadget domain name for the host. |
| + std::string talkgadget_prefix_; |
| + |
| + // Did we make a successful connection to the host talkgadget? |
| + Status status_; |
| + |
| + // Are we currently in the middle of a check? |
| + bool check_pending_; |
| + |
| + // Number of times we've tried to reach the talkgadget. |
| + int reconnect_attempts_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(ConnectionBlockChecker); |
| + }; |
|
Sergey Ulanov
2012/08/28 00:33:42
nit: incorrect indentation
garykac
2012/08/29 00:07:15
Done.
|
| + |
| +} // namespace remoting |
| + |
| +#endif // REMOTING_HOST_CONNECTION_BLOCK_CHECKER_H_ |