| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/local_ntp_source.h" | 5 #include "chrome/browser/search/local_ntp_source.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/json/json_string_value_serializer.h" | 8 #include "base/json/json_string_value_serializer.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/ref_counted_memory.h" | 10 #include "base/memory/ref_counted_memory.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 bool IsIconNTPEnabled() { | 87 bool IsIconNTPEnabled() { |
| 88 // Note: It's important to query the field trial state first, to ensure that | 88 // Note: It's important to query the field trial state first, to ensure that |
| 89 // UMA reports the correct group. | 89 // UMA reports the correct group. |
| 90 const std::string group_name = base::FieldTrialList::FindFullName("IconNTP"); | 90 const std::string group_name = base::FieldTrialList::FindFullName("IconNTP"); |
| 91 using base::CommandLine; | 91 using base::CommandLine; |
| 92 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableIconNtp)) | 92 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableIconNtp)) |
| 93 return false; | 93 return false; |
| 94 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableIconNtp)) | 94 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableIconNtp)) |
| 95 return true; | 95 return true; |
| 96 | 96 |
| 97 return base::StartsWithASCII(group_name, "Enabled", true); | 97 return base::StartsWith(group_name, "Enabled", base::CompareCase::SENSITIVE); |
| 98 } | 98 } |
| 99 | 99 |
| 100 // Adds a localized string keyed by resource id to the dictionary. | 100 // Adds a localized string keyed by resource id to the dictionary. |
| 101 void AddString(base::DictionaryValue* dictionary, | 101 void AddString(base::DictionaryValue* dictionary, |
| 102 const std::string& key, | 102 const std::string& key, |
| 103 int resource_id) { | 103 int resource_id) { |
| 104 dictionary->SetString(key, l10n_util::GetStringUTF16(resource_id)); | 104 dictionary->SetString(key, l10n_util::GetStringUTF16(resource_id)); |
| 105 } | 105 } |
| 106 | 106 |
| 107 // Adds a localized string for the Google searchbox placeholder text. | 107 // Adds a localized string for the Google searchbox placeholder text. |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 } | 227 } |
| 228 } | 228 } |
| 229 return false; | 229 return false; |
| 230 } | 230 } |
| 231 | 231 |
| 232 std::string LocalNtpSource::GetContentSecurityPolicyFrameSrc() const { | 232 std::string LocalNtpSource::GetContentSecurityPolicyFrameSrc() const { |
| 233 // Allow embedding of most visited iframes. | 233 // Allow embedding of most visited iframes. |
| 234 return base::StringPrintf("frame-src %s;", | 234 return base::StringPrintf("frame-src %s;", |
| 235 chrome::kChromeSearchMostVisitedUrl); | 235 chrome::kChromeSearchMostVisitedUrl); |
| 236 } | 236 } |
| OLD | NEW |