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

Side by Side Diff: chrome/browser/browser_theme_provider.cc

Issue 160093: Let theme values that previous had to be real be specified as ints.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/common/extensions/extension.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/gfx/png_decoder.h" 7 #include "base/gfx/png_decoder.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "chrome/browser/browser_list.h" 10 #include "chrome/browser/browser_list.h"
(...skipping 21 matching lines...) Expand all
32 32
33 // Strings used by themes to identify colors for different parts of our UI. 33 // Strings used by themes to identify colors for different parts of our UI.
34 const char* BrowserThemeProvider::kColorFrame = "frame"; 34 const char* BrowserThemeProvider::kColorFrame = "frame";
35 const char* BrowserThemeProvider::kColorFrameInactive = "frame_inactive"; 35 const char* BrowserThemeProvider::kColorFrameInactive = "frame_inactive";
36 const char* BrowserThemeProvider::kColorFrameIncognito = "frame_incognito"; 36 const char* BrowserThemeProvider::kColorFrameIncognito = "frame_incognito";
37 const char* BrowserThemeProvider::kColorFrameIncognitoInactive = 37 const char* BrowserThemeProvider::kColorFrameIncognitoInactive =
38 "frame_incognito_inactive"; 38 "frame_incognito_inactive";
39 const char* BrowserThemeProvider::kColorToolbar = "toolbar"; 39 const char* BrowserThemeProvider::kColorToolbar = "toolbar";
40 const char* BrowserThemeProvider::kColorTabText = "tab_text"; 40 const char* BrowserThemeProvider::kColorTabText = "tab_text";
41 const char* BrowserThemeProvider::kColorBackgroundTabText = 41 const char* BrowserThemeProvider::kColorBackgroundTabText =
42 "background_tab_text"; 42 "tab_background_text";
43 const char* BrowserThemeProvider::kColorBookmarkText = "bookmark_text"; 43 const char* BrowserThemeProvider::kColorBookmarkText = "bookmark_text";
44 const char* BrowserThemeProvider::kColorNTPBackground = "ntp_background"; 44 const char* BrowserThemeProvider::kColorNTPBackground = "ntp_background";
45 const char* BrowserThemeProvider::kColorNTPText = "ntp_text"; 45 const char* BrowserThemeProvider::kColorNTPText = "ntp_text";
46 const char* BrowserThemeProvider::kColorNTPLink = "ntp_link"; 46 const char* BrowserThemeProvider::kColorNTPLink = "ntp_link";
47 const char* BrowserThemeProvider::kColorNTPSection = "ntp_section"; 47 const char* BrowserThemeProvider::kColorNTPSection = "ntp_section";
48 const char* BrowserThemeProvider::kColorNTPSectionText = "ntp_section_text"; 48 const char* BrowserThemeProvider::kColorNTPSectionText = "ntp_section_text";
49 const char* BrowserThemeProvider::kColorNTPSectionLink = "ntp_section_link"; 49 const char* BrowserThemeProvider::kColorNTPSectionLink = "ntp_section_link";
50 const char* BrowserThemeProvider::kColorControlBackground = 50 const char* BrowserThemeProvider::kColorControlBackground =
51 "control_background"; 51 "control_background";
52 const char* BrowserThemeProvider::kColorButtonBackground = "button_background"; 52 const char* BrowserThemeProvider::kColorButtonBackground = "button_background";
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 while (iter != colors_value->end_keys()) { 529 while (iter != colors_value->end_keys()) {
530 ListValue* color_list; 530 ListValue* color_list;
531 if (colors_value->GetList(*iter, &color_list) && 531 if (colors_value->GetList(*iter, &color_list) &&
532 (color_list->GetSize() == 3 || color_list->GetSize() == 4)) { 532 (color_list->GetSize() == 3 || color_list->GetSize() == 4)) {
533 int r, g, b; 533 int r, g, b;
534 color_list->GetInteger(0, &r); 534 color_list->GetInteger(0, &r);
535 color_list->GetInteger(1, &g); 535 color_list->GetInteger(1, &g);
536 color_list->GetInteger(2, &b); 536 color_list->GetInteger(2, &b);
537 if (color_list->GetSize() == 4) { 537 if (color_list->GetSize() == 4) {
538 double alpha; 538 double alpha;
539 color_list->GetReal(3, &alpha); 539 int alpha_int;
540 colors_[WideToUTF8(*iter)] = SkColorSetARGB( 540 if (color_list->GetReal(3, &alpha)) {
541 static_cast<int>(alpha * 255), r, g, b); 541 colors_[WideToUTF8(*iter)] = SkColorSetARGB(
542 static_cast<int>(alpha * 255), r, g, b);
543 } else if (color_list->GetInteger(3, &alpha_int)) {
544 colors_[WideToUTF8(*iter)] = SkColorSetARGB(
545 alpha_int * 255, r, g, b);
546 }
542 } else { 547 } else {
543 colors_[WideToUTF8(*iter)] = SkColorSetRGB(r, g, b); 548 colors_[WideToUTF8(*iter)] = SkColorSetRGB(r, g, b);
544 } 549 }
545 } 550 }
546 ++iter; 551 ++iter;
547 } 552 }
548 } 553 }
549 554
550 void BrowserThemeProvider::SetTintData(DictionaryValue* tints_value) { 555 void BrowserThemeProvider::SetTintData(DictionaryValue* tints_value) {
551 tints_.clear(); 556 tints_.clear();
552 557
553 if (!tints_value) 558 if (!tints_value)
554 return; 559 return;
555 560
556 DictionaryValue::key_iterator iter = tints_value->begin_keys(); 561 DictionaryValue::key_iterator iter = tints_value->begin_keys();
557 while (iter != tints_value->end_keys()) { 562 while (iter != tints_value->end_keys()) {
558 ListValue* tint_list; 563 ListValue* tint_list;
559 if (tints_value->GetList(*iter, &tint_list) && 564 if (tints_value->GetList(*iter, &tint_list) &&
560 tint_list->GetSize() == 3) { 565 tint_list->GetSize() == 3) {
561 skia::HSL hsl = { -1, -1, -1 }; 566 skia::HSL hsl = { -1, -1, -1 };
562 // TODO(glen): Make this work with integer values. 567 int value = 0;
563 tint_list->GetReal(0, &hsl.h); 568 if (!tint_list->GetReal(0, &hsl.h) && tint_list->GetInteger(0, &value))
564 tint_list->GetReal(1, &hsl.s); 569 hsl.h = value;
565 tint_list->GetReal(2, &hsl.l); 570 if (!tint_list->GetReal(1, &hsl.s) && tint_list->GetInteger(1, &value))
571 hsl.s = value;
572 if (!tint_list->GetReal(2, &hsl.l) && tint_list->GetInteger(2, &value))
573 hsl.l = value;
574
566 tints_[WideToUTF8(*iter)] = hsl; 575 tints_[WideToUTF8(*iter)] = hsl;
567 } 576 }
568 ++iter; 577 ++iter;
569 } 578 }
570 } 579 }
571 580
572 void BrowserThemeProvider::SetDisplayPropertyData( 581 void BrowserThemeProvider::SetDisplayPropertyData(
573 DictionaryValue* display_properties_value) { 582 DictionaryValue* display_properties_value) {
574 display_properties_.clear(); 583 display_properties_.clear();
575 584
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
937 delete i->second; 946 delete i->second;
938 } 947 }
939 image_cache_.clear(); 948 image_cache_.clear();
940 } 949 }
941 950
942 #if defined(TOOLKIT_VIEWS) 951 #if defined(TOOLKIT_VIEWS)
943 void BrowserThemeProvider::FreePlatformCaches() { 952 void BrowserThemeProvider::FreePlatformCaches() {
944 // Views (Skia) has no platform image cache to clear. 953 // Views (Skia) has no platform image cache to clear.
945 } 954 }
946 #endif 955 #endif
OLDNEW
« no previous file with comments | « no previous file | chrome/common/extensions/extension.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698