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/themes/browser_theme_pack.h" | 5 #include "chrome/browser/themes/browser_theme_pack.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "base/memory/ref_counted_memory.h" | 9 #include "base/memory/ref_counted_memory.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 } | 373 } |
374 | 374 |
375 // static | 375 // static |
376 scoped_refptr<BrowserThemePack> BrowserThemePack::BuildFromDataPack( | 376 scoped_refptr<BrowserThemePack> BrowserThemePack::BuildFromDataPack( |
377 FilePath path, const std::string& expected_id) { | 377 FilePath path, const std::string& expected_id) { |
378 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 378 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
379 // Allow IO on UI thread due to deep-seated theme design issues. | 379 // Allow IO on UI thread due to deep-seated theme design issues. |
380 // (see http://crbug.com/80206) | 380 // (see http://crbug.com/80206) |
381 base::ThreadRestrictions::ScopedAllowIO allow_io; | 381 base::ThreadRestrictions::ScopedAllowIO allow_io; |
382 scoped_refptr<BrowserThemePack> pack(new BrowserThemePack); | 382 scoped_refptr<BrowserThemePack> pack(new BrowserThemePack); |
383 pack->data_pack_.reset(new ui::DataPack); | 383 pack->data_pack_.reset( |
| 384 new ui::DataPack(ui::ResourceHandle::kScaleFactor100x)); |
384 | 385 |
385 if (!pack->data_pack_->Load(path)) { | 386 if (!pack->data_pack_->Load(path)) { |
386 LOG(ERROR) << "Failed to load theme data pack."; | 387 LOG(ERROR) << "Failed to load theme data pack."; |
387 return NULL; | 388 return NULL; |
388 } | 389 } |
389 | 390 |
390 base::StringPiece pointer; | 391 base::StringPiece pointer; |
391 if (!pack->data_pack_->GetStringPiece(kHeaderID, &pointer)) | 392 if (!pack->data_pack_->GetStringPiece(kHeaderID, &pointer)) |
392 return NULL; | 393 return NULL; |
393 pack->header_ = reinterpret_cast<BrowserThemePackHeader*>(const_cast<char*>( | 394 pack->header_ = reinterpret_cast<BrowserThemePackHeader*>(const_cast<char*>( |
(...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1070 hsl.h = tints_[i].h; | 1071 hsl.h = tints_[i].h; |
1071 hsl.s = tints_[i].s; | 1072 hsl.s = tints_[i].s; |
1072 hsl.l = tints_[i].l; | 1073 hsl.l = tints_[i].l; |
1073 return hsl; | 1074 return hsl; |
1074 } | 1075 } |
1075 } | 1076 } |
1076 } | 1077 } |
1077 | 1078 |
1078 return ThemeService::GetDefaultTint(id); | 1079 return ThemeService::GetDefaultTint(id); |
1079 } | 1080 } |
OLD | NEW |