| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "base/histogram.h" | 9 #include "base/histogram.h" |
| 10 #include "base/string_piece.h" | 10 #include "base/string_piece.h" |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 localized_strings.SetString(L"searchhistory", | 248 localized_strings.SetString(L"searchhistory", |
| 249 l10n_util::GetString(IDS_NEW_TAB_HISTORY_SEARCH)); | 249 l10n_util::GetString(IDS_NEW_TAB_HISTORY_SEARCH)); |
| 250 localized_strings.SetString(L"recentlyclosed", | 250 localized_strings.SetString(L"recentlyclosed", |
| 251 l10n_util::GetString(IDS_NEW_TAB_RECENTLY_CLOSED)); | 251 l10n_util::GetString(IDS_NEW_TAB_RECENTLY_CLOSED)); |
| 252 localized_strings.SetString(L"mostvisitedintro", | 252 localized_strings.SetString(L"mostvisitedintro", |
| 253 l10n_util::GetStringF(IDS_NEW_TAB_MOST_VISITED_INTRO, | 253 l10n_util::GetStringF(IDS_NEW_TAB_MOST_VISITED_INTRO, |
| 254 l10n_util::GetString(IDS_WELCOME_PAGE_URL))); | 254 l10n_util::GetString(IDS_WELCOME_PAGE_URL))); |
| 255 localized_strings.SetString(L"closedwindow", | 255 localized_strings.SetString(L"closedwindow", |
| 256 l10n_util::GetString(IDS_NEW_TAB_RECENTLY_CLOSED_WINDOW)); | 256 l10n_util::GetString(IDS_NEW_TAB_RECENTLY_CLOSED_WINDOW)); |
| 257 | 257 |
| 258 localized_strings.SetString(L"textdirection", | 258 SetFontAndTextDirection(&localized_strings); |
| 259 (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) ? | |
| 260 kRTLHtmlTextDirection : kDefaultHtmlTextDirection); | |
| 261 | 259 |
| 262 // Let the tab know whether it's the first tab being viewed. | 260 // Let the tab know whether it's the first tab being viewed. |
| 263 localized_strings.SetString(L"firstview", | 261 localized_strings.SetString(L"firstview", |
| 264 first_view_ ? L"true" : std::wstring()); | 262 first_view_ ? L"true" : std::wstring()); |
| 265 first_view_ = false; | 263 first_view_ = false; |
| 266 | 264 |
| 267 #ifdef CHROME_PERSONALIZATION | 265 #ifdef CHROME_PERSONALIZATION |
| 268 localized_strings.SetString(L"p13nsrc", Personalization::GetNewTabSource()); | 266 localized_strings.SetString(L"p13nsrc", Personalization::GetNewTabSource()); |
| 269 #endif | 267 #endif |
| 270 | 268 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 | 307 |
| 310 void IncognitoTabHTMLSource::StartDataRequest(const std::string& path, | 308 void IncognitoTabHTMLSource::StartDataRequest(const std::string& path, |
| 311 int request_id) { | 309 int request_id) { |
| 312 DictionaryValue localized_strings; | 310 DictionaryValue localized_strings; |
| 313 localized_strings.SetString(L"title", | 311 localized_strings.SetString(L"title", |
| 314 l10n_util::GetString(IDS_NEW_TAB_TITLE)); | 312 l10n_util::GetString(IDS_NEW_TAB_TITLE)); |
| 315 localized_strings.SetString(L"content", | 313 localized_strings.SetString(L"content", |
| 316 l10n_util::GetStringF(IDS_NEW_TAB_OTR_MESSAGE, | 314 l10n_util::GetStringF(IDS_NEW_TAB_OTR_MESSAGE, |
| 317 l10n_util::GetString(IDS_LEARN_MORE_INCOGNITO_URL))); | 315 l10n_util::GetString(IDS_LEARN_MORE_INCOGNITO_URL))); |
| 318 | 316 |
| 319 localized_strings.SetString(L"textdirection", | 317 SetFontAndTextDirection(&localized_strings); |
| 320 (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) ? | |
| 321 kRTLHtmlTextDirection : kDefaultHtmlTextDirection); | |
| 322 | 318 |
| 323 static const StringPiece incognito_tab_html( | 319 static const StringPiece incognito_tab_html( |
| 324 ResourceBundle::GetSharedInstance().GetRawDataResource( | 320 ResourceBundle::GetSharedInstance().GetRawDataResource( |
| 325 IDR_INCOGNITO_TAB_HTML)); | 321 IDR_INCOGNITO_TAB_HTML)); |
| 326 | 322 |
| 327 const std::string full_html = jstemplate_builder::GetTemplateHtml( | 323 const std::string full_html = jstemplate_builder::GetTemplateHtml( |
| 328 incognito_tab_html, &localized_strings, "t" /* template root node id */); | 324 incognito_tab_html, &localized_strings, "t" /* template root node id */); |
| 329 | 325 |
| 330 scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes); | 326 scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes); |
| 331 html_bytes->data.resize(full_html.size()); | 327 html_bytes->data.resize(full_html.size()); |
| (...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1060 NewRunnableMethod(&chrome_url_data_manager, | 1056 NewRunnableMethod(&chrome_url_data_manager, |
| 1061 &ChromeURLDataManager::AddDataSource, | 1057 &ChromeURLDataManager::AddDataSource, |
| 1062 html_source)); | 1058 html_source)); |
| 1063 } | 1059 } |
| 1064 } | 1060 } |
| 1065 } | 1061 } |
| 1066 | 1062 |
| 1067 NewTabUI::~NewTabUI() { | 1063 NewTabUI::~NewTabUI() { |
| 1068 } | 1064 } |
| 1069 | 1065 |
| OLD | NEW |