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

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

Issue 830743003: Directly inline shared WebUI CSS declarations into the security and supervised user interstitials. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: review Created 5 years, 11 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/ui/webui/ntp/ntp_resource_cache.h" 5 #include "chrome/browser/ui/webui/ntp/ntp_resource_cache.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 } 317 }
318 318
319 localized_strings.SetString("learnMore", 319 localized_strings.SetString("learnMore",
320 l10n_util::GetStringUTF16(new_tab_link_ids)); 320 l10n_util::GetStringUTF16(new_tab_link_ids));
321 localized_strings.SetString("learnMoreLink", new_tab_link); 321 localized_strings.SetString("learnMoreLink", new_tab_link);
322 322
323 bool bookmark_bar_attached = 323 bool bookmark_bar_attached =
324 profile_->GetPrefs()->GetBoolean(bookmarks::prefs::kShowBookmarkBar); 324 profile_->GetPrefs()->GetBoolean(bookmarks::prefs::kShowBookmarkBar);
325 localized_strings.SetBoolean("bookmarkbarattached", bookmark_bar_attached); 325 localized_strings.SetBoolean("bookmarkbarattached", bookmark_bar_attached);
326 326
327 webui::SetFontAndTextDirection(&localized_strings); 327 webui::SetTextDirection(&localized_strings);
328 328
329 static const base::StringPiece incognito_tab_html( 329 static const base::StringPiece incognito_tab_html(
330 ResourceBundle::GetSharedInstance().GetRawDataResource( 330 ResourceBundle::GetSharedInstance().GetRawDataResource(
331 new_tab_html_idr)); 331 new_tab_html_idr));
332 332
333 std::string full_html = webui::GetI18nTemplateHtml( 333 std::string full_html = webui::GetI18nTemplateHtml(
334 incognito_tab_html, &localized_strings); 334 incognito_tab_html, &localized_strings);
335 335
336 new_tab_incognito_html_ = base::RefCountedString::TakeString(&full_html); 336 new_tab_incognito_html_ = base::RefCountedString::TakeString(&full_html);
337 } 337 }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 #endif 370 #endif
371 371
372 localized_strings.SetString("guestTabDescription", 372 localized_strings.SetString("guestTabDescription",
373 l10n_util::GetStringUTF16(guest_tab_description_ids)); 373 l10n_util::GetStringUTF16(guest_tab_description_ids));
374 localized_strings.SetString("guestTabHeading", 374 localized_strings.SetString("guestTabHeading",
375 l10n_util::GetStringUTF16(guest_tab_heading_ids)); 375 l10n_util::GetStringUTF16(guest_tab_heading_ids));
376 localized_strings.SetString("learnMore", 376 localized_strings.SetString("learnMore",
377 l10n_util::GetStringUTF16(guest_tab_link_ids)); 377 l10n_util::GetStringUTF16(guest_tab_link_ids));
378 localized_strings.SetString("learnMoreLink", guest_tab_link); 378 localized_strings.SetString("learnMoreLink", guest_tab_link);
379 379
380 webui::SetFontAndTextDirection(&localized_strings); 380 webui::SetTextDirection(&localized_strings);
381 381
382 static const base::StringPiece guest_tab_html( 382 static const base::StringPiece guest_tab_html(
383 ResourceBundle::GetSharedInstance().GetRawDataResource(guest_tab_ids)); 383 ResourceBundle::GetSharedInstance().GetRawDataResource(guest_tab_ids));
384 384
385 std::string full_html = webui::GetI18nTemplateHtml( 385 std::string full_html = webui::GetI18nTemplateHtml(
386 guest_tab_html, &localized_strings); 386 guest_tab_html, &localized_strings);
387 387
388 new_tab_guest_html_ = base::RefCountedString::TakeString(&full_html); 388 new_tab_guest_html_ = base::RefCountedString::TakeString(&full_html);
389 } 389 }
390 390
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 } 509 }
510 510
511 #if defined(OS_CHROMEOS) 511 #if defined(OS_CHROMEOS)
512 load_time_data.SetString("expandMenu", 512 load_time_data.SetString("expandMenu",
513 l10n_util::GetStringUTF16(IDS_NEW_TAB_CLOSE_MENU_EXPAND)); 513 l10n_util::GetStringUTF16(IDS_NEW_TAB_CLOSE_MENU_EXPAND));
514 #endif 514 #endif
515 515
516 NewTabPageHandler::GetLocalizedValues(profile_, &load_time_data); 516 NewTabPageHandler::GetLocalizedValues(profile_, &load_time_data);
517 NTPLoginHandler::GetLocalizedValues(profile_, &load_time_data); 517 NTPLoginHandler::GetLocalizedValues(profile_, &load_time_data);
518 518
519 webui::SetFontAndTextDirection(&load_time_data); 519 webui::SetTextDirection(&load_time_data);
520 520
521 // Control fade and resize animations. 521 // Control fade and resize animations.
522 load_time_data.SetBoolean("anim", 522 load_time_data.SetBoolean("anim",
523 gfx::Animation::ShouldRenderRichAnimation()); 523 gfx::Animation::ShouldRenderRichAnimation());
524 524
525 ui::ThemeProvider* tp = ThemeServiceFactory::GetForProfile(profile_); 525 ui::ThemeProvider* tp = ThemeServiceFactory::GetForProfile(profile_);
526 int alignment = tp->GetDisplayProperty( 526 int alignment = tp->GetDisplayProperty(
527 ThemeProperties::NTP_BACKGROUND_ALIGNMENT); 527 ThemeProperties::NTP_BACKGROUND_ALIGNMENT);
528 load_time_data.SetString("themegravity", 528 load_time_data.SetString("themegravity",
529 (alignment & ThemeProperties::ALIGN_RIGHT) ? "right" : ""); 529 (alignment & ThemeProperties::ALIGN_RIGHT) ? "right" : "");
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
720 // Get our template. 720 // Get our template.
721 static const base::StringPiece new_tab_theme_css( 721 static const base::StringPiece new_tab_theme_css(
722 ResourceBundle::GetSharedInstance().GetRawDataResource( 722 ResourceBundle::GetSharedInstance().GetRawDataResource(
723 IDR_NEW_TAB_4_THEME_CSS)); 723 IDR_NEW_TAB_4_THEME_CSS));
724 724
725 // Create the string from our template and the replacements. 725 // Create the string from our template and the replacements.
726 std::string css_string; 726 std::string css_string;
727 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); 727 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL);
728 new_tab_css_ = base::RefCountedString::TakeString(&css_string); 728 new_tab_css_ = base::RefCountedString::TakeString(&css_string);
729 } 729 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698