summaryrefslogtreecommitdiff
path: root/chromium/content/browser/loader/loader_delegate.h
blob: 71d27a6bb9410e03d5645613af4302484ace2853 (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
52
53
54
55
56
57
58
59
60
61
62
// Copyright 2016 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_LOADER_DELEGATE_H_
#define CONTENT_BROWSER_LOADER_LOADER_DELEGATE_H_

#include <inttypes.h>

#include <memory>

#include "base/time/time.h"
#include "content/common/content_export.h"
#include "content/public/browser/resource_request_details.h"
#include "content/public/browser/resource_request_info.h"
#include "net/base/load_states.h"

class GURL;

namespace content {

// Delegate from loader to the rest of content. Should be interacted with on the
// IO thread unless otherwise noted.
//
// This is used for breaking dependencies between content at-large and
// content/browser/loader which will eventually be moved to a separate
// networking service. All methods in this interface should be asynchronous,
// since eventually this will be a Mojo interface. See https://crbug.com/622050
// and https://crbug.com/598073.
class CONTENT_EXPORT LoaderDelegate {
 public:
  virtual ~LoaderDelegate() {}

  // Notification that the load state for the given WebContents has changed.
  // NOTE: this method is called on the UI thread.
  virtual void LoadStateChanged(
      WebContents* web_contents,
      const GURL& url,
      const net::LoadStateWithParam& load_state,
      uint64_t upload_position,
      uint64_t upload_size) = 0;

  // Notification that a response has been received for a resource request.
  virtual void DidGetResourceResponseStart(
      const ResourceRequestInfo::WebContentsGetter& web_contents_getter,
      std::unique_ptr<ResourceRequestDetails> details) = 0;

  // Notification that a redirect was received while requesting a resource.
  virtual void DidGetRedirectForResourceRequest(
      const ResourceRequestInfo::WebContentsGetter& web_contents_getter,
      std::unique_ptr<ResourceRedirectDetails> details) = 0;

  // Called when the network stack started handling the navigation request.
  virtual void LogResourceRequestTime(base::TimeTicks timestamp,
                                      int render_process_id,
                                      int render_frame_id,
                                      const GURL& url) = 0;
};

}  // namespace content

#endif  // CONTENT_BROWSER_LOADER_LOADER_DELEGATE_H_