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

Side by Side Diff: chrome/browser/search/local_ntp_source.cc

Issue 291733004: Reduce the use of ui::ScaleFactor in webui/favicon (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 months 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 | Annotate | Revision Log
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/webui/favicon_source.cc » ('j') | chrome/browser/ui/webui/favicon_source.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698