| 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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 return nullptr; | 172 return nullptr; |
| 173 } | 173 } |
| 174 | 174 |
| 175 // If it's not a themeable image, we don't need to go to the UI thread. | 175 // If it's not a themeable image, we don't need to go to the UI thread. |
| 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 { |
| 183 return false; |
| 184 } |
| 185 |
| 182 bool ThemeSource::ShouldServiceRequest(const net::URLRequest* request) const { | 186 bool ThemeSource::ShouldServiceRequest(const net::URLRequest* request) const { |
| 183 return request->url().SchemeIs(chrome::kChromeSearchScheme) ? | 187 return request->url().SchemeIs(chrome::kChromeSearchScheme) ? |
| 184 InstantIOContext::ShouldServiceRequest(request) : | 188 InstantIOContext::ShouldServiceRequest(request) : |
| 185 URLDataSource::ShouldServiceRequest(request); | 189 URLDataSource::ShouldServiceRequest(request); |
| 186 } | 190 } |
| 187 | 191 |
| 188 //////////////////////////////////////////////////////////////////////////////// | 192 //////////////////////////////////////////////////////////////////////////////// |
| 189 // ThemeSource, private: | 193 // ThemeSource, private: |
| 190 | 194 |
| 191 void ThemeSource::SendThemeBitmap( | 195 void ThemeSource::SendThemeBitmap( |
| (...skipping 28 matching lines...) Expand all Loading... |
| 220 } else { | 224 } else { |
| 221 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 225 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
| 222 // Fetching image data in ResourceBundle should happen on the UI thread. See | 226 // Fetching image data in ResourceBundle should happen on the UI thread. See |
| 223 // crbug.com/449277 | 227 // crbug.com/449277 |
| 224 content::BrowserThread::PostTaskAndReply( | 228 content::BrowserThread::PostTaskAndReply( |
| 225 content::BrowserThread::UI, FROM_HERE, | 229 content::BrowserThread::UI, FROM_HERE, |
| 226 base::Bind(&ProcessResourceOnUiThread, resource_id, scale, data), | 230 base::Bind(&ProcessResourceOnUiThread, resource_id, scale, data), |
| 227 base::Bind(callback, data)); | 231 base::Bind(callback, data)); |
| 228 } | 232 } |
| 229 } | 233 } |
| OLD | NEW |