OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/renderer/load_progress_tracker.h" | 5 #include "content/renderer/load_progress_tracker.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "content/common/view_messages.h" | 9 #include "content/common/view_messages.h" |
10 #include "content/renderer/render_view_impl.h" | 10 #include "content/renderer/render_view_impl.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 return; | 31 return; |
32 | 32 |
33 // Load stopped while we were still tracking load. Make sure we notify the | 33 // Load stopped while we were still tracking load. Make sure we notify the |
34 // browser that load is complete. | 34 // browser that load is complete. |
35 progress_ = 1.0; | 35 progress_ = 1.0; |
36 SendChangeLoadProgress(); | 36 SendChangeLoadProgress(); |
37 // Then we clean-up our states. | 37 // Then we clean-up our states. |
38 ResetStates(); | 38 ResetStates(); |
39 } | 39 } |
40 | 40 |
41 void LoadProgressTracker::DidChangeLoadProgress(WebKit::WebFrame* frame, | 41 void LoadProgressTracker::DidChangeLoadProgress(blink::WebFrame* frame, |
42 double progress) { | 42 double progress) { |
43 if (tracked_frame_ && frame != tracked_frame_) | 43 if (tracked_frame_ && frame != tracked_frame_) |
44 return; | 44 return; |
45 | 45 |
46 if (!tracked_frame_) | 46 if (!tracked_frame_) |
47 tracked_frame_ = frame; | 47 tracked_frame_ = frame; |
48 | 48 |
49 progress_ = progress; | 49 progress_ = progress; |
50 | 50 |
51 // We send the progress change to the browser immediately for the first and | 51 // We send the progress change to the browser immediately for the first and |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 } | 83 } |
84 | 84 |
85 void LoadProgressTracker::ResetStates() { | 85 void LoadProgressTracker::ResetStates() { |
86 tracked_frame_ = NULL; | 86 tracked_frame_ = NULL; |
87 progress_ = 0.0; | 87 progress_ = 0.0; |
88 weak_factory_.InvalidateWeakPtrs(); | 88 weak_factory_.InvalidateWeakPtrs(); |
89 last_time_progress_sent_ = base::TimeTicks(); | 89 last_time_progress_sent_ = base::TimeTicks(); |
90 } | 90 } |
91 | 91 |
92 } // namespace content | 92 } // namespace content |
OLD | NEW |