OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/ui/webui/theme_source.h" | 5 #include "chrome/browser/ui/webui/theme_source.h" |
6 | 6 |
7 #include "base/memory/ref_counted_memory.h" | 7 #include "base/memory/ref_counted_memory.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 int resource_id = ResourcesUtil::GetThemeResourceId(parsed_path); | 176 int resource_id = ResourcesUtil::GetThemeResourceId(parsed_path); |
177 return BrowserThemePack::IsPersistentImageID(resource_id) | 177 return BrowserThemePack::IsPersistentImageID(resource_id) |
178 ? content::URLDataSource::TaskRunnerForRequestPath(path) | 178 ? content::URLDataSource::TaskRunnerForRequestPath(path) |
179 : nullptr; | 179 : nullptr; |
180 } | 180 } |
181 | 181 |
182 bool ThemeSource::AllowCaching() const { | 182 bool ThemeSource::AllowCaching() const { |
183 return false; | 183 return false; |
184 } | 184 } |
185 | 185 |
186 bool ThemeSource::ShouldServiceRequest(const net::URLRequest* request) const { | 186 bool ThemeSource::ShouldServiceRequest( |
187 return request->url().SchemeIs(chrome::kChromeSearchScheme) ? | 187 const GURL& url, |
188 InstantIOContext::ShouldServiceRequest(request) : | 188 content::ResourceContext* resource_context, |
189 URLDataSource::ShouldServiceRequest(request); | 189 int render_process_id) const { |
| 190 return url.SchemeIs(chrome::kChromeSearchScheme) |
| 191 ? InstantIOContext::ShouldServiceRequest(url, resource_context, |
| 192 render_process_id) |
| 193 : URLDataSource::ShouldServiceRequest(url, resource_context, |
| 194 render_process_id); |
190 } | 195 } |
191 | 196 |
192 //////////////////////////////////////////////////////////////////////////////// | 197 //////////////////////////////////////////////////////////////////////////////// |
193 // ThemeSource, private: | 198 // ThemeSource, private: |
194 | 199 |
195 void ThemeSource::SendThemeBitmap( | 200 void ThemeSource::SendThemeBitmap( |
196 const content::URLDataSource::GotDataCallback& callback, | 201 const content::URLDataSource::GotDataCallback& callback, |
197 int resource_id, | 202 int resource_id, |
198 float scale) { | 203 float scale) { |
199 ui::ScaleFactor scale_factor = ui::GetSupportedScaleFactor(scale); | 204 ui::ScaleFactor scale_factor = ui::GetSupportedScaleFactor(scale); |
(...skipping 24 matching lines...) Expand all Loading... |
224 } else { | 229 } else { |
225 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 230 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
226 // Fetching image data in ResourceBundle should happen on the UI thread. See | 231 // Fetching image data in ResourceBundle should happen on the UI thread. See |
227 // crbug.com/449277 | 232 // crbug.com/449277 |
228 content::BrowserThread::PostTaskAndReply( | 233 content::BrowserThread::PostTaskAndReply( |
229 content::BrowserThread::UI, FROM_HERE, | 234 content::BrowserThread::UI, FROM_HERE, |
230 base::BindOnce(&ProcessResourceOnUiThread, resource_id, scale, data), | 235 base::BindOnce(&ProcessResourceOnUiThread, resource_id, scale, data), |
231 base::BindOnce(callback, data)); | 236 base::BindOnce(callback, data)); |
232 } | 237 } |
233 } | 238 } |
OLD | NEW |