Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(268)

Side by Side Diff: content/browser/frame_host/load_progress_tracker.h

Issue 263973003: Move LoadProgressTracker to the browser process. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_BROWSER_FRAME_HOST_LOAD_PROGRESS_TRACKER_H_
6 #define CONTENT_RENDERER_LOAD_PROGRESS_TRACKER_H_ 6 #define CONTENT_BROWSER_FRAME_HOST_LOAD_PROGRESS_TRACKER_H_
7 7
8 #include "base/containers/hash_tables.h" 8 #include "base/containers/hash_tables.h"
9 #include "base/gtest_prod_util.h"
9 #include "base/logging.h" 10 #include "base/logging.h"
10 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
11 #include "base/time/time.h" 12 #include "base/time/time.h"
12 13
13 namespace content { 14 namespace content {
14 class RenderViewImpl; 15 class NavigatorDelegate;
15 16
16 class LoadProgressTracker { 17 class LoadProgressTracker {
17 public: 18 public:
18 explicit LoadProgressTracker(RenderViewImpl* render_view); 19 explicit LoadProgressTracker(NavigatorDelegate* delegate);
19 ~LoadProgressTracker(); 20 ~LoadProgressTracker();
20 21
21 void DidStartLoading(int frame_routing_id); 22 void DidStartLoading(int frame_routing_id);
22 void DidStopLoading(int frame_routing_id); 23 void DidStopLoading(int frame_routing_id);
23 24
24 void DidChangeLoadProgress(int frame_routing_id, double progress); 25 void DidChangeLoadProgress(int frame_routing_id, double progress);
25 26
26 private: 27 private:
28 FRIEND_TEST_ALL_PREFIXES(LoadProgressTrackerBrowserTest, BasicProgress);
29
27 void ResetStates(); 30 void ResetStates();
28 31
29 void SendChangeLoadProgress(); 32 void SendChangeLoadProgress();
30 33
31 RenderViewImpl* render_view_; 34 NavigatorDelegate* delegate_;
32 35
33 // ProgressMap maps RenderFrame routing ids to a double representing that 36 // ProgressMap maps RenderFrameHost routing ids to a double representing that
34 // frame's completion (from 0 to 1). 37 // frame's completion (from 0 to 1).
35 typedef base::hash_map<int, double> ProgressMap; 38 typedef base::hash_map<int, double> ProgressMap;
36 ProgressMap progresses_; 39 ProgressMap progresses_;
37 double total_progress_; 40 double total_progress_;
38 41
39 base::TimeTicks last_time_progress_sent_; 42 base::TimeTicks last_time_progress_sent_;
40 43
41 base::WeakPtrFactory<LoadProgressTracker> weak_factory_; 44 base::WeakPtrFactory<LoadProgressTracker> weak_factory_;
42 45
43 DISALLOW_COPY_AND_ASSIGN(LoadProgressTracker); 46 DISALLOW_COPY_AND_ASSIGN(LoadProgressTracker);
44 }; 47 };
45 48
46 } // namespace content 49 } // namespace content
47 50
48 #endif // CONTENT_RENDERER_LOAD_PROGRESS_TRACKER_H_ 51 #endif // CONTENT_BROWSER_FRAME_HOST_LOAD_PROGRESS_TRACKER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698