| 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/base64.h" | 7 #include "base/base64.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/feature_list.h" | 9 #include "base/feature_list.h" |
| 10 #include "base/json/json_string_value_serializer.h" | 10 #include "base/json/json_string_value_serializer.h" |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 // While live-editing the local NTP files, turn off CSP. | 415 // While live-editing the local NTP files, turn off CSP. |
| 416 return "script-src *;"; | 416 return "script-src *;"; |
| 417 } | 417 } |
| 418 #endif // !defined(GOOGLE_CHROME_BUILD) | 418 #endif // !defined(GOOGLE_CHROME_BUILD) |
| 419 | 419 |
| 420 return "script-src 'strict-dynamic' " | 420 return "script-src 'strict-dynamic' " |
| 421 "'sha256-" + | 421 "'sha256-" + |
| 422 GetIntegritySha256Value( | 422 GetIntegritySha256Value( |
| 423 GetConfigData(default_search_provider_is_google_io_thread_)) + | 423 GetConfigData(default_search_provider_is_google_io_thread_)) + |
| 424 "' " | 424 "' " |
| 425 "'sha256-ROPmcormZEipZzy3Ff+o345FFrhHWsAZjBpGIyZzCYY=';"; | 425 "'sha256-yAvSu2Dl9rlQTpQn8P1hcE5GUFQVGbuCMHypwtN6uDg=';"; |
| 426 } | 426 } |
| 427 | 427 |
| 428 std::string LocalNtpSource::GetContentSecurityPolicyChildSrc() const { | 428 std::string LocalNtpSource::GetContentSecurityPolicyChildSrc() const { |
| 429 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 429 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
| 430 | 430 |
| 431 if (one_google_bar_service_) { | 431 if (one_google_bar_service_) { |
| 432 // Allow embedding of the most visited iframe, as well as the account | 432 // Allow embedding of the most visited iframe, as well as the account |
| 433 // switcher and the notifications dropdown from the One Google Bar. | 433 // switcher and the notifications dropdown from the One Google Bar. |
| 434 // TODO(treib): Figure out a way to also allow staging instances. | 434 // TODO(treib): Figure out a way to also allow staging instances. |
| 435 return base::StringPrintf( | 435 return base::StringPrintf( |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 base::Bind(&LocalNtpSource::SetDefaultSearchProviderIsGoogleOnIOThread, | 490 base::Bind(&LocalNtpSource::SetDefaultSearchProviderIsGoogleOnIOThread, |
| 491 weak_ptr_factory_.GetWeakPtr(), is_google)); | 491 weak_ptr_factory_.GetWeakPtr(), is_google)); |
| 492 } | 492 } |
| 493 | 493 |
| 494 void LocalNtpSource::SetDefaultSearchProviderIsGoogleOnIOThread( | 494 void LocalNtpSource::SetDefaultSearchProviderIsGoogleOnIOThread( |
| 495 bool is_google) { | 495 bool is_google) { |
| 496 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 496 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
| 497 | 497 |
| 498 default_search_provider_is_google_io_thread_ = is_google; | 498 default_search_provider_is_google_io_thread_ = is_google; |
| 499 } | 499 } |
| OLD | NEW |