| 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 <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 new_tab_html_ = NULL; | 231 new_tab_html_ = NULL; |
| 232 } else { | 232 } else { |
| 233 NOTREACHED(); | 233 NOTREACHED(); |
| 234 } | 234 } |
| 235 } | 235 } |
| 236 | 236 |
| 237 void NTPResourceCache::CreateNewTabIncognitoHTML() { | 237 void NTPResourceCache::CreateNewTabIncognitoHTML() { |
| 238 DictionaryValue localized_strings; | 238 DictionaryValue localized_strings; |
| 239 localized_strings.SetString("title", | 239 localized_strings.SetString("title", |
| 240 l10n_util::GetStringUTF16(IDS_NEW_TAB_TITLE)); | 240 l10n_util::GetStringUTF16(IDS_NEW_TAB_TITLE)); |
| 241 int new_tab_message_ids = IDS_NEW_TAB_OTR_MESSAGE; | 241 int new_tab_message_ids = IDS_NEW_TAB_INCOGNITO_MESSAGE; |
| 242 int new_tab_html_idr = IDR_INCOGNITO_TAB_HTML; | 242 int new_tab_html_idr = IDR_INCOGNITO_TAB_HTML; |
| 243 const char* new_tab_link = kLearnMoreIncognitoUrl; | 243 const char* new_tab_link = kLearnMoreIncognitoUrl; |
| 244 // TODO(altimofeev): consider implementation without 'if def' usage. | 244 // TODO(altimofeev): consider implementation without 'if def' usage. |
| 245 #if defined(OS_CHROMEOS) | 245 #if defined(OS_CHROMEOS) |
| 246 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kGuestSession)) { | 246 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kGuestSession)) { |
| 247 new_tab_message_ids = IDS_NEW_TAB_GUEST_SESSION_MESSAGE; | 247 new_tab_message_ids = IDS_NEW_TAB_GUEST_SESSION_MESSAGE; |
| 248 new_tab_html_idr = IDR_GUEST_SESSION_TAB_HTML; | 248 new_tab_html_idr = IDR_GUEST_SESSION_TAB_HTML; |
| 249 new_tab_link = kLearnMoreGuestSessionUrl; | 249 new_tab_link = kLearnMoreGuestSessionUrl; |
| 250 } | 250 } |
| 251 #endif | 251 #endif |
| 252 localized_strings.SetString("content", | 252 localized_strings.SetString("content", |
| 253 l10n_util::GetStringFUTF16(new_tab_message_ids, | 253 l10n_util::GetStringFUTF16(new_tab_message_ids, |
| 254 GetUrlWithLang(GURL(new_tab_link)))); | 254 GetUrlWithLang(GURL(new_tab_link)))); |
| 255 localized_strings.SetString("extensionsmessage", | 255 localized_strings.SetString("extensionsmessage", |
| 256 l10n_util::GetStringFUTF16( | 256 l10n_util::GetStringFUTF16( |
| 257 IDS_NEW_TAB_OTR_EXTENSIONS_MESSAGE, | 257 IDS_NEW_TAB_INCOGNITO_EXTENSIONS_MESSAGE, |
| 258 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME), | |
| 259 ASCIIToUTF16(std::string(chrome::kChromeUISettingsURL) + | 258 ASCIIToUTF16(std::string(chrome::kChromeUISettingsURL) + |
| 260 chrome::kExtensionsSubPage))); | 259 chrome::kExtensionsSubPage))); |
| 261 bool bookmark_bar_attached = profile_->GetPrefs()->GetBoolean( | 260 bool bookmark_bar_attached = profile_->GetPrefs()->GetBoolean( |
| 262 prefs::kShowBookmarkBar); | 261 prefs::kShowBookmarkBar); |
| 263 localized_strings.SetString("bookmarkbarattached", | 262 localized_strings.SetString("bookmarkbarattached", |
| 264 bookmark_bar_attached ? "true" : "false"); | 263 bookmark_bar_attached ? "true" : "false"); |
| 265 | 264 |
| 266 ChromeURLDataManager::DataSource::SetFontAndTextDirection(&localized_strings); | 265 ChromeURLDataManager::DataSource::SetFontAndTextDirection(&localized_strings); |
| 267 | 266 |
| 268 static const base::StringPiece incognito_tab_html( | 267 static const base::StringPiece incognito_tab_html( |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 // Get our template. | 530 // Get our template. |
| 532 static const base::StringPiece new_tab_theme_css( | 531 static const base::StringPiece new_tab_theme_css( |
| 533 ResourceBundle::GetSharedInstance().GetRawDataResource( | 532 ResourceBundle::GetSharedInstance().GetRawDataResource( |
| 534 IDR_NEW_TAB_4_THEME_CSS)); | 533 IDR_NEW_TAB_4_THEME_CSS)); |
| 535 | 534 |
| 536 // Create the string from our template and the replacements. | 535 // Create the string from our template and the replacements. |
| 537 std::string css_string; | 536 std::string css_string; |
| 538 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); | 537 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); |
| 539 new_tab_css_ = base::RefCountedString::TakeString(&css_string); | 538 new_tab_css_ = base::RefCountedString::TakeString(&css_string); |
| 540 } | 539 } |
| OLD | NEW |