Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef COMPONENTS_PAGE_LOAD_METRICS_RENDERER_PAGE_LOAD_METRICS_RENDER_FRAME_OBS ERVER_H_ | |
| 6 #define COMPONENTS_PAGE_LOAD_METRICS_RENDERER_PAGE_LOAD_METRICS_RENDER_FRAME_OBS ERVER_H_ | |
| 7 | |
| 8 #include "base/macros.h" | |
| 9 #include "base/memory/scoped_ptr.h" | |
| 10 #include "components/page_load_metrics/common/page_load_timing.h" | |
| 11 #include "content/public/renderer/render_frame_observer.h" | |
| 12 | |
| 13 namespace base { | |
| 14 class Timer; | |
| 15 } // namespace base | |
| 16 | |
| 17 namespace page_load_metrics { | |
| 18 | |
| 19 class PageTimingMetricsSender; | |
| 20 | |
| 21 // MainRenderFrameObserver observes RenderFrame notifications, and | |
| 22 // sends page load timing information to the browser process over IPC. | |
| 23 class MainRenderFrameObserver : public content::RenderFrameObserver { | |
| 24 public: | |
| 25 explicit MainRenderFrameObserver(content::RenderFrame* render_frame); | |
| 26 ~MainRenderFrameObserver() override; | |
| 27 | |
| 28 // RenderFrameObserver implementation | |
| 29 void OnStop() override; | |
| 30 void DidFinishDocumentLoad() override; | |
| 31 void DidFinishLoad() override; | |
| 32 void DidFailProvisionalLoad(const blink::WebURLError&) override; | |
| 33 void DidCommitProvisionalLoad(bool is_new_navigation, | |
| 34 bool is_same_page_navigation) override; | |
| 35 | |
| 36 protected: | |
| 37 virtual bool ShouldSendMetrics() const; | |
|
Bryan McQuade
2015/09/04 20:53:18
I learned from your use of private virtual. If any
Charlie Harrison
2015/09/08 23:05:15
Done.
| |
| 38 virtual PageLoadTiming GetTiming() const; | |
| 39 virtual scoped_ptr<base::Timer> CreateTimer() const; | |
| 40 | |
| 41 private: | |
| 42 // Will be null when we're not actively sending metrics. | |
| 43 scoped_ptr<PageTimingMetricsSender> page_timing_metrics_sender_; | |
| 44 | |
| 45 void SendMetrics(); | |
| 46 | |
| 47 DISALLOW_COPY_AND_ASSIGN(MainRenderFrameObserver); | |
| 48 }; | |
| 49 | |
| 50 } // namespace page_load_metrics | |
| 51 | |
| 52 #endif // COMPONENTS_PAGE_LOAD_METRICS_RENDERER_PAGE_LOAD_METRICS_RENDER_FRAME_ OBSERVER_H_ | |
| OLD | NEW |