summaryrefslogtreecommitdiffstats
path: root/chrome/common/resource_response.h
blob: 368e410de9060b3328547b061c6fe4c79f8c4a28 (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
50
51
// 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.

// See http://dev.chromium.org/developers/design-documents/multi-process-resource-loading

#ifndef CHROME_COMMON_RESOURCE_RESPONSE_H_
#define CHROME_COMMON_RESOURCE_RESPONSE_H_
#pragma once

#include <string>

#include "base/ref_counted.h"
#include "googleurl/src/gurl.h"
#include "net/url_request/url_request_status.h"
#include "webkit/glue/resource_loader_bridge.h"

// Parameters for a resource response header.
struct ResourceResponseHead
    : webkit_glue::ResourceLoaderBridge::ResponseInfo {
  ResourceResponseHead() : replace_extension_localization_templates(false) {}

  // The response status.
  URLRequestStatus status;

  // Whether we should apply a filter to this resource that replaces
  // localization templates with the appropriate localized strings.  This is set
  // for CSS resources used by extensions.
  bool replace_extension_localization_templates;
};

// Parameters for a synchronous resource response.
struct SyncLoadResult : ResourceResponseHead {
  // The final URL after any redirects.
  GURL final_url;

  // The response data.
  std::string data;
};

// Simple wrapper that refcounts ResourceResponseHead.
struct ResourceResponse : public base::RefCounted<ResourceResponse> {
  ResourceResponseHead response_head;

 private:
  friend class base::RefCounted<ResourceResponse>;

  ~ResourceResponse() {}
};

#endif  // CHROME_COMMON_RESOURCE_RESPONSE_H_