OLD | NEW |
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 "apps/app_launcher.h" | 10 #include "apps/app_launcher.h" |
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 // Determine whether to show the menu for accessing tabs on other devices. | 451 // Determine whether to show the menu for accessing tabs on other devices. |
452 bool show_other_sessions_menu = !CommandLine::ForCurrentProcess()->HasSwitch( | 452 bool show_other_sessions_menu = !CommandLine::ForCurrentProcess()->HasSwitch( |
453 switches::kDisableNTPOtherSessionsMenu); | 453 switches::kDisableNTPOtherSessionsMenu); |
454 load_time_data.SetBoolean("showOtherSessionsMenu", | 454 load_time_data.SetBoolean("showOtherSessionsMenu", |
455 show_other_sessions_menu); | 455 show_other_sessions_menu); |
456 load_time_data.SetBoolean("isUserSignedIn", | 456 load_time_data.SetBoolean("isUserSignedIn", |
457 !prefs->GetString(prefs::kGoogleServicesUsername).empty()); | 457 !prefs->GetString(prefs::kGoogleServicesUsername).empty()); |
458 | 458 |
459 // Load the new tab page appropriate for this build | 459 // Load the new tab page appropriate for this build |
460 base::StringPiece new_tab_html(ResourceBundle::GetSharedInstance(). | 460 base::StringPiece new_tab_html(ResourceBundle::GetSharedInstance(). |
461 GetRawDataResource(chrome::search::IsInstantExtendedAPIEnabled(profile_) ? | 461 GetRawDataResource(IDR_NEW_TAB_4_HTML)); |
462 IDR_NEW_TAB_SEARCH_HTML : IDR_NEW_TAB_4_HTML)); | |
463 webui::UseVersion2 version2; | 462 webui::UseVersion2 version2; |
464 std::string full_html = | 463 std::string full_html = |
465 webui::GetI18nTemplateHtml(new_tab_html, &load_time_data); | 464 webui::GetI18nTemplateHtml(new_tab_html, &load_time_data); |
466 new_tab_html_ = base::RefCountedString::TakeString(&full_html); | 465 new_tab_html_ = base::RefCountedString::TakeString(&full_html); |
467 } | 466 } |
468 | 467 |
469 void NTPResourceCache::CreateNewTabIncognitoCSS() { | 468 void NTPResourceCache::CreateNewTabIncognitoCSS() { |
470 ui::ThemeProvider* tp = ThemeServiceFactory::GetForProfile(profile_); | 469 ui::ThemeProvider* tp = ThemeServiceFactory::GetForProfile(profile_); |
471 DCHECK(tp); | 470 DCHECK(tp); |
472 | 471 |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 color_section_header_rule_light)); // $19 | 577 color_section_header_rule_light)); // $19 |
579 subst.push_back(SkColorToRGBAString( | 578 subst.push_back(SkColorToRGBAString( |
580 SkColorSetA(color_section_header_rule, 0))); // $20 | 579 SkColorSetA(color_section_header_rule, 0))); // $20 |
581 subst.push_back(SkColorToRGBAString(color_text_light)); // $21 | 580 subst.push_back(SkColorToRGBAString(color_text_light)); // $21 |
582 subst.push_back(SkColorToRGBComponents(color_section_border)); // $22 | 581 subst.push_back(SkColorToRGBComponents(color_section_border)); // $22 |
583 subst.push_back(SkColorToRGBComponents(color_text)); // $23 | 582 subst.push_back(SkColorToRGBComponents(color_text)); // $23 |
584 | 583 |
585 // Get our template. | 584 // Get our template. |
586 static const base::StringPiece new_tab_theme_css( | 585 static const base::StringPiece new_tab_theme_css( |
587 ResourceBundle::GetSharedInstance().GetRawDataResource( | 586 ResourceBundle::GetSharedInstance().GetRawDataResource( |
588 chrome::search::IsInstantExtendedAPIEnabled(profile_) ? | 587 IDR_NEW_TAB_4_THEME_CSS)); |
589 IDR_NEW_TAB_SEARCH_THEME_CSS : IDR_NEW_TAB_4_THEME_CSS)); | |
590 | 588 |
591 // Create the string from our template and the replacements. | 589 // Create the string from our template and the replacements. |
592 std::string css_string; | 590 std::string css_string; |
593 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); | 591 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); |
594 new_tab_css_ = base::RefCountedString::TakeString(&css_string); | 592 new_tab_css_ = base::RefCountedString::TakeString(&css_string); |
595 } | 593 } |
OLD | NEW |