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

Side by Side Diff: chrome/browser/dom_ui/new_tab_ui.cc

Issue 269095: NTP: Fix startup visual state ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 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/browser/resources/new_new_tab.css » ('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) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-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 "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #include "chrome/browser/dom_ui/new_tab_ui.h" 7 #include "chrome/browser/dom_ui/new_tab_ui.h"
8 8
9 #include <set> 9 #include <set>
10 10
(...skipping 1180 matching lines...) Expand 10 before | Expand all | Expand 10 after
1191 profile_->GetPrefs()->SetInteger(prefs::kNTPThemePromoRemaining, 1191 profile_->GetPrefs()->SetInteger(prefs::kNTPThemePromoRemaining,
1192 profile_->GetPrefs()->GetInteger(prefs::kNTPThemePromoRemaining) - 1); 1192 profile_->GetPrefs()->GetInteger(prefs::kNTPThemePromoRemaining) - 1);
1193 first_view_ = false; 1193 first_view_ = false;
1194 } 1194 }
1195 1195
1196 // Control fade and resize animations. 1196 // Control fade and resize animations.
1197 std::wstring anim = 1197 std::wstring anim =
1198 Animation::ShouldRenderRichAnimation() ? L"true" : L"false"; 1198 Animation::ShouldRenderRichAnimation() ? L"true" : L"false";
1199 localized_strings.SetString(L"anim", anim); 1199 localized_strings.SetString(L"anim", anim);
1200 1200
1201 // Pass the shown_sections pref early so that we can prevent flicker.
1202 const int shown_sections = profile_->GetPrefs()->GetInteger(
1203 prefs::kNTPShownSections);
1204 localized_strings.SetInteger(L"shown_sections", shown_sections);
1205
1201 // In case we have the new new tab page enabled we first try to read the file 1206 // In case we have the new new tab page enabled we first try to read the file
1202 // provided on the command line. If that fails we just get the resource from 1207 // provided on the command line. If that fails we just get the resource from
1203 // the resource bundle. 1208 // the resource bundle.
1204 base::StringPiece new_tab_html; 1209 base::StringPiece new_tab_html;
1205 std::string new_tab_html_str; 1210 std::string new_tab_html_str;
1206 new_tab_html_str = GetCustomNewTabPageFromCommandLine(); 1211 new_tab_html_str = GetCustomNewTabPageFromCommandLine();
1207 1212
1208 if (!new_tab_html_str.empty()) { 1213 if (!new_tab_html_str.empty()) {
1209 new_tab_html = base::StringPiece(new_tab_html_str); 1214 new_tab_html = base::StringPiece(new_tab_html_str);
1210 } 1215 }
1211 1216
1212 if (new_tab_html.empty()) { 1217 if (new_tab_html.empty()) {
1213 new_tab_html = ResourceBundle::GetSharedInstance().GetRawDataResource( 1218 new_tab_html = ResourceBundle::GetSharedInstance().GetRawDataResource(
1214 IDR_NEW_NEW_TAB_HTML); 1219 IDR_NEW_NEW_TAB_HTML);
1215 } 1220 }
1216 1221
1217 full_html_.assign(new_tab_html.data(), new_tab_html.size()); 1222 full_html_.assign(new_tab_html.data(), new_tab_html.size());
1218 jstemplate_builder::AppendJsonHtml(&localized_strings, &full_html_); 1223
1219 jstemplate_builder::AppendI18nTemplateSourceHtml(&full_html_); 1224 // Inject the template data into the HTML so that it is available before any
1225 // layout is needed.
1226 std::string json_html;
1227 jstemplate_builder::AppendJsonHtml(&localized_strings, &json_html);
1228
1229 static const std::string template_data_placeholder =
1230 "<!-- template data placeholder -->";
1231 ReplaceFirstSubstringAfterOffset(&full_html_, 0, template_data_placeholder,
1232 json_html);
1233
1220 jstemplate_builder::AppendI18nTemplateProcessHtml(&full_html_); 1234 jstemplate_builder::AppendI18nTemplateProcessHtml(&full_html_);
1221 } 1235 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/new_new_tab.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698