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

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

Issue 1140813003: NTP Zombie Code Slayer III, The Saga Continues: Foreign Sessions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@suggestions-page
Patch Set: Created 5 years, 7 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
« no previous file with comments | « chrome/browser/ui/webui/ntp/new_tab_ui.cc ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 load_time_data.SetString("applaunchtypewindow", 454 load_time_data.SetString("applaunchtypewindow",
455 l10n_util::GetStringUTF16(IDS_APP_CONTEXT_MENU_OPEN_WINDOW)); 455 l10n_util::GetStringUTF16(IDS_APP_CONTEXT_MENU_OPEN_WINDOW));
456 load_time_data.SetString("applaunchtypefullscreen", 456 load_time_data.SetString("applaunchtypefullscreen",
457 l10n_util::GetStringUTF16(IDS_APP_CONTEXT_MENU_OPEN_FULLSCREEN)); 457 l10n_util::GetStringUTF16(IDS_APP_CONTEXT_MENU_OPEN_FULLSCREEN));
458 load_time_data.SetString("syncpromotext", 458 load_time_data.SetString("syncpromotext",
459 l10n_util::GetStringUTF16(IDS_SYNC_START_SYNC_BUTTON_LABEL)); 459 l10n_util::GetStringUTF16(IDS_SYNC_START_SYNC_BUTTON_LABEL));
460 load_time_data.SetString("syncLinkText", 460 load_time_data.SetString("syncLinkText",
461 l10n_util::GetStringUTF16(IDS_SYNC_ADVANCED_OPTIONS)); 461 l10n_util::GetStringUTF16(IDS_SYNC_ADVANCED_OPTIONS));
462 load_time_data.SetBoolean("shouldShowSyncLogin", 462 load_time_data.SetBoolean("shouldShowSyncLogin",
463 NTPLoginHandler::ShouldShow(profile_)); 463 NTPLoginHandler::ShouldShow(profile_));
464 load_time_data.SetString("otherSessions",
465 l10n_util::GetStringUTF16(IDS_NEW_TAB_OTHER_SESSIONS_LABEL));
466 load_time_data.SetString("otherSessionsEmpty",
467 l10n_util::GetStringUTF16(IDS_NEW_TAB_OTHER_SESSIONS_EMPTY));
468 load_time_data.SetString("otherSessionsLearnMoreUrl",
469 l10n_util::GetStringUTF16(IDS_NEW_TAB_OTHER_SESSIONS_LEARN_MORE_URL));
470 load_time_data.SetString("learnMore", 464 load_time_data.SetString("learnMore",
471 l10n_util::GetStringUTF16(IDS_LEARN_MORE)); 465 l10n_util::GetStringUTF16(IDS_LEARN_MORE));
472 const std::string& app_locale = g_browser_process->GetApplicationLocale(); 466 const std::string& app_locale = g_browser_process->GetApplicationLocale();
473 load_time_data.SetString("webStoreLink", 467 load_time_data.SetString("webStoreLink",
474 google_util::AppendGoogleLocaleParam( 468 google_util::AppendGoogleLocaleParam(
475 GURL(extension_urls::GetWebstoreLaunchURL()), app_locale).spec()); 469 GURL(extension_urls::GetWebstoreLaunchURL()), app_locale).spec());
476 load_time_data.SetString("appInstallHintText", 470 load_time_data.SetString("appInstallHintText",
477 l10n_util::GetStringUTF16(IDS_NEW_TAB_APP_INSTALL_HINT_LABEL)); 471 l10n_util::GetStringUTF16(IDS_NEW_TAB_APP_INSTALL_HINT_LABEL));
478 load_time_data.SetString("collapseSessionMenuItemText",
479 l10n_util::GetStringUTF16(IDS_NEW_TAB_OTHER_SESSIONS_COLLAPSE_SESSION));
480 load_time_data.SetString("expandSessionMenuItemText",
481 l10n_util::GetStringUTF16(IDS_NEW_TAB_OTHER_SESSIONS_EXPAND_SESSION));
482 load_time_data.SetString("restoreSessionMenuItemText",
483 l10n_util::GetStringUTF16(IDS_NEW_TAB_OTHER_SESSIONS_OPEN_ALL));
484 load_time_data.SetString("learn_more", 472 load_time_data.SetString("learn_more",
485 l10n_util::GetStringUTF16(IDS_LEARN_MORE)); 473 l10n_util::GetStringUTF16(IDS_LEARN_MORE));
486 load_time_data.SetString("tile_grid_screenreader_accessible_description", 474 load_time_data.SetString("tile_grid_screenreader_accessible_description",
487 l10n_util::GetStringUTF16(IDS_NEW_TAB_TILE_GRID_ACCESSIBLE_DESCRIPTION)); 475 l10n_util::GetStringUTF16(IDS_NEW_TAB_TILE_GRID_ACCESSIBLE_DESCRIPTION));
488 load_time_data.SetString("page_switcher_change_title", 476 load_time_data.SetString("page_switcher_change_title",
489 l10n_util::GetStringUTF16(IDS_NEW_TAB_PAGE_SWITCHER_CHANGE_TITLE)); 477 l10n_util::GetStringUTF16(IDS_NEW_TAB_PAGE_SWITCHER_CHANGE_TITLE));
490 load_time_data.SetString("page_switcher_same_title", 478 load_time_data.SetString("page_switcher_same_title",
491 l10n_util::GetStringUTF16(IDS_NEW_TAB_PAGE_SWITCHER_SAME_TITLE)); 479 l10n_util::GetStringUTF16(IDS_NEW_TAB_PAGE_SWITCHER_SAME_TITLE));
492 load_time_data.SetString("appsPromoTitle", 480 load_time_data.SetString("appsPromoTitle",
493 l10n_util::GetStringUTF16(IDS_NEW_TAB_PAGE_APPS_PROMO_TITLE)); 481 l10n_util::GetStringUTF16(IDS_NEW_TAB_PAGE_APPS_PROMO_TITLE));
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 530
543 NotificationPromo bubble_promo; 531 NotificationPromo bubble_promo;
544 bubble_promo.InitFromPrefs(NotificationPromo::NTP_BUBBLE_PROMO); 532 bubble_promo.InitFromPrefs(NotificationPromo::NTP_BUBBLE_PROMO);
545 if (bubble_promo.CanShow()) { 533 if (bubble_promo.CanShow()) {
546 load_time_data.SetString("bubblePromoText", 534 load_time_data.SetString("bubblePromoText",
547 bubble_promo.promo_text()); 535 bubble_promo.promo_text());
548 DVLOG(1) << "Bubble promo:" << bubble_promo.promo_text(); 536 DVLOG(1) << "Bubble promo:" << bubble_promo.promo_text();
549 } 537 }
550 } 538 }
551 539
552 // Determine whether to show the menu for accessing tabs on other devices.
553 bool show_other_sessions_menu =
554 should_show_other_devices_menu_ &&
555 !base::CommandLine::ForCurrentProcess()->HasSwitch(
556 switches::kDisableNTPOtherSessionsMenu);
557 load_time_data.SetBoolean("showOtherSessionsMenu", show_other_sessions_menu);
558 load_time_data.SetBoolean( 540 load_time_data.SetBoolean(
559 "isUserSignedIn", 541 "isUserSignedIn",
560 SigninManagerFactory::GetForProfile(profile_)->IsAuthenticated()); 542 SigninManagerFactory::GetForProfile(profile_)->IsAuthenticated());
561 543
562 // Load the new tab page appropriate for this build. 544 // Load the new tab page appropriate for this build.
563 base::StringPiece new_tab_html(ResourceBundle::GetSharedInstance(). 545 base::StringPiece new_tab_html(ResourceBundle::GetSharedInstance().
564 GetRawDataResource(IDR_NEW_TAB_4_HTML)); 546 GetRawDataResource(IDR_NEW_TAB_4_HTML));
565 std::string full_html = 547 std::string full_html =
566 webui::GetI18nTemplateHtml(new_tab_html, &load_time_data); 548 webui::GetI18nTemplateHtml(new_tab_html, &load_time_data);
567 new_tab_html_ = base::RefCountedString::TakeString(&full_html); 549 new_tab_html_ = base::RefCountedString::TakeString(&full_html);
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
719 // Get our template. 701 // Get our template.
720 static const base::StringPiece new_tab_theme_css( 702 static const base::StringPiece new_tab_theme_css(
721 ResourceBundle::GetSharedInstance().GetRawDataResource( 703 ResourceBundle::GetSharedInstance().GetRawDataResource(
722 IDR_NEW_TAB_4_THEME_CSS)); 704 IDR_NEW_TAB_4_THEME_CSS));
723 705
724 // Create the string from our template and the replacements. 706 // Create the string from our template and the replacements.
725 std::string css_string; 707 std::string css_string;
726 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); 708 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL);
727 new_tab_css_ = base::RefCountedString::TakeString(&css_string); 709 new_tab_css_ = base::RefCountedString::TakeString(&css_string);
728 } 710 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/ntp/new_tab_ui.cc ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698