summaryrefslogtreecommitdiff
path: root/chromium/content/renderer/load_progress_tracker.h
blob: c4ed37eca9d679232fe47c7cbf59358c30179477 (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
// Copyright (c) 2011 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_RENDERER_LOAD_PROGRESS_TRACKER_H_
#define CONTENT_RENDERER_LOAD_PROGRESS_TRACKER_H_

#include "base/logging.h"
#include "base/memory/weak_ptr.h"
#include "base/time/time.h"

namespace blink {
class WebFrame;
}

namespace content {
class RenderViewImpl;

class LoadProgressTracker {
 public:
  explicit LoadProgressTracker(RenderViewImpl* render_view);
  ~LoadProgressTracker();

  void DidStopLoading();

  void DidChangeLoadProgress(blink::WebFrame* frame, double progress);

 private:
  void ResetStates();

  void SendChangeLoadProgress();

  RenderViewImpl* render_view_;

  blink::WebFrame* tracked_frame_;

  double progress_;

  base::TimeTicks last_time_progress_sent_;

  base::WeakPtrFactory<LoadProgressTracker> weak_factory_;

  DISALLOW_COPY_AND_ASSIGN(LoadProgressTracker);
};

}  // namespace content

#endif  // CONTENT_RENDERER_LOAD_PROGRESS_TRACKER_H_