| 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 "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/memory/ref_counted_memory.h" | 8 #include "base/memory/ref_counted_memory.h" |
| 9 #include "base/string16.h" | 9 #include "base/string16.h" |
| 10 #include "base/string_piece.h" | 10 #include "base/string_piece.h" |
| 11 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
| 12 #include "base/values.h" | 12 #include "base/values.h" |
| 13 #include "chrome/browser/google/google_util.h" | 13 #include "chrome/browser/google/google_util.h" |
| 14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
| 15 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" | 15 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" |
| 16 #include "chrome/browser/ui/webui/ntp/new_tab_page_handler.h" | |
| 17 #include "chrome/common/chrome_switches.h" | 16 #include "chrome/common/chrome_switches.h" |
| 18 #include "chrome/common/jstemplate_builder.h" | 17 #include "chrome/common/jstemplate_builder.h" |
| 19 #include "content/public/browser/browser_thread.h" | 18 #include "content/public/browser/browser_thread.h" |
| 20 #include "content/public/browser/notification_service.h" | 19 #include "content/public/browser/notification_service.h" |
| 21 #include "grit/browser_resources.h" | 20 #include "grit/browser_resources.h" |
| 22 #include "grit/generated_resources.h" | 21 #include "grit/generated_resources.h" |
| 23 #include "ui/base/l10n/l10n_util.h" | 22 #include "ui/base/l10n/l10n_util.h" |
| 24 #include "ui/base/layout.h" | 23 #include "ui/base/layout.h" |
| 25 #include "ui/base/resource/resource_bundle.h" | 24 #include "ui/base/resource/resource_bundle.h" |
| 26 | 25 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 l10n_util::GetStringUTF16(IDS_BOOKMARK_REMOVE_FOLDER)); | 90 l10n_util::GetStringUTF16(IDS_BOOKMARK_REMOVE_FOLDER)); |
| 92 localized_strings.SetString("receivedDocuments", | 91 localized_strings.SetString("receivedDocuments", |
| 93 l10n_util::GetStringUTF16(IDS_RECEIVED_DOCUMENTS)); | 92 l10n_util::GetStringUTF16(IDS_RECEIVED_DOCUMENTS)); |
| 94 localized_strings.SetString("syncPromo", | 93 localized_strings.SetString("syncPromo", |
| 95 l10n_util::GetStringUTF16(IDS_SYNC_PROMO_DESKTOP_INSTRUCTIONS)); | 94 l10n_util::GetStringUTF16(IDS_SYNC_PROMO_DESKTOP_INSTRUCTIONS)); |
| 96 localized_strings.SetString("syncEnableSync", | 95 localized_strings.SetString("syncEnableSync", |
| 97 l10n_util::GetStringUTF16(IDS_SYNC_ENABLE_SYNC)); | 96 l10n_util::GetStringUTF16(IDS_SYNC_ENABLE_SYNC)); |
| 98 localized_strings.SetString("bookmarkstitle", | 97 localized_strings.SetString("bookmarkstitle", |
| 99 l10n_util::GetStringUTF16(IDS_ACCNAME_BOOKMARKS)); | 98 l10n_util::GetStringUTF16(IDS_ACCNAME_BOOKMARKS)); |
| 100 | 99 |
| 101 NewTabPageHandler::GetLocalizedValues(profile_, &localized_strings); | |
| 102 | |
| 103 ChromeURLDataManager::DataSource::SetFontAndTextDirection(&localized_strings); | 100 ChromeURLDataManager::DataSource::SetFontAndTextDirection(&localized_strings); |
| 104 | 101 |
| 105 base::StringPiece new_tab_html(ResourceBundle::GetSharedInstance(). | 102 base::StringPiece new_tab_html(ResourceBundle::GetSharedInstance(). |
| 106 GetRawDataResource(IDR_NEW_TAB_ANDROID_HTML, | 103 GetRawDataResource(IDR_NEW_TAB_ANDROID_HTML, |
| 107 ui::SCALE_FACTOR_NONE)); | 104 ui::SCALE_FACTOR_NONE)); |
| 108 localized_strings.SetString( | 105 localized_strings.SetString( |
| 109 "device", | 106 "device", |
| 110 CommandLine::ForCurrentProcess()->HasSwitch(switches::kTabletUI) ? | 107 CommandLine::ForCurrentProcess()->HasSwitch(switches::kTabletUI) ? |
| 111 "tablet" : "phone"); | 108 "tablet" : "phone"); |
| 112 const char* new_tab_link = kLearnMoreIncognitoUrl; | 109 const char* new_tab_link = kLearnMoreIncognitoUrl; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 133 size_t after_offset = pos + template_data_placeholder.size(); | 130 size_t after_offset = pos + template_data_placeholder.size(); |
| 134 full_html.append(new_tab_html.data() + after_offset, | 131 full_html.append(new_tab_html.data() + after_offset, |
| 135 new_tab_html.size() - after_offset); | 132 new_tab_html.size() - after_offset); |
| 136 } else { | 133 } else { |
| 137 NOTREACHED(); | 134 NOTREACHED(); |
| 138 full_html.assign(new_tab_html.data(), new_tab_html.size()); | 135 full_html.assign(new_tab_html.data(), new_tab_html.size()); |
| 139 } | 136 } |
| 140 | 137 |
| 141 new_tab_html_ = base::RefCountedString::TakeString(&full_html); | 138 new_tab_html_ = base::RefCountedString::TakeString(&full_html); |
| 142 } | 139 } |
| OLD | NEW |