OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/browser_theme_provider.h" | 5 #include "chrome/browser/browser_theme_provider.h" |
6 | 6 |
7 #include "app/gfx/codec/png_codec.h" | 7 #include "app/gfx/codec/png_codec.h" |
8 #include "app/gfx/skbitmap_operations.h" | 8 #include "app/gfx/skbitmap_operations.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/stl_util-inl.h" | 10 #include "base/stl_util-inl.h" |
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 void BrowserThemeProvider::SetTheme(Extension* extension) { | 463 void BrowserThemeProvider::SetTheme(Extension* extension) { |
464 // Clear our image cache. | 464 // Clear our image cache. |
465 ClearCaches(); | 465 ClearCaches(); |
466 | 466 |
467 DCHECK(extension); | 467 DCHECK(extension); |
468 DCHECK(extension->IsTheme()); | 468 DCHECK(extension->IsTheme()); |
469 SetImageData(extension->GetThemeImages(), | 469 SetImageData(extension->GetThemeImages(), |
470 extension->path()); | 470 extension->path()); |
471 SetColorData(extension->GetThemeColors()); | 471 SetColorData(extension->GetThemeColors()); |
472 SetTintData(extension->GetThemeTints()); | 472 SetTintData(extension->GetThemeTints()); |
| 473 |
| 474 // Drop out to default theme if the theme data is empty. |
| 475 if (images_.empty() && colors_.empty() && tints_.empty()) { |
| 476 UseDefaultTheme(); |
| 477 return; |
| 478 } |
| 479 |
473 SetDisplayPropertyData(extension->GetThemeDisplayProperties()); | 480 SetDisplayPropertyData(extension->GetThemeDisplayProperties()); |
474 raw_data_.clear(); | 481 raw_data_.clear(); |
475 | 482 |
476 SaveImageData(extension->GetThemeImages()); | 483 SaveImageData(extension->GetThemeImages()); |
477 SaveColorData(); | 484 SaveColorData(); |
478 SaveTintData(); | 485 SaveTintData(); |
479 SaveDisplayPropertyData(); | 486 SaveDisplayPropertyData(); |
480 SaveThemeID(extension->id()); | 487 SaveThemeID(extension->id()); |
481 | 488 |
482 // Process all images when we first set theme. | 489 // Process all images when we first set theme. |
(...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1277 } | 1284 } |
1278 | 1285 |
1279 bool BrowserThemeProvider::ShouldTintFrames() const { | 1286 bool BrowserThemeProvider::ShouldTintFrames() const { |
1280 return (HasCustomImage(IDR_THEME_FRAME) || | 1287 return (HasCustomImage(IDR_THEME_FRAME) || |
1281 tints_.count(GetTintKey(TINT_BACKGROUND_TAB)) || | 1288 tints_.count(GetTintKey(TINT_BACKGROUND_TAB)) || |
1282 tints_.count(GetTintKey(TINT_FRAME)) || | 1289 tints_.count(GetTintKey(TINT_FRAME)) || |
1283 tints_.count(GetTintKey(TINT_FRAME_INACTIVE)) || | 1290 tints_.count(GetTintKey(TINT_FRAME_INACTIVE)) || |
1284 tints_.count(GetTintKey(TINT_FRAME_INCOGNITO)) || | 1291 tints_.count(GetTintKey(TINT_FRAME_INCOGNITO)) || |
1285 tints_.count(GetTintKey(TINT_FRAME_INCOGNITO_INACTIVE))); | 1292 tints_.count(GetTintKey(TINT_FRAME_INCOGNITO_INACTIVE))); |
1286 } | 1293 } |
OLD | NEW |