| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 COMPONENTS_PAGE_LOAD_METRICS_BROWSER_PAGE_LOAD_METRICS_WEB_CONTENTS_OBSE
RVER_H_ | 5 #ifndef COMPONENTS_PAGE_LOAD_METRICS_BROWSER_PAGE_LOAD_METRICS_WEB_CONTENTS_OBSE
RVER_H_ |
| 6 #define COMPONENTS_PAGE_LOAD_METRICS_BROWSER_PAGE_LOAD_METRICS_WEB_CONTENTS_OBSE
RVER_H_ | 6 #define COMPONENTS_PAGE_LOAD_METRICS_BROWSER_PAGE_LOAD_METRICS_WEB_CONTENTS_OBSE
RVER_H_ |
| 7 | 7 |
| 8 #include "base/containers/scoped_ptr_map.h" | 8 #include "base/containers/scoped_ptr_map.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 // MetricsWebContentsObserver manages a set of provisional PageLoadTrackers, as | 190 // MetricsWebContentsObserver manages a set of provisional PageLoadTrackers, as |
| 191 // well as a committed PageLoadTracker. | 191 // well as a committed PageLoadTracker. |
| 192 class PageLoadTracker { | 192 class PageLoadTracker { |
| 193 public: | 193 public: |
| 194 // Caller must guarantee that the observers and embedder_interface pointers | 194 // Caller must guarantee that the observers and embedder_interface pointers |
| 195 // outlives this class. | 195 // outlives this class. |
| 196 PageLoadTracker(bool in_foreground, | 196 PageLoadTracker(bool in_foreground, |
| 197 PageLoadMetricsEmbedderInterface* embedder_interface, | 197 PageLoadMetricsEmbedderInterface* embedder_interface, |
| 198 base::ObserverList<PageLoadMetricsObserver, true>* observers); | 198 base::ObserverList<PageLoadMetricsObserver, true>* observers); |
| 199 ~PageLoadTracker(); | 199 ~PageLoadTracker(); |
| 200 void Redirect(content::NavigationHandle* navigation_handle); |
| 200 void Commit(content::NavigationHandle* navigation_handle); | 201 void Commit(content::NavigationHandle* navigation_handle); |
| 201 void WebContentsHidden(); | 202 void WebContentsHidden(); |
| 202 void WebContentsShown(); | 203 void WebContentsShown(); |
| 203 | 204 |
| 204 // Returns true if the timing was successfully updated. | 205 // Returns true if the timing was successfully updated. |
| 205 bool UpdateTiming(const PageLoadTiming& timing); | 206 bool UpdateTiming(const PageLoadTiming& timing); |
| 206 void RecordProvisionalEvent(ProvisionalLoadEvent event); | 207 void RecordProvisionalEvent(ProvisionalLoadEvent event); |
| 207 void RecordCommittedEvent(CommittedLoadEvent event, bool backgrounded); | 208 void RecordCommittedEvent(CommittedLoadEvent event, bool backgrounded); |
| 208 bool HasBackgrounded(); | 209 bool HasBackgrounded(); |
| 209 | 210 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 void AddObserver(PageLoadMetricsObserver* observer) override; | 259 void AddObserver(PageLoadMetricsObserver* observer) override; |
| 259 void RemoveObserver(PageLoadMetricsObserver* observer) override; | 260 void RemoveObserver(PageLoadMetricsObserver* observer) override; |
| 260 | 261 |
| 261 // content::WebContentsObserver implementation: | 262 // content::WebContentsObserver implementation: |
| 262 bool OnMessageReceived(const IPC::Message& message, | 263 bool OnMessageReceived(const IPC::Message& message, |
| 263 content::RenderFrameHost* render_frame_host) override; | 264 content::RenderFrameHost* render_frame_host) override; |
| 264 void DidStartNavigation( | 265 void DidStartNavigation( |
| 265 content::NavigationHandle* navigation_handle) override; | 266 content::NavigationHandle* navigation_handle) override; |
| 266 void DidFinishNavigation( | 267 void DidFinishNavigation( |
| 267 content::NavigationHandle* navigation_handle) override; | 268 content::NavigationHandle* navigation_handle) override; |
| 269 void DidRedirectNavigation( |
| 270 content::NavigationHandle* navigation_handle) override; |
| 268 | 271 |
| 269 void WasShown() override; | 272 void WasShown() override; |
| 270 void WasHidden() override; | 273 void WasHidden() override; |
| 271 | 274 |
| 272 void RenderProcessGone(base::TerminationStatus status) override; | 275 void RenderProcessGone(base::TerminationStatus status) override; |
| 273 | 276 |
| 274 private: | 277 private: |
| 275 friend class content::WebContentsUserData<MetricsWebContentsObserver>; | 278 friend class content::WebContentsUserData<MetricsWebContentsObserver>; |
| 276 | 279 |
| 277 void OnTimingUpdated(content::RenderFrameHost*, const PageLoadTiming& timing); | 280 void OnTimingUpdated(content::RenderFrameHost*, const PageLoadTiming& timing); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 289 | 292 |
| 290 scoped_ptr<PageLoadMetricsEmbedderInterface> embedder_interface_; | 293 scoped_ptr<PageLoadMetricsEmbedderInterface> embedder_interface_; |
| 291 base::ObserverList<PageLoadMetricsObserver, true> observers_; | 294 base::ObserverList<PageLoadMetricsObserver, true> observers_; |
| 292 | 295 |
| 293 DISALLOW_COPY_AND_ASSIGN(MetricsWebContentsObserver); | 296 DISALLOW_COPY_AND_ASSIGN(MetricsWebContentsObserver); |
| 294 }; | 297 }; |
| 295 | 298 |
| 296 } // namespace page_load_metrics | 299 } // namespace page_load_metrics |
| 297 | 300 |
| 298 #endif // COMPONENTS_PAGE_LOAD_METRICS_BROWSER_PAGE_LOAD_METRICS_WEB_CONTENTS_O
BSERVER_H_ | 301 #endif // COMPONENTS_PAGE_LOAD_METRICS_BROWSER_PAGE_LOAD_METRICS_WEB_CONTENTS_O
BSERVER_H_ |
| OLD | NEW |