| 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 CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_METRICS_OBSERVER_H_ | 5 #ifndef CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_METRICS_OBSERVER_H_ |
| 6 #define CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_METRICS_OBSERVER_H_ | 6 #define CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_METRICS_OBSERVER_H_ |
| 7 | 7 |
| 8 #include <string> |
| 9 |
| 8 #include "base/macros.h" | 10 #include "base/macros.h" |
| 9 #include "base/optional.h" | 11 #include "base/optional.h" |
| 10 #include "chrome/common/page_load_metrics/page_load_timing.h" | 12 #include "chrome/common/page_load_metrics/page_load_timing.h" |
| 11 #include "content/public/browser/navigation_handle.h" | 13 #include "content/public/browser/navigation_handle.h" |
| 12 #include "third_party/WebKit/public/platform/WebInputEvent.h" | 14 #include "third_party/WebKit/public/platform/WebInputEvent.h" |
| 13 #include "url/gurl.h" | 15 #include "url/gurl.h" |
| 14 | 16 |
| 15 namespace page_load_metrics { | 17 namespace page_load_metrics { |
| 16 | 18 |
| 17 // This enum represents how a page load ends. If the action occurs before the | 19 // This enum represents how a page load ends. If the action occurs before the |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 // OnHidden is triggered when a page leaves the foreground. It does not fire | 236 // OnHidden is triggered when a page leaves the foreground. It does not fire |
| 235 // when a foreground page is permanently closed; for that, listen to | 237 // when a foreground page is permanently closed; for that, listen to |
| 236 // OnComplete instead. | 238 // OnComplete instead. |
| 237 virtual ObservePolicy OnHidden(const PageLoadTiming& timing, | 239 virtual ObservePolicy OnHidden(const PageLoadTiming& timing, |
| 238 const PageLoadExtraInfo& extra_info); | 240 const PageLoadExtraInfo& extra_info); |
| 239 | 241 |
| 240 // OnShown is triggered when a page is brought to the foreground. It does not | 242 // OnShown is triggered when a page is brought to the foreground. It does not |
| 241 // fire when the page first loads; for that, listen for OnStart instead. | 243 // fire when the page first loads; for that, listen for OnStart instead. |
| 242 virtual ObservePolicy OnShown(); | 244 virtual ObservePolicy OnShown(); |
| 243 | 245 |
| 246 // Called before OnCommit. The observer should return whether it wishes to |
| 247 // observe navigations whose main resource has MIME type |mine_type|. The |
| 248 // default is to observe HTML and XHTML only. Note that PageLoadTrackers only |
| 249 // track XHTML, HTML, and MHTML (related/multipart). |
| 250 virtual ObservePolicy ShouldObserveMimeType( |
| 251 const std::string& mime_type) const; |
| 252 |
| 244 // The callbacks below are only invoked after a navigation commits, for | 253 // The callbacks below are only invoked after a navigation commits, for |
| 245 // tracked page loads. Page loads that don't meet the criteria for being | 254 // tracked page loads. Page loads that don't meet the criteria for being |
| 246 // tracked at the time a navigation commits will not receive any of the | 255 // tracked at the time a navigation commits will not receive any of the |
| 247 // callbacks below. | 256 // callbacks below. |
| 248 | 257 |
| 249 // OnTimingUpdate is triggered when an updated PageLoadTiming is | 258 // OnTimingUpdate is triggered when an updated PageLoadTiming is |
| 250 // available. This method may be called multiple times over the course of the | 259 // available. This method may be called multiple times over the course of the |
| 251 // page load. This method is currently only intended for use in testing. Most | 260 // page load. This method is currently only intended for use in testing. Most |
| 252 // implementers should implement one of the On* callbacks, such as | 261 // implementers should implement one of the On* callbacks, such as |
| 253 // OnFirstContentfulPaint or OnDomContentLoadedEventStart. Please email | 262 // OnFirstContentfulPaint or OnDomContentLoadedEventStart. Please email |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 const FailedProvisionalLoadInfo& failed_provisional_load_info, | 335 const FailedProvisionalLoadInfo& failed_provisional_load_info, |
| 327 const PageLoadExtraInfo& extra_info) {} | 336 const PageLoadExtraInfo& extra_info) {} |
| 328 | 337 |
| 329 // Called whenever a request is loaded for this page load. | 338 // Called whenever a request is loaded for this page load. |
| 330 virtual void OnLoadedResource(const ExtraRequestInfo& extra_request_info) {} | 339 virtual void OnLoadedResource(const ExtraRequestInfo& extra_request_info) {} |
| 331 }; | 340 }; |
| 332 | 341 |
| 333 } // namespace page_load_metrics | 342 } // namespace page_load_metrics |
| 334 | 343 |
| 335 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_METRICS_OBSERVER_H_ | 344 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_METRICS_OBSERVER_H_ |
| OLD | NEW |