| 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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 // also records RAPPOR/UMA about the page load. | 163 // also records RAPPOR/UMA about the page load. |
| 164 // MetricsWebContentsObserver manages a set of provisional PageLoadTrackers, as | 164 // MetricsWebContentsObserver manages a set of provisional PageLoadTrackers, as |
| 165 // well as a committed PageLoadTracker. | 165 // well as a committed PageLoadTracker. |
| 166 class PageLoadTracker { | 166 class PageLoadTracker { |
| 167 public: | 167 public: |
| 168 // Caller must guarantee that the observers pointer outlives this class. | 168 // Caller must guarantee that the observers pointer outlives this class. |
| 169 PageLoadTracker(bool in_foreground, | 169 PageLoadTracker(bool in_foreground, |
| 170 rappor::RapporService* const rappor_service, | 170 rappor::RapporService* const rappor_service, |
| 171 base::ObserverList<PageLoadMetricsObserver, true>* observers); | 171 base::ObserverList<PageLoadMetricsObserver, true>* observers); |
| 172 ~PageLoadTracker(); | 172 ~PageLoadTracker(); |
| 173 void Redirect(content::NavigationHandle* navigation_handle); |
| 173 void Commit(content::NavigationHandle* navigation_handle); | 174 void Commit(content::NavigationHandle* navigation_handle); |
| 174 void WebContentsHidden(); | 175 void WebContentsHidden(); |
| 175 void WebContentsShown(); | 176 void WebContentsShown(); |
| 176 | 177 |
| 177 // Returns true if the timing was successfully updated. | 178 // Returns true if the timing was successfully updated. |
| 178 bool UpdateTiming(const PageLoadTiming& timing); | 179 bool UpdateTiming(const PageLoadTiming& timing); |
| 179 void RecordProvisionalEvent(ProvisionalLoadEvent event); | 180 void RecordProvisionalEvent(ProvisionalLoadEvent event); |
| 180 void RecordCommittedEvent(CommittedLoadEvent event, bool backgrounded); | 181 void RecordCommittedEvent(CommittedLoadEvent event, bool backgrounded); |
| 181 bool HasBackgrounded(); | 182 bool HasBackgrounded(); |
| 182 | 183 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 void AddObserver(PageLoadMetricsObserver* observer) override; | 233 void AddObserver(PageLoadMetricsObserver* observer) override; |
| 233 void RemoveObserver(PageLoadMetricsObserver* observer) override; | 234 void RemoveObserver(PageLoadMetricsObserver* observer) override; |
| 234 | 235 |
| 235 // content::WebContentsObserver implementation: | 236 // content::WebContentsObserver implementation: |
| 236 bool OnMessageReceived(const IPC::Message& message, | 237 bool OnMessageReceived(const IPC::Message& message, |
| 237 content::RenderFrameHost* render_frame_host) override; | 238 content::RenderFrameHost* render_frame_host) override; |
| 238 void DidStartNavigation( | 239 void DidStartNavigation( |
| 239 content::NavigationHandle* navigation_handle) override; | 240 content::NavigationHandle* navigation_handle) override; |
| 240 void DidFinishNavigation( | 241 void DidFinishNavigation( |
| 241 content::NavigationHandle* navigation_handle) override; | 242 content::NavigationHandle* navigation_handle) override; |
| 243 void DidRedirectNavigation( |
| 244 content::NavigationHandle* navigation_handle) override; |
| 242 | 245 |
| 243 void WasShown() override; | 246 void WasShown() override; |
| 244 void WasHidden() override; | 247 void WasHidden() override; |
| 245 | 248 |
| 246 void RenderProcessGone(base::TerminationStatus status) override; | 249 void RenderProcessGone(base::TerminationStatus status) override; |
| 247 | 250 |
| 248 private: | 251 private: |
| 249 friend class content::WebContentsUserData<MetricsWebContentsObserver>; | 252 friend class content::WebContentsUserData<MetricsWebContentsObserver>; |
| 250 | 253 |
| 251 void OnTimingUpdated(content::RenderFrameHost*, const PageLoadTiming& timing); | 254 void OnTimingUpdated(content::RenderFrameHost*, const PageLoadTiming& timing); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 263 | 266 |
| 264 rappor::RapporService* const rappor_service_; | 267 rappor::RapporService* const rappor_service_; |
| 265 base::ObserverList<PageLoadMetricsObserver, true> observers_; | 268 base::ObserverList<PageLoadMetricsObserver, true> observers_; |
| 266 | 269 |
| 267 DISALLOW_COPY_AND_ASSIGN(MetricsWebContentsObserver); | 270 DISALLOW_COPY_AND_ASSIGN(MetricsWebContentsObserver); |
| 268 }; | 271 }; |
| 269 | 272 |
| 270 } // namespace page_load_metrics | 273 } // namespace page_load_metrics |
| 271 | 274 |
| 272 #endif // COMPONENTS_PAGE_LOAD_METRICS_BROWSER_PAGE_LOAD_METRICS_WEB_CONTENTS_O
BSERVER_H_ | 275 #endif // COMPONENTS_PAGE_LOAD_METRICS_BROWSER_PAGE_LOAD_METRICS_WEB_CONTENTS_O
BSERVER_H_ |
| OLD | NEW |