[email protected] | 32876ae | 2011-11-15 22:25:21 | [diff] [blame] | 1 | // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
[email protected] | 9010941 | 2010-12-15 17:14:24 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
3 | // found in the LICENSE file. | ||||
4 | |||||
[email protected] | 921f159 | 2011-03-18 00:41:02 | [diff] [blame] | 5 | #ifndef CONTENT_RENDERER_LOAD_PROGRESS_TRACKER_H_ |
6 | #define CONTENT_RENDERER_LOAD_PROGRESS_TRACKER_H_ | ||||
[email protected] | 9010941 | 2010-12-15 17:14:24 | [diff] [blame] | 7 | |
8 | #include "base/logging.h" | ||||
[email protected] | 32876ae | 2011-11-15 22:25:21 | [diff] [blame] | 9 | #include "base/memory/weak_ptr.h" |
[email protected] | 9010941 | 2010-12-15 17:14:24 | [diff] [blame] | 10 | #include "base/time.h" |
11 | |||||
[email protected] | 9010941 | 2010-12-15 17:14:24 | [diff] [blame] | 12 | namespace WebKit { |
13 | class WebFrame; | ||||
14 | } | ||||
15 | |||||
[email protected] | e9ff79c | 2012-10-19 21:31:26 | [diff] [blame] | 16 | namespace content { |
17 | class RenderViewImpl; | ||||
18 | |||||
[email protected] | 9010941 | 2010-12-15 17:14:24 | [diff] [blame] | 19 | class LoadProgressTracker { |
20 | public: | ||||
[email protected] | 310ebd630 | 2011-10-10 19:06:28 | [diff] [blame] | 21 | explicit LoadProgressTracker(RenderViewImpl* render_view); |
[email protected] | 9010941 | 2010-12-15 17:14:24 | [diff] [blame] | 22 | ~LoadProgressTracker(); |
23 | |||||
24 | void DidStopLoading(); | ||||
25 | |||||
26 | void DidChangeLoadProgress(WebKit::WebFrame* frame, double progress); | ||||
27 | |||||
28 | private: | ||||
29 | void ResetStates(); | ||||
30 | |||||
31 | void SendChangeLoadProgress(); | ||||
32 | |||||
[email protected] | 310ebd630 | 2011-10-10 19:06:28 | [diff] [blame] | 33 | RenderViewImpl* render_view_; |
[email protected] | 9010941 | 2010-12-15 17:14:24 | [diff] [blame] | 34 | |
35 | WebKit::WebFrame* tracked_frame_; | ||||
36 | |||||
37 | double progress_; | ||||
38 | |||||
39 | base::TimeTicks last_time_progress_sent_; | ||||
40 | |||||
[email protected] | 32876ae | 2011-11-15 22:25:21 | [diff] [blame] | 41 | base::WeakPtrFactory<LoadProgressTracker> weak_factory_; |
[email protected] | 9010941 | 2010-12-15 17:14:24 | [diff] [blame] | 42 | |
43 | DISALLOW_COPY_AND_ASSIGN(LoadProgressTracker); | ||||
44 | }; | ||||
45 | |||||
[email protected] | e9ff79c | 2012-10-19 21:31:26 | [diff] [blame] | 46 | } // namespace content |
47 | |||||
[email protected] | 921f159 | 2011-03-18 00:41:02 | [diff] [blame] | 48 | #endif // CONTENT_RENDERER_LOAD_PROGRESS_TRACKER_H_ |