| 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 <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 new_tab_css_ = NULL; | 289 new_tab_css_ = NULL; |
| 290 } | 290 } |
| 291 | 291 |
| 292 void NTPResourceCache::CreateNewTabIncognitoHTML() { | 292 void NTPResourceCache::CreateNewTabIncognitoHTML() { |
| 293 base::DictionaryValue localized_strings; | 293 base::DictionaryValue localized_strings; |
| 294 localized_strings.SetString("title", | 294 localized_strings.SetString("title", |
| 295 l10n_util::GetStringUTF16(IDS_NEW_TAB_TITLE)); | 295 l10n_util::GetStringUTF16(IDS_NEW_TAB_TITLE)); |
| 296 int new_tab_message_ids = IDS_NEW_TAB_OTR_MESSAGE; | 296 int new_tab_message_ids = IDS_NEW_TAB_OTR_MESSAGE; |
| 297 int new_tab_html_idr = IDR_INCOGNITO_TAB_HTML; | 297 int new_tab_html_idr = IDR_INCOGNITO_TAB_HTML; |
| 298 const char* new_tab_link = kLearnMoreIncognitoUrl; | 298 const char* new_tab_link = kLearnMoreIncognitoUrl; |
| 299 |
| 299 // TODO(altimofeev): consider implementation without 'if def' usage. | 300 // TODO(altimofeev): consider implementation without 'if def' usage. |
| 300 #if defined(OS_CHROMEOS) | 301 #if defined(OS_CHROMEOS) |
| 301 if (CommandLine::ForCurrentProcess()->HasSwitch( | 302 if (profile_->IsGuestSession()) { |
| 302 chromeos::switches::kGuestSession)) { | |
| 303 new_tab_message_ids = IDS_NEW_TAB_GUEST_SESSION_MESSAGE; | 303 new_tab_message_ids = IDS_NEW_TAB_GUEST_SESSION_MESSAGE; |
| 304 new_tab_html_idr = IDR_GUEST_SESSION_TAB_HTML; | 304 new_tab_html_idr = IDR_GUEST_SESSION_TAB_HTML; |
| 305 new_tab_link = kLearnMoreGuestSessionUrl; | 305 new_tab_link = kLearnMoreGuestSessionUrl; |
| 306 | 306 |
| 307 policy::BrowserPolicyConnectorChromeOS* connector = | 307 policy::BrowserPolicyConnectorChromeOS* connector = |
| 308 g_browser_process->platform_part()->browser_policy_connector_chromeos(); | 308 g_browser_process->platform_part()->browser_policy_connector_chromeos(); |
| 309 std::string enterprise_domain = connector->GetEnterpriseDomain(); | 309 std::string enterprise_domain = connector->GetEnterpriseDomain(); |
| 310 if (!enterprise_domain.empty()) { | 310 if (!enterprise_domain.empty()) { |
| 311 // Device is enterprise enrolled. | 311 // Device is enterprise enrolled. |
| 312 localized_strings.SetString("enterpriseInfoVisible", "true"); | 312 localized_strings.SetString("enterpriseInfoVisible", "true"); |
| 313 base::string16 enterprise_info = l10n_util::GetStringFUTF16( | 313 base::string16 enterprise_info = l10n_util::GetStringFUTF16( |
| 314 IDS_DEVICE_OWNED_BY_NOTICE, | 314 IDS_DEVICE_OWNED_BY_NOTICE, |
| 315 base::UTF8ToUTF16(enterprise_domain)); | 315 base::UTF8ToUTF16(enterprise_domain)); |
| 316 localized_strings.SetString("enterpriseInfoMessage", enterprise_info); | 316 localized_strings.SetString("enterpriseInfoMessage", enterprise_info); |
| 317 localized_strings.SetString("learnMore", | 317 localized_strings.SetString("learnMore", |
| 318 l10n_util::GetStringUTF16(IDS_LEARN_MORE)); | 318 l10n_util::GetStringUTF16(IDS_LEARN_MORE)); |
| 319 localized_strings.SetString("enterpriseInfoHintLink", | 319 localized_strings.SetString("enterpriseInfoHintLink", |
| 320 GetUrlWithLang(GURL(chrome::kLearnMoreEnterpriseURL))); | 320 GetUrlWithLang(GURL(chrome::kLearnMoreEnterpriseURL))); |
| 321 } else { | 321 } else { |
| 322 localized_strings.SetString("enterpriseInfoVisible", "false"); | 322 localized_strings.SetString("enterpriseInfoVisible", "false"); |
| 323 } | 323 } |
| 324 } | 324 } |
| 325 #endif | 325 #endif |
| 326 |
| 326 localized_strings.SetString("content", | 327 localized_strings.SetString("content", |
| 327 l10n_util::GetStringFUTF16(new_tab_message_ids, | 328 l10n_util::GetStringFUTF16(new_tab_message_ids, |
| 328 GetUrlWithLang(GURL(new_tab_link)))); | 329 GetUrlWithLang(GURL(new_tab_link)))); |
| 329 localized_strings.SetString("extensionsmessage", | 330 localized_strings.SetString("extensionsmessage", |
| 330 l10n_util::GetStringFUTF16( | 331 l10n_util::GetStringFUTF16( |
| 331 IDS_NEW_TAB_OTR_EXTENSIONS_MESSAGE, | 332 IDS_NEW_TAB_OTR_EXTENSIONS_MESSAGE, |
| 332 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME), | 333 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME), |
| 333 base::ASCIIToUTF16(chrome::kChromeUIExtensionsURL))); | 334 base::ASCIIToUTF16(chrome::kChromeUIExtensionsURL))); |
| 334 bool bookmark_bar_attached = profile_->GetPrefs()->GetBoolean( | 335 bool bookmark_bar_attached = profile_->GetPrefs()->GetBoolean( |
| 335 prefs::kShowBookmarkBar); | 336 prefs::kShowBookmarkBar); |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 707 // Get our template. | 708 // Get our template. |
| 708 static const base::StringPiece new_tab_theme_css( | 709 static const base::StringPiece new_tab_theme_css( |
| 709 ResourceBundle::GetSharedInstance().GetRawDataResource( | 710 ResourceBundle::GetSharedInstance().GetRawDataResource( |
| 710 IDR_NEW_TAB_4_THEME_CSS)); | 711 IDR_NEW_TAB_4_THEME_CSS)); |
| 711 | 712 |
| 712 // Create the string from our template and the replacements. | 713 // Create the string from our template and the replacements. |
| 713 std::string css_string; | 714 std::string css_string; |
| 714 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); | 715 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); |
| 715 new_tab_css_ = base::RefCountedString::TakeString(&css_string); | 716 new_tab_css_ = base::RefCountedString::TakeString(&css_string); |
| 716 } | 717 } |
| OLD | NEW |