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 "chrome/browser/ui/webui/log_web_ui_url.h" | 5 #include "chrome/browser/ui/webui/log_web_ui_url.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/hash.h" | 9 #include "base/hash.h" |
10 #include "base/metrics/histogram_base.h" | 10 #include "base/metrics/histogram_base.h" |
11 #include "base/metrics/histogram_macros.h" | 11 #include "base/metrics/histogram_macros.h" |
12 #include "chrome/common/url_constants.h" | 12 #include "chrome/common/url_constants.h" |
13 #include "content/public/common/url_constants.h" | 13 #include "content/public/common/url_constants.h" |
| 14 #include "extensions/features/features.h" |
14 #include "url/gurl.h" | 15 #include "url/gurl.h" |
15 | 16 |
16 #if defined(ENABLE_EXTENSIONS) | 17 #if BUILDFLAG(ENABLE_EXTENSIONS) |
17 #include "chrome/common/extensions/extension_constants.h" | 18 #include "chrome/common/extensions/extension_constants.h" |
18 #include "extensions/common/constants.h" | 19 #include "extensions/common/constants.h" |
19 #endif | 20 #endif |
20 | 21 |
21 namespace webui { | 22 namespace webui { |
22 | 23 |
23 const char kWebUICreatedForUrl[] = "WebUI.CreatedForUrl"; | 24 const char kWebUICreatedForUrl[] = "WebUI.CreatedForUrl"; |
24 | 25 |
25 bool LogWebUIUrl(const GURL& web_ui_url) { | 26 bool LogWebUIUrl(const GURL& web_ui_url) { |
26 bool should_log = web_ui_url.SchemeIs(content::kChromeUIScheme) || | 27 bool should_log = web_ui_url.SchemeIs(content::kChromeUIScheme) || |
27 web_ui_url.SchemeIs(content::kChromeDevToolsScheme); | 28 web_ui_url.SchemeIs(content::kChromeDevToolsScheme); |
28 | 29 |
29 #if defined(ENABLE_EXTENSIONS) | 30 #if BUILDFLAG(ENABLE_EXTENSIONS) |
30 if (web_ui_url.SchemeIs(extensions::kExtensionScheme)) | 31 if (web_ui_url.SchemeIs(extensions::kExtensionScheme)) |
31 should_log = web_ui_url.host() == extension_misc::kBookmarkManagerId; | 32 should_log = web_ui_url.host() == extension_misc::kBookmarkManagerId; |
32 #endif | 33 #endif |
33 | 34 |
34 if (should_log) { | 35 if (should_log) { |
35 uint32_t hash = base::Hash(web_ui_url.GetOrigin().spec()); | 36 uint32_t hash = base::Hash(web_ui_url.GetOrigin().spec()); |
36 UMA_HISTOGRAM_SPARSE_SLOWLY(kWebUICreatedForUrl, | 37 UMA_HISTOGRAM_SPARSE_SLOWLY(kWebUICreatedForUrl, |
37 static_cast<base::HistogramBase::Sample>(hash)); | 38 static_cast<base::HistogramBase::Sample>(hash)); |
38 } | 39 } |
39 | 40 |
40 return should_log; | 41 return should_log; |
41 } | 42 } |
42 | 43 |
43 } // namespace webui | 44 } // namespace webui |
OLD | NEW |