Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(494)

Side by Side Diff: chrome/browser/ui/webui/log_web_ui_url.cc

Issue 2479593006: Move enable extensions define to a build flag. (Closed)
Patch Set: Merge Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/cookies_tree_model_util.cc ('k') | chrome/browser/ui/webui/log_web_ui_url_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698