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

Side by Side Diff: chrome/browser/dom_ui/new_tab_ui.cc

Issue 217020: Add theme promo to NTP (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/dom_ui/dom_ui_theme_source.cc ('k') | chrome/browser/resources/new_new_tab.css » ('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) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 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 <set> 9 #include <set>
10 10
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 localized_strings.SetString(L"showhidelisttooltip", 388 localized_strings.SetString(L"showhidelisttooltip",
389 l10n_util::GetString(IDS_NEW_TAB_SHOW_HIDE_LIST_TOOLTIP)); 389 l10n_util::GetString(IDS_NEW_TAB_SHOW_HIDE_LIST_TOOLTIP));
390 localized_strings.SetString(L"pagedisplaytooltip", 390 localized_strings.SetString(L"pagedisplaytooltip",
391 l10n_util::GetString(IDS_NEW_TAB_PAGE_DISPLAY_TOOLTIP)); 391 l10n_util::GetString(IDS_NEW_TAB_PAGE_DISPLAY_TOOLTIP));
392 localized_strings.SetString(L"firstrunnotification", 392 localized_strings.SetString(L"firstrunnotification",
393 l10n_util::GetString(IDS_NEW_TAB_FIRST_RUN_NOTIFICATION)); 393 l10n_util::GetString(IDS_NEW_TAB_FIRST_RUN_NOTIFICATION));
394 localized_strings.SetString(L"closefirstrunnotification", 394 localized_strings.SetString(L"closefirstrunnotification",
395 l10n_util::GetString(IDS_NEW_TAB_CLOSE_FIRST_RUN_NOTIFICATION)); 395 l10n_util::GetString(IDS_NEW_TAB_CLOSE_FIRST_RUN_NOTIFICATION));
396 localized_strings.SetString(L"makethishomepage", 396 localized_strings.SetString(L"makethishomepage",
397 l10n_util::GetString(IDS_NEW_TAB_MAKE_THIS_HOMEPAGE)); 397 l10n_util::GetString(IDS_NEW_TAB_MAKE_THIS_HOMEPAGE));
398 398 localized_strings.SetString(L"themelink",
399 l10n_util::GetString(IDS_THEMES_GALLERY_URL));
399 // Don't initiate the sync related message passing with the page if the sync 400 // Don't initiate the sync related message passing with the page if the sync
400 // code is not present. 401 // code is not present.
401 if (profile_->GetProfileSyncService()) 402 if (profile_->GetProfileSyncService())
402 localized_strings.SetString(L"syncispresent", "true"); 403 localized_strings.SetString(L"syncispresent", "true");
403 else 404 else
404 localized_strings.SetString(L"syncispresent", "false"); 405 localized_strings.SetString(L"syncispresent", "false");
405 406
406 if (!profile_->GetPrefs()->GetBoolean(prefs::kHomePageIsNewTabPage)) 407 if (!profile_->GetPrefs()->GetBoolean(prefs::kHomePageIsNewTabPage))
407 localized_strings.SetString(L"showsetashomepage", "true"); 408 localized_strings.SetString(L"showsetashomepage", "true");
408 409
409 SetFontAndTextDirection(&localized_strings); 410 SetFontAndTextDirection(&localized_strings);
410 411
411 // Let the tab know whether it's the first tab being viewed. 412 // Let the tab know whether it's the first tab being viewed.
412 localized_strings.SetString(L"firstview", 413 if (first_view_) {
413 first_view_ ? L"true" : std::wstring()); 414 localized_strings.SetString(L"firstview", L"true");
414 first_view_ = false; 415
416 // Decrement ntp promo counter; the default value is specified in
417 // Browser::RegisterUserPrefs.
418 profile_->GetPrefs()->SetInteger(prefs::kNTPThemePromoRemaining,
419 profile_->GetPrefs()->GetInteger(prefs::kNTPThemePromoRemaining) - 1);
420 first_view_ = false;
421 }
415 422
416 // Control fade and resize animations. 423 // Control fade and resize animations.
417 std::wstring anim = 424 std::wstring anim =
418 Animation::ShouldRenderRichAnimation() ? L"true" : L"false"; 425 Animation::ShouldRenderRichAnimation() ? L"true" : L"false";
419 localized_strings.SetString(L"anim", anim); 426 localized_strings.SetString(L"anim", anim);
420 427
421 // In case we have the new new tab page enabled we first try to read the file 428 // In case we have the new new tab page enabled we first try to read the file
422 // provided on the command line. If that fails we just get the resource from 429 // provided on the command line. If that fails we just get the resource from
423 // the resource bundle. 430 // the resource bundle.
424 base::StringPiece new_tab_html; 431 base::StringPiece new_tab_html;
(...skipping 1302 matching lines...) Expand 10 before | Expand all | Expand 10 after
1727 bool NewTabUI::WebResourcesEnabled() { 1734 bool NewTabUI::WebResourcesEnabled() {
1728 const CommandLine* command_line = CommandLine::ForCurrentProcess(); 1735 const CommandLine* command_line = CommandLine::ForCurrentProcess();
1729 return !command_line->HasSwitch(switches::kDisableWebResources); 1736 return !command_line->HasSwitch(switches::kDisableWebResources);
1730 } 1737 }
1731 1738
1732 // static 1739 // static
1733 bool NewTabUI::FirstRunDisabled() { 1740 bool NewTabUI::FirstRunDisabled() {
1734 const CommandLine* command_line = CommandLine::ForCurrentProcess(); 1741 const CommandLine* command_line = CommandLine::ForCurrentProcess();
1735 return command_line->HasSwitch(switches::kDisableNewTabFirstRun); 1742 return command_line->HasSwitch(switches::kDisableNewTabFirstRun);
1736 } 1743 }
OLDNEW
« no previous file with comments | « chrome/browser/dom_ui/dom_ui_theme_source.cc ('k') | chrome/browser/resources/new_new_tab.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698