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

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

Issue 2248103002: Reland: 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: Properly handle incognito browsing Created 4 years, 4 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 721 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 toolbar
794 // color, as we don't want to allow transparent toolbars. 794 // color, as we don't want to allow transparent toolbars. Same for the
795 if (id == ThemeProperties::COLOR_TOOLBAR) 795 // ntp background color.
796 if (id == ThemeProperties::COLOR_TOOLBAR ||
797 id == ThemeProperties::COLOR_NTP_BACKGROUND) {
796 *color = SkColorSetA(*color, SK_AlphaOPAQUE); 798 *color = SkColorSetA(*color, SK_AlphaOPAQUE);
799 }
797 return true; 800 return true;
798 } 801 }
799 } 802 }
800 } 803 }
801 804
802 return false; 805 return false;
803 } 806 }
804 807
805 bool BrowserThemePack::GetDisplayProperty(int id, int* result) const { 808 bool BrowserThemePack::GetDisplayProperty(int id, int* result) const {
806 if (display_properties_) { 809 if (display_properties_) {
(...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after
1541 false, 1544 false,
1542 &bitmap_data)) { 1545 &bitmap_data)) {
1543 NOTREACHED() << "Unable to encode theme image for prs_id=" 1546 NOTREACHED() << "Unable to encode theme image for prs_id="
1544 << prs_id << " for scale_factor=" << scale_factors_[i]; 1547 << prs_id << " for scale_factor=" << scale_factors_[i];
1545 break; 1548 break;
1546 } 1549 }
1547 image_memory_[scaled_raw_id] = 1550 image_memory_[scaled_raw_id] =
1548 base::RefCountedBytes::TakeVector(&bitmap_data); 1551 base::RefCountedBytes::TakeVector(&bitmap_data);
1549 } 1552 }
1550 } 1553 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/themes/browser_theme_pack_unittest.cc » ('j') | chrome/browser/themes/theme_properties.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698