summaryrefslogtreecommitdiffstats
path: root/webkit/glue/alt_error_page_resource_fetcher.h
blob: 0ca357bb8e641733280847498957162560a1ad15 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Copyright (c) 2006-2008 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 WEBKIT_GLUE_ALT_ERROR_PAGE_RESOURCE_FETCHER_H__
#define WEBKIT_GLUE_ALT_ERROR_PAGE_RESOURCE_FETCHER_H__

#include <string>

#include "base/scoped_ptr.h"
#include "webkit/api/public/WebURLError.h"
#include "webkit/api/public/WebURLRequest.h"
#include "webkit/glue/resource_fetcher.h"

class ResourceFetcherWithTimeout;
class WebFrameImpl;
class WebView;

namespace webkit_glue {

// Used for downloading alternate dns error pages. Once downloading is done
// (or fails), the webview delegate is notified.
class AltErrorPageResourceFetcher {
 public:
  AltErrorPageResourceFetcher(WebView* web_view,
                              WebFrame* web_frame,
                              const WebKit::WebURLError& web_error,
                              const GURL& url);
  ~AltErrorPageResourceFetcher();

 private:
  void OnURLFetchComplete(const WebKit::WebURLResponse& response,
                          const std::string& data);

  // References to our owners
  WebView* web_view_;
  WebFrame* web_frame_;
  WebKit::WebURLError web_error_;
  WebKit::WebURLRequest failed_request_;

  // Does the actual fetching.
  scoped_ptr<ResourceFetcherWithTimeout> fetcher_;

  DISALLOW_COPY_AND_ASSIGN(AltErrorPageResourceFetcher);
};

}  // namespace webkit_glue

#endif  // WEBKIT_GLUE_ALT_ERROR_PAGE_RESOURCE_FETCHER_H__