Compute can_use_lcd_text using property trees.
[chromium-blink-merge.git] / remoting / host / dns_blackhole_checker.h
blob8d7f54db11383867561c6c6d6447f62363ffb920
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef REMOTING_HOST_DNS_BLACKHOLE_CHECKER_H_
6 #define REMOTING_HOST_DNS_BLACKHOLE_CHECKER_H_
8 #include "net/url_request/url_fetcher_delegate.h"
10 #include "base/callback.h"
12 namespace net {
13 class URLRequestContextGetter;
14 } // namespace net
16 namespace remoting {
18 // This is the default prefix that is prepended to the kTalkGadgetUrl to form
19 // the complete talkgadget URL used by the host. Policy settings allow admins
20 // to change the prefix that is used.
21 extern const char kDefaultHostTalkGadgetPrefix[];
23 class DnsBlackholeChecker : public net::URLFetcherDelegate {
24 public:
25 DnsBlackholeChecker(
26 const scoped_refptr<net::URLRequestContextGetter>& request_context_getter,
27 std::string talkgadget_prefix);
28 ~DnsBlackholeChecker() override;
30 // net::URLFetcherDelegate interface.
31 void OnURLFetchComplete(const net::URLFetcher* source) override;
33 // Initiates a check the verify that the host talkgadget has not been "DNS
34 // blackholed" to prevent connections. If this is called again before the
35 // callback has been called, then the second call is ignored.
36 void CheckForDnsBlackhole(const base::Callback<void(bool)>& callback);
38 private:
39 // URL request context getter to use to create the URL fetcher.
40 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_;
42 // URL fetcher used to verify access to the host talkgadget.
43 scoped_ptr<net::URLFetcher> url_fetcher_;
45 // The string pre-pended to '.talkgadget.google.com' to create the full
46 // talkgadget domain name for the host.
47 std::string talkgadget_prefix_;
49 // Called with the results of the connection check.
50 base::Callback<void(bool)> callback_;
52 DISALLOW_COPY_AND_ASSIGN(DnsBlackholeChecker);
55 } // namespace remoting
57 #endif // REMOTING_HOST_DNS_BLACKHOLE_CHECKER_H_