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

Side by Side Diff: blimp/engine/session/page_load_tracker.h

Issue 1986883002: blimp: Update page load status update indicator to use first paint. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments. Created 4 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
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef BLIMP_ENGINE_SESSION_PAGE_LOAD_TRACKER_H_
6 #define BLIMP_ENGINE_SESSION_PAGE_LOAD_TRACKER_H_
7
8 #include "base/containers/small_map.h"
9 #include "base/macros.h"
10 #include "content/public/browser/render_frame_host.h"
11 #include "content/public/browser/render_widget_host.h"
12
13 namespace blimp {
14 namespace engine {
15
16 class PageLoadTrackerClient {
17 public:
18 virtual ~PageLoadTrackerClient() {}
19
20 // Called when a navigation status update should be sent to the client.
21 // |load_status| indicates the status of the navigation. An update with a
22 // false value is sent each time a new navigation is initiated. This update
23 // will be followed by a true value when the navigation either successfully
24 // finishes or fails.
Wez 2016/05/24 01:42:17 nit: Feels like this should be an enum w/ values L
Khushal 2016/05/24 18:28:10 Done.
25 virtual void SendPageLoadStatusUpdate(bool load_status) = 0;
26 };
27
28 // Tracks the page load status for a tab using load and paint notifications
29 // from the renderer.
30 class PageLoadTracker {
31 public:
32 explicit PageLoadTracker(PageLoadTrackerClient* client);
33 ~PageLoadTracker();
34
35 void DidStartProvisionalLoadForFrame(
36 content::RenderFrameHost* render_frame_host);
37
38 void DidFinishLoad(content::RenderFrameHost* render_frame_host);
39
40 void DidFailLoad(content::RenderFrameHost* render_frame_host);
41
42 void DidFirstPaintAfterLoad(content::RenderWidgetHost* render_widget_host);
Wez 2016/05/24 01:42:17 nit: No need for blank lines between these. Sugge
Khushal 2016/05/24 18:28:09 You're right, having this class as a WebContentsOb
43
44 private:
45 struct LoadStatus {
46 // Set to true on receiving a notification from the renderer that the load
47 // finished. See WebContentsObserver::DidFinishLoad.
48 bool page_loaded = false;
49
50 // Set to true on receiving a notification from the renderer that the first
51 // paint after a navigation was performed.
52 // See WebContentsObserver::DidFirstPaintAfterLoad.
53 bool did_first_paint = false;
54
55 bool Loaded() const;
56 };
57
58 typedef base::SmallMap<std::map<content::RenderWidgetHost*, LoadStatus>>
59 RenderWidgetLoadStatusMap;
60
61 RenderWidgetLoadStatusMap render_widget_load_status_;
62
63 PageLoadTrackerClient* client_;
64
65 DISALLOW_COPY_AND_ASSIGN(PageLoadTracker);
66 };
67
68 } // namespace engine
69 } // namespace blimp
70
71 #endif // BLIMP_ENGINE_SESSION_PAGE_LOAD_TRACKER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698