Chromium Code Reviews| 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/json/json_string_value_serializer.h" | 7 #include "base/json/json_string_value_serializer.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/memory/ref_counted_memory.h" | 9 #include "base/memory/ref_counted_memory.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 142 const std::string& path, | 142 const std::string& path, |
| 143 int render_process_id, | 143 int render_process_id, |
| 144 int render_frame_id, | 144 int render_frame_id, |
| 145 const content::URLDataSource::GotDataCallback& callback) { | 145 const content::URLDataSource::GotDataCallback& callback) { |
| 146 const std::string stripped_path = StripParameters(path); | 146 const std::string stripped_path = StripParameters(path); |
| 147 if (stripped_path == kConfigDataFilename) { | 147 if (stripped_path == kConfigDataFilename) { |
| 148 std::string config_data_js = GetConfigData(profile_); | 148 std::string config_data_js = GetConfigData(profile_); |
| 149 callback.Run(base::RefCountedString::TakeString(&config_data_js)); | 149 callback.Run(base::RefCountedString::TakeString(&config_data_js)); |
| 150 return; | 150 return; |
| 151 } | 151 } |
| 152 ui::ScaleFactor scale_factor; | 152 float scale; |
|
pkotwicz
2014/05/20 03:31:19
Nit: default initialize
oshima
2014/05/20 18:23:28
Done.
| |
| 153 std::string filename; | 153 std::string filename; |
| 154 webui::ParsePathAndScale( | 154 webui::ParsePathAndScale( |
| 155 GURL(GetLocalNtpPath() + stripped_path), &filename, &scale_factor); | 155 GURL(GetLocalNtpPath() + stripped_path), &filename, &scale); |
| 156 ui::ScaleFactor scale_factor = ui::GetSupportedScaleFactor(scale); | |
| 156 for (size_t i = 0; i < arraysize(kResources); ++i) { | 157 for (size_t i = 0; i < arraysize(kResources); ++i) { |
| 157 if (filename == kResources[i].filename) { | 158 if (filename == kResources[i].filename) { |
| 158 scoped_refptr<base::RefCountedStaticMemory> response( | 159 scoped_refptr<base::RefCountedStaticMemory> response( |
| 159 ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale( | 160 ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale( |
| 160 kResources[i].identifier, scale_factor)); | 161 kResources[i].identifier, scale_factor)); |
| 161 callback.Run(response.get()); | 162 callback.Run(response.get()); |
| 162 return; | 163 return; |
| 163 } | 164 } |
| 164 } | 165 } |
| 165 callback.Run(NULL); | 166 callback.Run(NULL); |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 190 } | 191 } |
| 191 } | 192 } |
| 192 return false; | 193 return false; |
| 193 } | 194 } |
| 194 | 195 |
| 195 std::string LocalNtpSource::GetContentSecurityPolicyFrameSrc() const { | 196 std::string LocalNtpSource::GetContentSecurityPolicyFrameSrc() const { |
| 196 // Allow embedding of most visited iframes. | 197 // Allow embedding of most visited iframes. |
| 197 return base::StringPrintf("frame-src %s;", | 198 return base::StringPrintf("frame-src %s;", |
| 198 chrome::kChromeSearchMostVisitedUrl); | 199 chrome::kChromeSearchMostVisitedUrl); |
| 199 } | 200 } |
| OLD | NEW |