OLD | NEW |
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" |
11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
12 #include "base/memory/ref_counted_memory.h" | 12 #include "base/memory/ref_counted_memory.h" |
13 #include "base/string16.h" | 13 #include "base/string16.h" |
14 #include "base/stringprintf.h" | 14 #include "base/stringprintf.h" |
15 #include "base/string_number_conversions.h" | 15 #include "base/string_number_conversions.h" |
16 #include "base/time.h" | 16 #include "base/time.h" |
17 #include "base/utf_string_conversions.h" | 17 #include "base/utf_string_conversions.h" |
18 #include "base/values.h" | 18 #include "base/values.h" |
19 #include "chrome/browser/defaults.h" | 19 #include "chrome/browser/defaults.h" |
20 #include "chrome/browser/google/google_util.h" | 20 #include "chrome/browser/google/google_util.h" |
21 #include "chrome/browser/prefs/pref_service.h" | 21 #include "chrome/browser/prefs/pref_service.h" |
22 #include "chrome/browser/profiles/profile.h" | 22 #include "chrome/browser/profiles/profile.h" |
23 #include "chrome/browser/themes/theme_service.h" | 23 #include "chrome/browser/themes/theme_service.h" |
24 #include "chrome/browser/themes/theme_service_factory.h" | 24 #include "chrome/browser/themes/theme_service_factory.h" |
25 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" | 25 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" |
26 #include "chrome/browser/ui/webui/ntp/shown_sections_handler.h" | 26 #include "chrome/browser/ui/webui/ntp/shown_sections_handler.h" |
| 27 #include "chrome/browser/ui/webui/sync_setup_handler.h" |
27 #include "chrome/browser/web_resource/promo_resource_service.h" | 28 #include "chrome/browser/web_resource/promo_resource_service.h" |
28 #include "chrome/common/chrome_notification_types.h" | 29 #include "chrome/common/chrome_notification_types.h" |
29 #include "chrome/common/chrome_switches.h" | 30 #include "chrome/common/chrome_switches.h" |
30 #include "chrome/common/extensions/extension.h" | 31 #include "chrome/common/extensions/extension.h" |
31 #include "chrome/common/extensions/extension_constants.h" | 32 #include "chrome/common/extensions/extension_constants.h" |
32 #include "chrome/common/jstemplate_builder.h" | 33 #include "chrome/common/jstemplate_builder.h" |
33 #include "chrome/common/pref_names.h" | 34 #include "chrome/common/pref_names.h" |
34 #include "chrome/common/url_constants.h" | 35 #include "chrome/common/url_constants.h" |
35 #include "content/browser/browser_thread.h" | 36 #include "content/browser/browser_thread.h" |
36 #include "content/browser/user_metrics.h" | 37 #include "content/browser/user_metrics.h" |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 l10n_util::GetStringUTF16(IDS_EXTENSION_WEB_STORE_TITLE)); | 343 l10n_util::GetStringUTF16(IDS_EXTENSION_WEB_STORE_TITLE)); |
343 localized_strings.SetString("web_store_url", | 344 localized_strings.SetString("web_store_url", |
344 GetUrlWithLang(GURL(Extension::ChromeStoreLaunchURL()))); | 345 GetUrlWithLang(GURL(Extension::ChromeStoreLaunchURL()))); |
345 localized_strings.SetString("syncpromotext", | 346 localized_strings.SetString("syncpromotext", |
346 l10n_util::GetStringUTF16(IDS_SYNC_START_SYNC_BUTTON_LABEL)); | 347 l10n_util::GetStringUTF16(IDS_SYNC_START_SYNC_BUTTON_LABEL)); |
347 #if defined(OS_CHROMEOS) | 348 #if defined(OS_CHROMEOS) |
348 localized_strings.SetString("expandMenu", | 349 localized_strings.SetString("expandMenu", |
349 l10n_util::GetStringUTF16(IDS_NEW_TAB_CLOSE_MENU_EXPAND)); | 350 l10n_util::GetStringUTF16(IDS_NEW_TAB_CLOSE_MENU_EXPAND)); |
350 #endif | 351 #endif |
351 | 352 |
| 353 SyncSetupHandler::GetStaticLocalizedValues(&localized_strings); |
| 354 |
352 // Don't initiate the sync related message passing with the page if the sync | 355 // Don't initiate the sync related message passing with the page if the sync |
353 // code is not present. | 356 // code is not present. |
354 if (profile_->GetProfileSyncService()) | 357 if (profile_->GetProfileSyncService()) |
355 localized_strings.SetString("syncispresent", "true"); | 358 localized_strings.SetString("syncispresent", "true"); |
356 else | 359 else |
357 localized_strings.SetString("syncispresent", "false"); | 360 localized_strings.SetString("syncispresent", "false"); |
358 | 361 |
359 ChromeURLDataManager::DataSource::SetFontAndTextDirection(&localized_strings); | 362 ChromeURLDataManager::DataSource::SetFontAndTextDirection(&localized_strings); |
360 | 363 |
361 // Control fade and resize animations. | 364 // Control fade and resize animations. |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 ntp_css_resource_id)); | 564 ntp_css_resource_id)); |
562 | 565 |
563 // Create the string from our template and the replacements. | 566 // Create the string from our template and the replacements. |
564 std::string css_string; | 567 std::string css_string; |
565 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); | 568 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); |
566 new_tab_css_ = new RefCountedBytes; | 569 new_tab_css_ = new RefCountedBytes; |
567 new_tab_css_->data.resize(css_string.size()); | 570 new_tab_css_->data.resize(css_string.size()); |
568 std::copy(css_string.begin(), css_string.end(), | 571 std::copy(css_string.begin(), css_string.end(), |
569 new_tab_css_->data.begin()); | 572 new_tab_css_->data.begin()); |
570 } | 573 } |
OLD | NEW |