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" |
11 #include "app/l10n_util.h" | 11 #include "app/l10n_util.h" |
12 #include "app/resource_bundle.h" | 12 #include "app/resource_bundle.h" |
13 #include "app/theme_provider.h" | 13 #include "app/theme_provider.h" |
14 #include "base/command_line.h" | |
15 #include "base/file_util.h" | 14 #include "base/file_util.h" |
16 #include "base/ref_counted_memory.h" | 15 #include "base/ref_counted_memory.h" |
17 #include "base/string16.h" | 16 #include "base/string16.h" |
18 #include "base/string_number_conversions.h" | 17 #include "base/string_number_conversions.h" |
19 #include "base/utf_string_conversions.h" | 18 #include "base/utf_string_conversions.h" |
20 #include "base/values.h" | 19 #include "base/values.h" |
21 #include "chrome/browser/chrome_thread.h" | 20 #include "chrome/browser/chrome_thread.h" |
22 #include "chrome/browser/dom_ui/chrome_url_data_manager.h" | 21 #include "chrome/browser/dom_ui/chrome_url_data_manager.h" |
23 #include "chrome/browser/dom_ui/shown_sections_handler.h" | 22 #include "chrome/browser/dom_ui/shown_sections_handler.h" |
24 #include "chrome/browser/google/google_util.h" | 23 #include "chrome/browser/google/google_util.h" |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 else | 296 else |
298 localized_strings.SetString("syncispresent", "false"); | 297 localized_strings.SetString("syncispresent", "false"); |
299 | 298 |
300 ChromeURLDataManager::DataSource::SetFontAndTextDirection(&localized_strings); | 299 ChromeURLDataManager::DataSource::SetFontAndTextDirection(&localized_strings); |
301 | 300 |
302 // Control fade and resize animations. | 301 // Control fade and resize animations. |
303 std::string anim = | 302 std::string anim = |
304 Animation::ShouldRenderRichAnimation() ? "true" : "false"; | 303 Animation::ShouldRenderRichAnimation() ? "true" : "false"; |
305 localized_strings.SetString("anim", anim); | 304 localized_strings.SetString("anim", anim); |
306 | 305 |
307 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | |
308 bool has_3d = | |
309 command_line->HasSwitch(switches::kEnableAcceleratedCompositing); | |
310 localized_strings.SetString("has_3d", has_3d ? "true" : "false"); | |
311 | |
312 // Pass the shown_sections pref early so that we can prevent flicker. | 306 // Pass the shown_sections pref early so that we can prevent flicker. |
313 const int shown_sections = ShownSectionsHandler::GetShownSections( | 307 const int shown_sections = ShownSectionsHandler::GetShownSections( |
314 profile_->GetPrefs()); | 308 profile_->GetPrefs()); |
315 localized_strings.SetInteger("shown_sections", shown_sections); | 309 localized_strings.SetInteger("shown_sections", shown_sections); |
316 | 310 |
317 base::StringPiece new_tab_html(ResourceBundle::GetSharedInstance(). | 311 base::StringPiece new_tab_html(ResourceBundle::GetSharedInstance(). |
318 GetRawDataResource(IDR_NEW_NEW_TAB_HTML)); | 312 GetRawDataResource(IDR_NEW_NEW_TAB_HTML)); |
319 | 313 |
320 // Inject the template data into the HTML so that it is available before any | 314 // Inject the template data into the HTML so that it is available before any |
321 // layout is needed. | 315 // layout is needed. |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 std::string css_string; | 467 std::string css_string; |
474 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); | 468 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); |
475 css_string = ReplaceStringPlaceholders(css_string, subst2, NULL); | 469 css_string = ReplaceStringPlaceholders(css_string, subst2, NULL); |
476 css_string = ReplaceStringPlaceholders(css_string, subst3, NULL); | 470 css_string = ReplaceStringPlaceholders(css_string, subst3, NULL); |
477 | 471 |
478 new_tab_css_ = new RefCountedBytes; | 472 new_tab_css_ = new RefCountedBytes; |
479 new_tab_css_->data.resize(css_string.size()); | 473 new_tab_css_->data.resize(css_string.size()); |
480 std::copy(css_string.begin(), css_string.end(), | 474 std::copy(css_string.begin(), css_string.end(), |
481 new_tab_css_->data.begin()); | 475 new_tab_css_->data.begin()); |
482 } | 476 } |
OLD | NEW |