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..1b6a71a4c087914376d9414538d688f2da1ddb6c |
| --- /dev/null |
| +++ b/remoting/host/connection_block_checker.h |
| @@ -0,0 +1,48 @@ |
| +// 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" |
| + |
| +#include "base/callback.h" |
| + |
| +namespace remoting { |
| + |
| +class ChromotingHostContext; |
| + |
| +class ConnectionBlockChecker : public net::URLFetcherDelegate { |
| + public: |
| + ConnectionBlockChecker(ChromotingHostContext* context, |
| + std::string talkgadget_prefix, |
| + const base::Callback<void(bool)>& callback); |
|
Sergey Ulanov
2012/08/29 20:10:29
it would be cleaner to pass callback to CheckStatu
garykac
2012/08/29 22:30:51
Done.
|
| + virtual ~ConnectionBlockChecker(); |
| + |
| + // Initiates a cecks the verify that there is a valid connection to the host |
| + // talkgadget. Calls |callback_| with the result. |
|
Sergey Ulanov
2012/08/29 20:10:29
nit: Calls the the |callback| specified in the con
garykac
2012/08/29 22:30:51
Done.
|
| + void CheckStatus(); |
| + |
| + private: |
| + // net::URLFetcherDelegate interface. |
| + virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; |
|
Sergey Ulanov
2012/08/29 20:10:29
interface implementation must be public.
garykac
2012/08/29 22:30:51
Done.
|
| + |
| + 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_; |
| + |
| + // Called with the results of the connection check. |
| + const base::Callback<void(bool)> callback_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(ConnectionBlockChecker); |
| +}; |
| + |
| +} // namespace remoting |
| + |
| +#endif // REMOTING_HOST_CONNECTION_BLOCK_CHECKER_H_ |