summaryrefslogtreecommitdiffstats
path: root/content/browser/loader/resource_message_delegate.h
blob: d5716e3ac252aa3a8aa329cc73e3b2e00730edf9 (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
// Copyright (c) 2013 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 CONTENT_BROWSER_LOADER_RESOURCE_MESSAGE_DELEGATE_
#define CONTENT_BROWSER_LOADER_RESOURCE_MESSAGE_DELEGATE_

#include "base/basictypes.h"
#include "content/common/content_export.h"
#include "content/public/browser/global_request_id.h"

namespace IPC {
class Message;
}

namespace net {
class URLRequest;
}

namespace content {

// A ResourceMessageDelegate receives IPC ResourceMsg_* messages for a specified
// URLRequest. The delegate should implement its own IPC handler. It will
// receive the message _after_ the ResourceDispatcherHost has handled it.
class CONTENT_EXPORT ResourceMessageDelegate {
 public:
  ResourceMessageDelegate(const net::URLRequest* request);
  virtual ~ResourceMessageDelegate();

  // Called when the ResourceDispatcherHostImpl receives a message specifically
  // for this delegate.
  virtual bool OnMessageReceived(const IPC::Message& message,
                                 bool* message_was_ok) = 0;

 private:
  GlobalRequestID id_;
  DISALLOW_IMPLICIT_CONSTRUCTORS(ResourceMessageDelegate);
};

}  // namespace content

#endif  // CONTENT_BROWSER_LOADER_RESOURCE_MESSAGE_DELEGATE_