| 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/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 // ThemeSource, private: | 122 // ThemeSource, private: |
| 123 | 123 |
| 124 void ThemeSource::SendThemeBitmap(int request_id, | 124 void ThemeSource::SendThemeBitmap(int request_id, |
| 125 int resource_id, | 125 int resource_id, |
| 126 ui::ScaleFactor scale_factor) { | 126 ui::ScaleFactor scale_factor) { |
| 127 if (ThemeService::IsThemeableImage(resource_id)) { | 127 if (ThemeService::IsThemeableImage(resource_id)) { |
| 128 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 128 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 129 ui::ThemeProvider* tp = ThemeServiceFactory::GetForProfile(profile_); | 129 ui::ThemeProvider* tp = ThemeServiceFactory::GetForProfile(profile_); |
| 130 DCHECK(tp); | 130 DCHECK(tp); |
| 131 | 131 |
| 132 // TODO(flackr): Pass scale factor when fetching themeable images. | |
| 133 scoped_refptr<base::RefCountedMemory> image_data(tp->GetRawData( | 132 scoped_refptr<base::RefCountedMemory> image_data(tp->GetRawData( |
| 134 resource_id)); | 133 resource_id, scale_factor)); |
| 135 SendResponse(request_id, image_data); | 134 SendResponse(request_id, image_data); |
| 136 } else { | 135 } else { |
| 137 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 136 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 138 const ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 137 const ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 139 SendResponse(request_id, | 138 SendResponse(request_id, |
| 140 rb.LoadDataResourceBytes(resource_id, scale_factor)); | 139 rb.LoadDataResourceBytes(resource_id, scale_factor)); |
| 141 } | 140 } |
| 142 } | 141 } |
| OLD | NEW |