OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/search/search.h" | 5 #include "chrome/browser/search/search.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/metrics/field_trial.h" | 8 #include "base/metrics/field_trial.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
674 | 674 |
675 effective_url = effective_url.ReplaceComponents(replacements); | 675 effective_url = effective_url.ReplaceComponents(replacements); |
676 return effective_url; | 676 return effective_url; |
677 } | 677 } |
678 | 678 |
679 bool HandleNewTabURLRewrite(GURL* url, | 679 bool HandleNewTabURLRewrite(GURL* url, |
680 content::BrowserContext* browser_context) { | 680 content::BrowserContext* browser_context) { |
681 if (!IsInstantExtendedAPIEnabled()) | 681 if (!IsInstantExtendedAPIEnabled()) |
682 return false; | 682 return false; |
683 | 683 |
684 if (!url->SchemeIs(chrome::kChromeUIScheme) || | 684 if (!url->SchemeIs(content::kChromeUIScheme) || |
685 url->host() != chrome::kChromeUINewTabHost) | 685 url->host() != chrome::kChromeUINewTabHost) |
686 return false; | 686 return false; |
687 | 687 |
688 Profile* profile = Profile::FromBrowserContext(browser_context); | 688 Profile* profile = Profile::FromBrowserContext(browser_context); |
689 NewTabURLDetails details(NewTabURLDetails::ForProfile(profile)); | 689 NewTabURLDetails details(NewTabURLDetails::ForProfile(profile)); |
690 UMA_HISTOGRAM_ENUMERATION("NewTabPage.URLState", | 690 UMA_HISTOGRAM_ENUMERATION("NewTabPage.URLState", |
691 details.state, NEW_TAB_URL_MAX); | 691 details.state, NEW_TAB_URL_MAX); |
692 if (details.url.is_valid()) { | 692 if (details.url.is_valid()) { |
693 *url = details.url; | 693 *url = details.url; |
694 return true; | 694 return true; |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
808 | 808 |
809 // Given a FieldTrialFlags object, returns the boolean value of the provided | 809 // Given a FieldTrialFlags object, returns the boolean value of the provided |
810 // flag. | 810 // flag. |
811 bool GetBoolValueForFlagWithDefault(const std::string& flag, | 811 bool GetBoolValueForFlagWithDefault(const std::string& flag, |
812 bool default_value, | 812 bool default_value, |
813 const FieldTrialFlags& flags) { | 813 const FieldTrialFlags& flags) { |
814 return !!GetUInt64ValueForFlagWithDefault(flag, default_value ? 1 : 0, flags); | 814 return !!GetUInt64ValueForFlagWithDefault(flag, default_value ? 1 : 0, flags); |
815 } | 815 } |
816 | 816 |
817 } // namespace chrome | 817 } // namespace chrome |
OLD | NEW |