| 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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 // MetricsWebContentsObserver manages a set of provisional PageLoadTrackers, as | 173 // MetricsWebContentsObserver manages a set of provisional PageLoadTrackers, as |
| 174 // well as a committed PageLoadTracker. | 174 // well as a committed PageLoadTracker. |
| 175 class PageLoadTracker { | 175 class PageLoadTracker { |
| 176 public: | 176 public: |
| 177 // Caller must guarantee that the observers and embedder_interface pointers | 177 // Caller must guarantee that the observers and embedder_interface pointers |
| 178 // outlives this class. | 178 // outlives this class. |
| 179 PageLoadTracker(bool in_foreground, | 179 PageLoadTracker(bool in_foreground, |
| 180 PageLoadMetricsEmbedderInterface* embedder_interface, | 180 PageLoadMetricsEmbedderInterface* embedder_interface, |
| 181 base::ObserverList<PageLoadMetricsObserver, true>* observers); | 181 base::ObserverList<PageLoadMetricsObserver, true>* observers); |
| 182 ~PageLoadTracker(); | 182 ~PageLoadTracker(); |
| 183 void Redirect(content::NavigationHandle* navigation_handle); |
| 183 void Commit(content::NavigationHandle* navigation_handle); | 184 void Commit(content::NavigationHandle* navigation_handle); |
| 184 void WebContentsHidden(); | 185 void WebContentsHidden(); |
| 185 void WebContentsShown(); | 186 void WebContentsShown(); |
| 186 | 187 |
| 187 // Returns true if the timing was successfully updated. | 188 // Returns true if the timing was successfully updated. |
| 188 bool UpdateTiming(const PageLoadTiming& timing); | 189 bool UpdateTiming(const PageLoadTiming& timing); |
| 189 void RecordProvisionalEvent(ProvisionalLoadEvent event); | 190 void RecordProvisionalEvent(ProvisionalLoadEvent event); |
| 190 void RecordCommittedEvent(CommittedLoadEvent event, bool backgrounded); | 191 void RecordCommittedEvent(CommittedLoadEvent event, bool backgrounded); |
| 191 bool HasBackgrounded(); | 192 bool HasBackgrounded(); |
| 192 | 193 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 void AddObserver(PageLoadMetricsObserver* observer) override; | 242 void AddObserver(PageLoadMetricsObserver* observer) override; |
| 242 void RemoveObserver(PageLoadMetricsObserver* observer) override; | 243 void RemoveObserver(PageLoadMetricsObserver* observer) override; |
| 243 | 244 |
| 244 // content::WebContentsObserver implementation: | 245 // content::WebContentsObserver implementation: |
| 245 bool OnMessageReceived(const IPC::Message& message, | 246 bool OnMessageReceived(const IPC::Message& message, |
| 246 content::RenderFrameHost* render_frame_host) override; | 247 content::RenderFrameHost* render_frame_host) override; |
| 247 void DidStartNavigation( | 248 void DidStartNavigation( |
| 248 content::NavigationHandle* navigation_handle) override; | 249 content::NavigationHandle* navigation_handle) override; |
| 249 void DidFinishNavigation( | 250 void DidFinishNavigation( |
| 250 content::NavigationHandle* navigation_handle) override; | 251 content::NavigationHandle* navigation_handle) override; |
| 252 void DidRedirectNavigation( |
| 253 content::NavigationHandle* navigation_handle) override; |
| 251 | 254 |
| 252 void WasShown() override; | 255 void WasShown() override; |
| 253 void WasHidden() override; | 256 void WasHidden() override; |
| 254 | 257 |
| 255 void RenderProcessGone(base::TerminationStatus status) override; | 258 void RenderProcessGone(base::TerminationStatus status) override; |
| 256 | 259 |
| 257 private: | 260 private: |
| 258 friend class content::WebContentsUserData<MetricsWebContentsObserver>; | 261 friend class content::WebContentsUserData<MetricsWebContentsObserver>; |
| 259 | 262 |
| 260 void OnTimingUpdated(content::RenderFrameHost*, const PageLoadTiming& timing); | 263 void OnTimingUpdated(content::RenderFrameHost*, const PageLoadTiming& timing); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 272 | 275 |
| 273 scoped_ptr<PageLoadMetricsEmbedderInterface> embedder_interface_; | 276 scoped_ptr<PageLoadMetricsEmbedderInterface> embedder_interface_; |
| 274 base::ObserverList<PageLoadMetricsObserver, true> observers_; | 277 base::ObserverList<PageLoadMetricsObserver, true> observers_; |
| 275 | 278 |
| 276 DISALLOW_COPY_AND_ASSIGN(MetricsWebContentsObserver); | 279 DISALLOW_COPY_AND_ASSIGN(MetricsWebContentsObserver); |
| 277 }; | 280 }; |
| 278 | 281 |
| 279 } // namespace page_load_metrics | 282 } // namespace page_load_metrics |
| 280 | 283 |
| 281 #endif // COMPONENTS_PAGE_LOAD_METRICS_BROWSER_PAGE_LOAD_METRICS_WEB_CONTENTS_O
BSERVER_H_ | 284 #endif // COMPONENTS_PAGE_LOAD_METRICS_BROWSER_PAGE_LOAD_METRICS_WEB_CONTENTS_O
BSERVER_H_ |
| OLD | NEW |