OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/themes/browser_theme_pack.h" | 5 #include "chrome/browser/themes/browser_theme_pack.h" |
6 | 6 |
7 #include "app/resource_bundle.h" | 7 #include "app/resource_bundle.h" |
8 #include "base/data_pack.h" | 8 #include "base/data_pack.h" |
9 #include "base/stl_util-inl.h" | 9 #include "base/stl_util-inl.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| 11 #include "base/thread_restrictions.h" |
11 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
12 #include "base/values.h" | 13 #include "base/values.h" |
13 #include "chrome/browser/browser_thread.h" | 14 #include "chrome/browser/browser_thread.h" |
14 #include "chrome/browser/themes/browser_theme_provider.h" | 15 #include "chrome/browser/themes/browser_theme_provider.h" |
15 #include "gfx/codec/png_codec.h" | 16 #include "gfx/codec/png_codec.h" |
16 #include "gfx/skbitmap_operations.h" | 17 #include "gfx/skbitmap_operations.h" |
17 #include "grit/app_resources.h" | 18 #include "grit/app_resources.h" |
18 #include "grit/theme_resources.h" | 19 #include "grit/theme_resources.h" |
19 #include "net/base/file_stream.h" | 20 #include "net/base/file_stream.h" |
20 #include "net/base/net_errors.h" | 21 #include "net/base/net_errors.h" |
(...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
835 } | 836 } |
836 | 837 |
837 source_images_ = new int[ids.size() + 1]; | 838 source_images_ = new int[ids.size() + 1]; |
838 std::copy(ids.begin(), ids.end(), source_images_); | 839 std::copy(ids.begin(), ids.end(), source_images_); |
839 source_images_[ids.size()] = -1; | 840 source_images_[ids.size()] = -1; |
840 } | 841 } |
841 | 842 |
842 bool BrowserThemePack::LoadRawBitmapsTo( | 843 bool BrowserThemePack::LoadRawBitmapsTo( |
843 const FilePathMap& file_paths, | 844 const FilePathMap& file_paths, |
844 ImageCache* raw_bitmaps) { | 845 ImageCache* raw_bitmaps) { |
| 846 // Themes should be loaded on the file thread, not the UI thread. |
| 847 // http://crbug.com/61838 |
| 848 base::ThreadRestrictions::ScopedAllowIO allow_io; |
| 849 |
845 for (FilePathMap::const_iterator it = file_paths.begin(); | 850 for (FilePathMap::const_iterator it = file_paths.begin(); |
846 it != file_paths.end(); ++it) { | 851 it != file_paths.end(); ++it) { |
847 scoped_refptr<RefCountedMemory> raw_data(ReadFileData(it->second)); | 852 scoped_refptr<RefCountedMemory> raw_data(ReadFileData(it->second)); |
848 if (!raw_data.get()) { | 853 if (!raw_data.get()) { |
849 LOG(ERROR) << "Could not load theme image"; | 854 LOG(ERROR) << "Could not load theme image"; |
850 return false; | 855 return false; |
851 } | 856 } |
852 | 857 |
853 int id = it->first; | 858 int id = it->first; |
854 | 859 |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1036 hsl.h = tints_[i].h; | 1041 hsl.h = tints_[i].h; |
1037 hsl.s = tints_[i].s; | 1042 hsl.s = tints_[i].s; |
1038 hsl.l = tints_[i].l; | 1043 hsl.l = tints_[i].l; |
1039 return hsl; | 1044 return hsl; |
1040 } | 1045 } |
1041 } | 1046 } |
1042 } | 1047 } |
1043 | 1048 |
1044 return BrowserThemeProvider::GetDefaultTint(id); | 1049 return BrowserThemeProvider::GetDefaultTint(id); |
1045 } | 1050 } |
OLD | NEW |