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 #include "chromecast/browser/cast_resource_dispatcher_host_delegate.h" | 5 #include "chromecast/browser/cast_resource_dispatcher_host_delegate.h" |
6 | 6 |
| 7 #include "chromecast/base/metrics/cast_metrics_helper.h" |
7 #include "chromecast/browser/cast_browser_process.h" | 8 #include "chromecast/browser/cast_browser_process.h" |
8 #include "chromecast/net/connectivity_checker.h" | 9 #include "chromecast/net/connectivity_checker.h" |
9 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
10 #include "net/url_request/url_request.h" | 11 #include "net/url_request/url_request.h" |
11 #include "net/url_request/url_request_status.h" | 12 #include "net/url_request/url_request_status.h" |
12 | 13 |
13 namespace chromecast { | 14 namespace chromecast { |
14 namespace shell { | 15 namespace shell { |
15 | 16 |
16 void CastResourceDispatcherHostDelegate::RequestComplete( | 17 void CastResourceDispatcherHostDelegate::RequestComplete( |
17 net::URLRequest* url_request) { | 18 net::URLRequest* url_request) { |
18 if (url_request->status().status() == net::URLRequestStatus::FAILED) { | 19 if (url_request->status().status() == net::URLRequestStatus::FAILED) { |
| 20 metrics::CastMetricsHelper* metrics_helper = |
| 21 metrics::CastMetricsHelper::GetInstance(); |
| 22 metrics_helper->RecordApplicationEventWithValue( |
| 23 "Cast.Platform.ResourceRequestError", |
| 24 url_request->status().error()); |
19 LOG(ERROR) << "Failed to load resource " << url_request->url() | 25 LOG(ERROR) << "Failed to load resource " << url_request->url() |
20 << "; status:" << url_request->status().status() << ", error:" | 26 << "; status:" << url_request->status().status() << ", error:" |
21 << net::ErrorToShortString(url_request->status().error()); | 27 << net::ErrorToShortString(url_request->status().error()); |
22 CastBrowserProcess::GetInstance()->connectivity_checker()->Check(); | 28 CastBrowserProcess::GetInstance()->connectivity_checker()->Check(); |
23 } | 29 } |
24 } | 30 } |
25 | 31 |
26 } // namespace shell | 32 } // namespace shell |
27 } // namespace chromecast | 33 } // namespace chromecast |
OLD | NEW |