Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Side by Side Diff: chrome/browser/ui/webui/ntp/ntp_resource_cache.cc

Issue 208683007: Update incognito and guest browsing new tab page: (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix ChromeOS build error, remove surplus font attribute Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 new_tab_incognito_html_ = NULL; 287 new_tab_incognito_html_ = NULL;
288 new_tab_html_ = NULL; 288 new_tab_html_ = NULL;
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_heading_ids = IDS_NEW_TAB_OTR_HEADING;
298 int new_tab_link_ids = IDS_NEW_TAB_OTR_LEARN_MORE_LINK;
299 int new_tab_warning_ids = IDS_NEW_TAB_OTR_MESSAGE_WARNING;
297 int new_tab_html_idr = IDR_INCOGNITO_TAB_HTML; 300 int new_tab_html_idr = IDR_INCOGNITO_TAB_HTML;
298 const char* new_tab_link = kLearnMoreIncognitoUrl; 301 const char* new_tab_link = kLearnMoreIncognitoUrl;
299 302
300 // TODO(altimofeev): consider implementation without 'if def' usage. 303 // TODO(altimofeev): consider implementation without 'if def' usage.
301 #if defined(OS_CHROMEOS) 304 #if defined(OS_CHROMEOS)
302 if (profile_->IsGuestSession()) { 305 if (profile_->IsGuestSession()) {
303 new_tab_message_ids = IDS_NEW_TAB_GUEST_SESSION_MESSAGE; 306 new_tab_message_ids = IDS_NEW_TAB_GUEST_SESSION_MESSAGE;
307 new_tab_heading_ids = IDS_NEW_TAB_GUEST_SESSION_HEADING;
308 new_tab_link_ids = IDS_NEW_TAB_GUEST_SESSION_LEARN_MORE_LINK;
edwardjung 2014/04/22 14:24:35 Made changes here so that it's in line with the ot
Evan Stade 2014/04/22 17:52:52 You should ping someone (altimofeev looks like a g
edwardjung 2014/04/23 10:42:10 Confirmed with the Moscow team that this is still
304 new_tab_html_idr = IDR_GUEST_SESSION_TAB_HTML; 309 new_tab_html_idr = IDR_GUEST_SESSION_TAB_HTML;
305 new_tab_link = kLearnMoreGuestSessionUrl; 310 new_tab_link = kLearnMoreGuestSessionUrl;
306 311
307 policy::BrowserPolicyConnectorChromeOS* connector = 312 policy::BrowserPolicyConnectorChromeOS* connector =
308 g_browser_process->platform_part()->browser_policy_connector_chromeos(); 313 g_browser_process->platform_part()->browser_policy_connector_chromeos();
309 std::string enterprise_domain = connector->GetEnterpriseDomain(); 314 std::string enterprise_domain = connector->GetEnterpriseDomain();
310 if (!enterprise_domain.empty()) { 315 if (!enterprise_domain.empty()) {
311 // Device is enterprise enrolled. 316 // Device is enterprise enrolled.
312 localized_strings.SetString("enterpriseInfoVisible", "true"); 317 localized_strings.SetString("enterpriseInfoVisible", "true");
313 base::string16 enterprise_info = l10n_util::GetStringFUTF16( 318 base::string16 enterprise_info = l10n_util::GetStringFUTF16(
314 IDS_DEVICE_OWNED_BY_NOTICE, 319 IDS_DEVICE_OWNED_BY_NOTICE,
315 base::UTF8ToUTF16(enterprise_domain)); 320 base::UTF8ToUTF16(enterprise_domain));
316 localized_strings.SetString("enterpriseInfoMessage", enterprise_info); 321 localized_strings.SetString("enterpriseInfoMessage", enterprise_info);
317 localized_strings.SetString("learnMore", 322 localized_strings.SetString("learnMore",
318 l10n_util::GetStringUTF16(IDS_LEARN_MORE)); 323 l10n_util::GetStringUTF16(IDS_LEARN_MORE));
319 localized_strings.SetString("enterpriseInfoHintLink", 324 localized_strings.SetString("enterpriseInfoHintLink",
320 GetUrlWithLang(GURL(chrome::kLearnMoreEnterpriseURL))); 325 GetUrlWithLang(GURL(chrome::kLearnMoreEnterpriseURL)));
321 } else { 326 } else {
322 localized_strings.SetString("enterpriseInfoVisible", "false"); 327 localized_strings.SetString("enterpriseInfoVisible", "false");
323 } 328 }
324 } 329 }
325 #endif 330 #endif
326 331
327 localized_strings.SetString("content", 332 localized_strings.SetString("message",
328 l10n_util::GetStringFUTF16(new_tab_message_ids, 333 l10n_util::GetStringUTF16(new_tab_message_ids));
329 GetUrlWithLang(GURL(new_tab_link)))); 334 localized_strings.SetString("heading",
330 localized_strings.SetString("extensionsmessage", 335 l10n_util::GetStringUTF16(new_tab_heading_ids));
331 l10n_util::GetStringFUTF16( 336 localized_strings.SetString("learnMore",
332 IDS_NEW_TAB_OTR_EXTENSIONS_MESSAGE, 337 l10n_util::GetStringUTF16(new_tab_link_ids));
333 base::ASCIIToUTF16(chrome::kChromeUIExtensionsURL))); 338 localized_strings.SetString("learnMoreLink",
339 GetUrlWithLang(GURL(new_tab_link)));
340 localized_strings.SetString("warning",
341 l10n_util::GetStringUTF16(new_tab_warning_ids));
342
334 bool bookmark_bar_attached = profile_->GetPrefs()->GetBoolean( 343 bool bookmark_bar_attached = profile_->GetPrefs()->GetBoolean(
335 prefs::kShowBookmarkBar); 344 prefs::kShowBookmarkBar);
336 localized_strings.SetBoolean("bookmarkbarattached", bookmark_bar_attached); 345 localized_strings.SetBoolean("bookmarkbarattached", bookmark_bar_attached);
337 346
338 webui::SetFontAndTextDirection(&localized_strings); 347 webui::SetFontAndTextDirection(&localized_strings);
339 348
340 static const base::StringPiece incognito_tab_html( 349 static const base::StringPiece incognito_tab_html(
341 ResourceBundle::GetSharedInstance().GetRawDataResource( 350 ResourceBundle::GetSharedInstance().GetRawDataResource(
342 new_tab_html_idr)); 351 new_tab_html_idr));
343 352
344 std::string full_html = webui::GetI18nTemplateHtml( 353 std::string full_html = webui::GetI18nTemplateHtml(
345 incognito_tab_html, &localized_strings); 354 incognito_tab_html, &localized_strings);
346 355
347 new_tab_incognito_html_ = base::RefCountedString::TakeString(&full_html); 356 new_tab_incognito_html_ = base::RefCountedString::TakeString(&full_html);
348 } 357 }
349 358
350 void NTPResourceCache::CreateNewTabGuestHTML() { 359 void NTPResourceCache::CreateNewTabGuestHTML() {
351 base::DictionaryValue localized_strings; 360 base::DictionaryValue localized_strings;
352 localized_strings.SetString("title", 361 localized_strings.SetString("title",
353 l10n_util::GetStringUTF16(IDS_NEW_TAB_TITLE)); 362 l10n_util::GetStringUTF16(IDS_NEW_TAB_TITLE));
354 const char* new_tab_link = kLearnMoreGuestSessionUrl; 363 const char* new_tab_link = kLearnMoreGuestSessionUrl;
355 localized_strings.SetString("content", 364 int guest_tab_message_ids = IDS_NEW_TAB_GUEST_SESSION_MESSAGE;
356 l10n_util::GetStringFUTF16(IDS_NEW_TAB_GUEST_SESSION_MESSAGE, 365 int guest_tab_heading_ids = IDS_NEW_TAB_GUEST_SESSION_HEADING;
357 GetUrlWithLang(GURL(new_tab_link)))); 366 int guest_tab_link_ids = IDS_NEW_TAB_GUEST_SESSION_LEARN_MORE_LINK;
367
368 localized_strings.SetString("message",
369 l10n_util::GetStringUTF16(guest_tab_message_ids));
370 localized_strings.SetString("heading",
371 l10n_util::GetStringUTF16(guest_tab_heading_ids));
372 localized_strings.SetString("learnMore",
373 l10n_util::GetStringUTF16(guest_tab_link_ids));
374 localized_strings.SetString("learnMoreLink",
375 GetUrlWithLang(GURL(new_tab_link)));
358 376
359 webui::SetFontAndTextDirection(&localized_strings); 377 webui::SetFontAndTextDirection(&localized_strings);
360 378
361 static const base::StringPiece guest_tab_html( 379 static const base::StringPiece guest_tab_html(
362 ResourceBundle::GetSharedInstance().GetRawDataResource( 380 ResourceBundle::GetSharedInstance().GetRawDataResource(
363 IDR_GUEST_TAB_HTML)); 381 IDR_GUEST_TAB_HTML));
364 382
365 std::string full_html = webui::GetI18nTemplateHtml( 383 std::string full_html = webui::GetI18nTemplateHtml(
366 guest_tab_html, &localized_strings); 384 guest_tab_html, &localized_strings);
367 385
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
707 // Get our template. 725 // Get our template.
708 static const base::StringPiece new_tab_theme_css( 726 static const base::StringPiece new_tab_theme_css(
709 ResourceBundle::GetSharedInstance().GetRawDataResource( 727 ResourceBundle::GetSharedInstance().GetRawDataResource(
710 IDR_NEW_TAB_4_THEME_CSS)); 728 IDR_NEW_TAB_4_THEME_CSS));
711 729
712 // Create the string from our template and the replacements. 730 // Create the string from our template and the replacements.
713 std::string css_string; 731 std::string css_string;
714 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); 732 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL);
715 new_tab_css_ = base::RefCountedString::TakeString(&css_string); 733 new_tab_css_ = base::RefCountedString::TakeString(&css_string);
716 } 734 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698