| 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/dom_ui/ntp_resource_cache.h" | 5 #include "chrome/browser/dom_ui/ntp_resource_cache.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "app/animation.h" | 10 #include "app/animation.h" |
| (...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 subst2.push_back(SkColorToRGBAString(color_section_text)); // $$3 | 452 subst2.push_back(SkColorToRGBAString(color_section_text)); // $$3 |
| 453 subst2.push_back(SkColorToRGBAString(color_section_link)); // $$4 | 453 subst2.push_back(SkColorToRGBAString(color_section_link)); // $$4 |
| 454 subst2.push_back( | 454 subst2.push_back( |
| 455 tp->HasCustomImage(IDR_THEME_NTP_ATTRIBUTION) ? "block" : "none"); // $$5 | 455 tp->HasCustomImage(IDR_THEME_NTP_ATTRIBUTION) ? "block" : "none"); // $$5 |
| 456 subst2.push_back(SkColorToRGBAString(color_link_underline)); // $$6 | 456 subst2.push_back(SkColorToRGBAString(color_link_underline)); // $$6 |
| 457 subst2.push_back(SkColorToRGBAString(color_section_link_underline)); // $$7 | 457 subst2.push_back(SkColorToRGBAString(color_section_link_underline)); // $$7 |
| 458 subst2.push_back(SkColorToRGBAString(color_section_header_text)); // $$8 | 458 subst2.push_back(SkColorToRGBAString(color_section_header_text)); // $$8 |
| 459 subst2.push_back(SkColorToRGBAString( | 459 subst2.push_back(SkColorToRGBAString( |
| 460 color_section_header_text_hover)); // $$9 | 460 color_section_header_text_hover)); // $$9 |
| 461 | 461 |
| 462 // A fully transparent version of the background color --- used for gradients. | 462 subst3.push_back(SkColorToRGBAString(color_section_header_rule)); // $$$1 |
| 463 subst3.push_back(SkColorToRGBAString( | 463 subst3.push_back(SkColorToRGBAString( |
| 464 SkColorSetA(color_background, 0))); // $$$1 | 464 color_section_header_rule_light)); // $$$2 |
| 465 subst3.push_back(SkColorToRGBAString( |
| 466 SkColorSetA(color_section_header_rule, 0))); // $$$3 |
| 465 | 467 |
| 466 // TODO(aa): It seems we could generate sensible defaults for all these colors | |
| 467 // for better backward compat with old themes. | |
| 468 subst3.push_back(SkColorToRGBAString(color_section_header_rule)); // $$$2 | |
| 469 subst3.push_back(SkColorToRGBAString( | |
| 470 color_section_header_rule_light)); // $$$3 | |
| 471 | 468 |
| 472 // Get our template. | 469 // Get our template. |
| 473 static const base::StringPiece new_tab_theme_css( | 470 static const base::StringPiece new_tab_theme_css( |
| 474 ResourceBundle::GetSharedInstance().GetRawDataResource( | 471 ResourceBundle::GetSharedInstance().GetRawDataResource( |
| 475 IDR_NEW_TAB_THEME_CSS)); | 472 IDR_NEW_TAB_THEME_CSS)); |
| 476 | 473 |
| 477 // Create the string from our template and the replacements. | 474 // Create the string from our template and the replacements. |
| 478 std::string css_string; | 475 std::string css_string; |
| 479 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); | 476 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); |
| 480 css_string = ReplaceStringPlaceholders(css_string, subst2, NULL); | 477 css_string = ReplaceStringPlaceholders(css_string, subst2, NULL); |
| 481 css_string = ReplaceStringPlaceholders(css_string, subst3, NULL); | 478 css_string = ReplaceStringPlaceholders(css_string, subst3, NULL); |
| 482 | 479 |
| 483 new_tab_css_ = new RefCountedBytes; | 480 new_tab_css_ = new RefCountedBytes; |
| 484 new_tab_css_->data.resize(css_string.size()); | 481 new_tab_css_->data.resize(css_string.size()); |
| 485 std::copy(css_string.begin(), css_string.end(), | 482 std::copy(css_string.begin(), css_string.end(), |
| 486 new_tab_css_->data.begin()); | 483 new_tab_css_->data.begin()); |
| 487 } | 484 } |
| OLD | NEW |