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