OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "content/renderer/stats_collection_observer.h" | 5 #include "components/html_viewer/stats_collection_observer.h" |
6 | 6 |
7 #include "base/time/time.h" | 7 namespace html_viewer { |
8 #include "content/renderer/render_view_impl.h" | |
9 | 8 |
10 namespace content { | 9 StatsCollectionObserver::StatsCollectionObserver(HTMLDocument* html_document) |
11 | 10 : HTMLDocument::Observer(html_document) { |
12 StatsCollectionObserver::StatsCollectionObserver(RenderViewImpl* render_view) | |
13 : RenderViewObserver(render_view) { | |
14 } | 11 } |
15 | 12 |
16 StatsCollectionObserver::~StatsCollectionObserver() { | 13 StatsCollectionObserver::~StatsCollectionObserver() { |
17 } | 14 } |
18 | 15 |
19 void StatsCollectionObserver::DidStartLoading() { | 16 void StatsCollectionObserver::DidStartLoading() { |
20 DCHECK(start_time_.is_null()); | 17 DCHECK(start_time_.is_null()); |
21 start_time_ = base::Time::Now(); | 18 start_time_ = base::Time::Now(); |
22 } | 19 } |
23 | 20 |
24 void StatsCollectionObserver::DidStopLoading() { | 21 void StatsCollectionObserver::DidStopLoading() { |
25 DCHECK(stop_time_.is_null()); | 22 DCHECK(stop_time_.is_null()); |
26 stop_time_ = base::Time::Now(); | 23 stop_time_ = base::Time::Now(); |
27 | 24 |
28 // Stop observing so we don't get called again. | 25 // Stop observing so we don't get called again. |
29 RenderViewImpl* impl = static_cast<RenderViewImpl*>(render_view()); | 26 html_document()->RemoveObserver(this); |
30 impl->RemoveObserver(this); | |
31 } | 27 } |
32 | 28 |
33 } // namespace content | 29 } // namespace html_viewer |
OLD | NEW |