| 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.h" | 8 #include "base/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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 webui::ParsePathAndScale(GURL(GetThemePath() + path), &uncached_path, NULL); | 90 webui::ParsePathAndScale(GURL(GetThemePath() + path), &uncached_path, NULL); |
| 91 | 91 |
| 92 if (uncached_path == kNewTabCSSPath || | 92 if (uncached_path == kNewTabCSSPath || |
| 93 uncached_path == kNewIncognitoTabCSSPath) { | 93 uncached_path == kNewIncognitoTabCSSPath) { |
| 94 return "text/css"; | 94 return "text/css"; |
| 95 } | 95 } |
| 96 | 96 |
| 97 return "image/png"; | 97 return "image/png"; |
| 98 } | 98 } |
| 99 | 99 |
| 100 MessageLoop* ThemeSource::MessageLoopForRequestPath( | 100 base::MessageLoop* ThemeSource::MessageLoopForRequestPath( |
| 101 const std::string& path) const { | 101 const std::string& path) const { |
| 102 std::string uncached_path; | 102 std::string uncached_path; |
| 103 webui::ParsePathAndScale(GURL(GetThemePath() + path), &uncached_path, NULL); | 103 webui::ParsePathAndScale(GURL(GetThemePath() + path), &uncached_path, NULL); |
| 104 | 104 |
| 105 if (uncached_path == kNewTabCSSPath || | 105 if (uncached_path == kNewTabCSSPath || |
| 106 uncached_path == kNewIncognitoTabCSSPath) { | 106 uncached_path == kNewIncognitoTabCSSPath) { |
| 107 // We generated and cached this when we initialized the object. We don't | 107 // We generated and cached this when we initialized the object. We don't |
| 108 // have to go back to the UI thread to send the data. | 108 // have to go back to the UI thread to send the data. |
| 109 return NULL; | 109 return NULL; |
| 110 } | 110 } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 | 143 |
| 144 scoped_refptr<base::RefCountedMemory> image_data(tp->GetRawData( | 144 scoped_refptr<base::RefCountedMemory> image_data(tp->GetRawData( |
| 145 resource_id, scale_factor)); | 145 resource_id, scale_factor)); |
| 146 callback.Run(image_data); | 146 callback.Run(image_data); |
| 147 } else { | 147 } else { |
| 148 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 148 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 149 const ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 149 const ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 150 callback.Run(rb.LoadDataResourceBytesForScale(resource_id, scale_factor)); | 150 callback.Run(rb.LoadDataResourceBytesForScale(resource_id, scale_factor)); |
| 151 } | 151 } |
| 152 } | 152 } |
| OLD | NEW |