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

Side by Side Diff: chrome/browser/ui/webui/ntp/ntp_resource_cache.cc

Issue 6897002: Use more than 9 arguments for ReplaceStringPlaceholders() in ntp_resource_cache.cc (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Merge with issue 6877008 Created 9 years, 6 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 | « chrome/browser/resources/ntp4/new_tab_theme.css ('k') | no next file » | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/ui/webui/ntp/ntp_resource_cache.h" 5 #include "chrome/browser/ui/webui/ntp/ntp_resource_cache.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 // BookmarkBarView::Paint for how we do this for the bookmark bar 510 // BookmarkBarView::Paint for how we do this for the bookmark bar
511 // borders. 511 // borders.
512 SkColor color_section_border = 512 SkColor color_section_border =
513 SkColorSetARGB(80, 513 SkColorSetARGB(80,
514 SkColorGetR(color_header), 514 SkColorGetR(color_header),
515 SkColorGetG(color_header), 515 SkColorGetG(color_header),
516 SkColorGetB(color_header)); 516 SkColorGetB(color_header));
517 517
518 // Generate the replacements. 518 // Generate the replacements.
519 std::vector<std::string> subst; 519 std::vector<std::string> subst;
520 // A second list of replacements, each of which must be in $$x format,
521 // where x is a digit from 1-9.
522 std::vector<std::string> subst2;
523 std::vector<std::string> subst3;
524 520
525 // Cache-buster for background. 521 // Cache-buster for background.
526 subst.push_back( 522 subst.push_back(
527 profile_->GetPrefs()->GetString(prefs::kCurrentThemeID)); // $1 523 profile_->GetPrefs()->GetString(prefs::kCurrentThemeID)); // $1
528 524
529 // Colors. 525 // Colors.
530 subst.push_back(SkColorToRGBAString(color_background)); // $2 526 subst.push_back(SkColorToRGBAString(color_background)); // $2
531 subst.push_back(GetNewTabBackgroundCSS(tp, false)); // $3 527 subst.push_back(GetNewTabBackgroundCSS(tp, false)); // $3
532 subst.push_back(GetNewTabBackgroundCSS(tp, true)); // $4 528 subst.push_back(GetNewTabBackgroundCSS(tp, true)); // $4
533 subst.push_back(GetNewTabBackgroundTilingCSS(tp)); // $5 529 subst.push_back(GetNewTabBackgroundTilingCSS(tp)); // $5
534 subst.push_back(SkColorToRGBAString(color_header)); // $6 530 subst.push_back(SkColorToRGBAString(color_header)); // $6
535 subst.push_back(SkColorToRGBAString(color_header_gradient_light)); // $7 531 subst.push_back(SkColorToRGBAString(color_header_gradient_light)); // $7
536 subst.push_back(SkColorToRGBAString(color_text)); // $8 532 subst.push_back(SkColorToRGBAString(color_text)); // $8
537 subst.push_back(SkColorToRGBAString(color_link)); // $9 533 subst.push_back(SkColorToRGBAString(color_link)); // $9
538 534 subst.push_back(SkColorToRGBAString(color_section)); // $10
539 subst2.push_back(SkColorToRGBAString(color_section)); // $$1 535 subst.push_back(SkColorToRGBAString(color_section_border)); // $11
540 subst2.push_back(SkColorToRGBAString(color_section_border)); // $$2 536 subst.push_back(SkColorToRGBAString(color_section_text)); // $12
541 subst2.push_back(SkColorToRGBAString(color_section_text)); // $$3 537 subst.push_back(SkColorToRGBAString(color_section_link)); // $13
542 subst2.push_back(SkColorToRGBAString(color_section_link)); // $$4 538 subst.push_back(SkColorToRGBAString(color_link_underline)); // $14
543 subst2.push_back(SkColorToRGBAString(color_link_underline)); // $$5 539 subst.push_back(SkColorToRGBAString(color_section_link_underline)); // $15
544 subst2.push_back(SkColorToRGBAString(color_section_link_underline)); // $$6 540 subst.push_back(SkColorToRGBAString(color_section_header_text)); // $16
545 subst2.push_back(SkColorToRGBAString(color_section_header_text)); // $$7 541 subst.push_back(SkColorToRGBAString(
546 subst2.push_back(SkColorToRGBAString( 542 color_section_header_text_hover)); // $17
547 color_section_header_text_hover)); // $$8 543 subst.push_back(SkColorToRGBAString(color_section_header_rule)); // $18
548 subst2.push_back(SkColorToRGBAString(color_section_header_rule)); // $$9 544 subst.push_back(SkColorToRGBAString(
549 545 color_section_header_rule_light)); // $19
550 subst3.push_back(SkColorToRGBAString( 546 subst.push_back(SkColorToRGBAString(
551 color_section_header_rule_light)); // $$$1 547 SkColorSetA(color_section_header_rule, 0))); // $20
552 subst3.push_back(SkColorToRGBAString( 548 subst.push_back(SkColorToRGBAString(color_text_light)); // $21
553 SkColorSetA(color_section_header_rule, 0))); // $$$2
554 subst3.push_back(SkColorToRGBAString(color_text_light)); // $$$3
555 549
556 // Get our template. 550 // Get our template.
557 int ntp_css_resource_id = 551 int ntp_css_resource_id =
558 CommandLine::ForCurrentProcess()->HasSwitch(switches::kNewTabPage4) ? 552 CommandLine::ForCurrentProcess()->HasSwitch(switches::kNewTabPage4) ?
559 IDR_NEW_TAB_4_THEME_CSS : IDR_NEW_TAB_THEME_CSS; 553 IDR_NEW_TAB_4_THEME_CSS : IDR_NEW_TAB_THEME_CSS;
560 static const base::StringPiece new_tab_theme_css( 554 static const base::StringPiece new_tab_theme_css(
561 ResourceBundle::GetSharedInstance().GetRawDataResource( 555 ResourceBundle::GetSharedInstance().GetRawDataResource(
562 ntp_css_resource_id)); 556 ntp_css_resource_id));
563 557
564 // Create the string from our template and the replacements. 558 // Create the string from our template and the replacements.
565 std::string css_string; 559 std::string css_string;
566 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); 560 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL);
567 css_string = ReplaceStringPlaceholders(css_string, subst2, NULL);
568 css_string = ReplaceStringPlaceholders(css_string, subst3, NULL);
569
570 new_tab_css_ = new RefCountedBytes; 561 new_tab_css_ = new RefCountedBytes;
571 new_tab_css_->data.resize(css_string.size()); 562 new_tab_css_->data.resize(css_string.size());
572 std::copy(css_string.begin(), css_string.end(), 563 std::copy(css_string.begin(), css_string.end(),
573 new_tab_css_->data.begin()); 564 new_tab_css_->data.begin());
574 } 565 }
OLDNEW
« no previous file with comments | « chrome/browser/resources/ntp4/new_tab_theme.css ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698