Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Side by Side Diff: chrome/browser/themes/browser_theme_pack.cc

Issue 2062353002: Replace CONTROL_BACKGROUND and DETACHED_BOOKMARK_BAR_BACKGROUND by COLOR_NTP_BACKGROUND (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and force opaque for color_ntp_background from the theme machinery Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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.h> 7 #include <limits.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <limits> 10 #include <limits>
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 42
43 using content::BrowserThread; 43 using content::BrowserThread;
44 using extensions::Extension; 44 using extensions::Extension;
45 45
46 namespace { 46 namespace {
47 47
48 // Version number of the current theme pack. We just throw out and rebuild 48 // Version number of the current theme pack. We just throw out and rebuild
49 // theme packs that aren't int-equal to this. Increment this number if you 49 // theme packs that aren't int-equal to this. Increment this number if you
50 // change default theme assets or if you need themes to recreate their generated 50 // change default theme assets or if you need themes to recreate their generated
51 // images (which are cached). 51 // images (which are cached).
52 const int kThemePackVersion = 42; 52 const int kThemePackVersion = 43;
53 53
54 // IDs that are in the DataPack won't clash with the positive integer 54 // IDs that are in the DataPack won't clash with the positive integer
55 // uint16_t. kHeaderID should always have the maximum value because we want the 55 // uint16_t. kHeaderID should always have the maximum value because we want the
56 // "header" to be written last. That way we can detect whether the pack was 56 // "header" to be written last. That way we can detect whether the pack was
57 // successfully written and ignore and regenerate if it was only partially 57 // successfully written and ignore and regenerate if it was only partially
58 // written (i.e. chrome crashed on a different thread while writing the pack). 58 // written (i.e. chrome crashed on a different thread while writing the pack).
59 const int kMaxID = 0x0000FFFF; // Max unsigned 16-bit int. 59 const int kMaxID = 0x0000FFFF; // Max unsigned 16-bit int.
60 const int kHeaderID = kMaxID - 1; 60 const int kHeaderID = kMaxID - 1;
61 const int kTintsID = kMaxID - 2; 61 const int kTintsID = kMaxID - 2;
62 const int kColorsID = kMaxID - 3; 62 const int kColorsID = kMaxID - 3;
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after
783 } 783 }
784 784
785 return false; 785 return false;
786 } 786 }
787 787
788 bool BrowserThemePack::GetColor(int id, SkColor* color) const { 788 bool BrowserThemePack::GetColor(int id, SkColor* color) const {
789 if (colors_) { 789 if (colors_) {
790 for (size_t i = 0; i < kColorTableLength; ++i) { 790 for (size_t i = 0; i < kColorTableLength; ++i) {
791 if (colors_[i].id == id) { 791 if (colors_[i].id == id) {
792 *color = colors_[i].color; 792 *color = colors_[i].color;
793 // The theme provider is intentionally made to ignore alpha for toolbar 793 // The theme provider is intentionally made to ignore alpha for the
794 // color, as we don't want to allow transparent toolbars. 794 // following colors as we don't want to allow them to be transparent.
795 if (id == ThemeProperties::COLOR_TOOLBAR) 795 switch (id) {
796 *color = SkColorSetA(*color, SK_AlphaOPAQUE); 796 case ThemeProperties::COLOR_TOOLBAR:
797 case ThemeProperties::COLOR_NTP_BACKGROUND:
Peter Kasting 2016/07/11 01:41:57 Nit: This is fine, but I probably would have just
Julien Isorce Samsung 2016/07/13 15:01:32 Done.
798 *color = SkColorSetA(*color, SK_AlphaOPAQUE);
799 break;
800 }
801
797 return true; 802 return true;
798 } 803 }
799 } 804 }
800 } 805 }
801 806
802 return false; 807 return false;
803 } 808 }
804 809
805 bool BrowserThemePack::GetDisplayProperty(int id, int* result) const { 810 bool BrowserThemePack::GetDisplayProperty(int id, int* result) const {
806 if (display_properties_) { 811 if (display_properties_) {
(...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after
1541 false, 1546 false,
1542 &bitmap_data)) { 1547 &bitmap_data)) {
1543 NOTREACHED() << "Unable to encode theme image for prs_id=" 1548 NOTREACHED() << "Unable to encode theme image for prs_id="
1544 << prs_id << " for scale_factor=" << scale_factors_[i]; 1549 << prs_id << " for scale_factor=" << scale_factors_[i];
1545 break; 1550 break;
1546 } 1551 }
1547 image_memory_[scaled_raw_id] = 1552 image_memory_[scaled_raw_id] =
1548 base::RefCountedBytes::TakeVector(&bitmap_data); 1553 base::RefCountedBytes::TakeVector(&bitmap_data);
1549 } 1554 }
1550 } 1555 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698