Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef CONTENT_RENDERER_LOAD_PROGRESS_TRACKER_H_ | 5 #ifndef CONTENT_RENDERER_LOAD_PROGRESS_TRACKER_H_ |
| 6 #define CONTENT_RENDERER_LOAD_PROGRESS_TRACKER_H_ | 6 #define CONTENT_RENDERER_LOAD_PROGRESS_TRACKER_H_ |
| 7 | 7 |
| 8 #include "base/containers/hash_tables.h" | |
| 8 #include "base/logging.h" | 9 #include "base/logging.h" |
| 9 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| 10 #include "base/time/time.h" | 11 #include "base/time/time.h" |
| 11 | 12 |
| 12 namespace blink { | |
| 13 class WebFrame; | |
| 14 } | |
| 15 | |
| 16 namespace content { | 13 namespace content { |
| 14 class RenderFrame; | |
| 17 class RenderViewImpl; | 15 class RenderViewImpl; |
| 18 | 16 |
| 19 class LoadProgressTracker { | 17 class LoadProgressTracker { |
| 20 public: | 18 public: |
| 21 explicit LoadProgressTracker(RenderViewImpl* render_view); | 19 explicit LoadProgressTracker(RenderViewImpl* render_view); |
| 22 ~LoadProgressTracker(); | 20 ~LoadProgressTracker(); |
| 23 | 21 |
| 24 void DidStopLoading(); | 22 void DidStartLoading(RenderFrame* frame); |
| 23 void DidStopLoading(RenderFrame* frame); | |
| 25 | 24 |
| 26 void DidChangeLoadProgress(blink::WebFrame* frame, double progress); | 25 void DidChangeLoadProgress(RenderFrame* frame, double progress); |
| 27 | 26 |
| 28 private: | 27 private: |
| 29 void ResetStates(); | 28 void ResetStates(); |
| 30 | 29 |
| 31 void SendChangeLoadProgress(); | 30 void SendChangeLoadProgress(); |
| 32 | 31 |
| 33 RenderViewImpl* render_view_; | 32 RenderViewImpl* render_view_; |
| 34 | 33 |
| 35 blink::WebFrame* tracked_frame_; | 34 typedef base::hash_map<int, double> ProgressMap; |
|
Charlie Reis
2014/02/27 21:52:07
Can you add a comment saying what the int and doub
| |
| 36 | 35 ProgressMap progresses_; |
| 37 double progress_; | 36 double total_progress_; |
| 38 | 37 |
| 39 base::TimeTicks last_time_progress_sent_; | 38 base::TimeTicks last_time_progress_sent_; |
| 40 | 39 |
| 41 base::WeakPtrFactory<LoadProgressTracker> weak_factory_; | 40 base::WeakPtrFactory<LoadProgressTracker> weak_factory_; |
| 42 | 41 |
| 43 DISALLOW_COPY_AND_ASSIGN(LoadProgressTracker); | 42 DISALLOW_COPY_AND_ASSIGN(LoadProgressTracker); |
| 44 }; | 43 }; |
| 45 | 44 |
| 46 } // namespace content | 45 } // namespace content |
| 47 | 46 |
| 48 #endif // CONTENT_RENDERER_LOAD_PROGRESS_TRACKER_H_ | 47 #endif // CONTENT_RENDERER_LOAD_PROGRESS_TRACKER_H_ |
| OLD | NEW |