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

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

Issue 525013: Suppress promotional line and image on non-English builds of Chrome.... (Closed) Base URL: svn://chrome-svn/chrome/branches/249/src/
Patch Set: '' Created 10 years, 11 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') | no next file » | 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
11 #include "app/animation.h" 11 #include "app/animation.h"
12 #include "app/l10n_util.h" 12 #include "app/l10n_util.h"
13 #include "app/resource_bundle.h" 13 #include "app/resource_bundle.h"
14 #include "app/theme_provider.h" 14 #include "app/theme_provider.h"
15 #include "base/command_line.h" 15 #include "base/command_line.h"
16 #include "base/file_util.h" 16 #include "base/file_util.h"
17 #include "base/histogram.h" 17 #include "base/histogram.h"
18 #include "base/singleton.h" 18 #include "base/singleton.h"
19 #include "base/string_piece.h" 19 #include "base/string_piece.h"
20 #include "base/thread.h" 20 #include "base/thread.h"
21 #include "chrome/browser/browser.h" 21 #include "chrome/browser/browser.h"
22 #include "chrome/browser/browser_process.h"
22 #include "chrome/browser/chrome_thread.h" 23 #include "chrome/browser/chrome_thread.h"
23 #include "chrome/browser/dom_ui/dom_ui_theme_source.h" 24 #include "chrome/browser/dom_ui/dom_ui_theme_source.h"
24 #include "chrome/browser/dom_ui/most_visited_handler.h" 25 #include "chrome/browser/dom_ui/most_visited_handler.h"
25 #include "chrome/browser/dom_ui/new_tab_page_sync_handler.h" 26 #include "chrome/browser/dom_ui/new_tab_page_sync_handler.h"
26 #include "chrome/browser/dom_ui/shown_sections_handler.h" 27 #include "chrome/browser/dom_ui/shown_sections_handler.h"
27 #include "chrome/browser/dom_ui/tips_handler.h" 28 #include "chrome/browser/dom_ui/tips_handler.h"
28 #include "chrome/browser/google_util.h" 29 #include "chrome/browser/google_util.h"
29 #include "chrome/browser/metrics/user_metrics.h" 30 #include "chrome/browser/metrics/user_metrics.h"
30 #include "chrome/browser/profile.h" 31 #include "chrome/browser/profile.h"
31 #include "chrome/browser/renderer_host/render_view_host.h" 32 #include "chrome/browser/renderer_host/render_view_host.h"
(...skipping 877 matching lines...) Expand 10 before | Expand all | Expand 10 after
909 l10n_util::GetString(IDS_THEMES_GALLERY_URL)); 910 l10n_util::GetString(IDS_THEMES_GALLERY_URL));
910 localized_strings.SetString(L"tips", 911 localized_strings.SetString(L"tips",
911 l10n_util::GetString(IDS_NEW_TAB_TIPS)); 912 l10n_util::GetString(IDS_NEW_TAB_TIPS));
912 localized_strings.SetString(L"sync", 913 localized_strings.SetString(L"sync",
913 l10n_util::GetString(IDS_NEW_TAB_SHOW_HIDE_BOOKMARK_SYNC)); 914 l10n_util::GetString(IDS_NEW_TAB_SHOW_HIDE_BOOKMARK_SYNC));
914 localized_strings.SetString(L"promonew", 915 localized_strings.SetString(L"promonew",
915 l10n_util::GetString(IDS_NTP_PROMOTION_NEW)); 916 l10n_util::GetString(IDS_NTP_PROMOTION_NEW));
916 std::wstring extensionLink = ASCIIToWide( 917 std::wstring extensionLink = ASCIIToWide(
917 google_util::AppendGoogleLocaleParam( 918 google_util::AppendGoogleLocaleParam(
918 GURL(extension_urls::kGalleryBrowsePrefix)).spec()); 919 GURL(extension_urls::kGalleryBrowsePrefix)).spec());
919 localized_strings.SetString(L"promomessage", 920
920 l10n_util::GetStringF(IDS_NTP_PROMO_MESSAGE, 921 if (StartsWithASCII(g_browser_process->GetApplicationLocale(),
921 l10n_util::GetString(IDS_PRODUCT_NAME), extensionLink)); 922 "en", false)) { // false = compare not case-sensitive.
923 // In en locales, promote sync and extensions.
924 localized_strings.SetString(L"promomessage",
925 l10n_util::GetStringF(IDS_NTP_PROMO_MESSAGE,
926 l10n_util::GetString(IDS_PRODUCT_NAME), extensionLink));
927 } else {
928 // In non-en locales, only promote sync. This message is a hack, using an
929 // available translated string to promote bookmark sync without extensions.
930 localized_strings.SetString(L"promomessage",
931 L"<button>" +
932 l10n_util::GetString(IDS_SYNC_START_SYNC_BUTTON_LABEL) +
933 L"</button>");
934 }
922 localized_strings.SetString(L"extensionslink", extensionLink); 935 localized_strings.SetString(L"extensionslink", extensionLink);
923 localized_strings.SetString(L"close", l10n_util::GetString(IDS_CLOSE)); 936 localized_strings.SetString(L"close", l10n_util::GetString(IDS_CLOSE));
924 937
925 // Don't initiate the sync related message passing with the page if the sync 938 // Don't initiate the sync related message passing with the page if the sync
926 // code is not present. 939 // code is not present.
927 if (profile->GetProfileSyncService()) 940 if (profile->GetProfileSyncService())
928 localized_strings.SetString(L"syncispresent", "true"); 941 localized_strings.SetString(L"syncispresent", "true");
929 else 942 else
930 localized_strings.SetString(L"syncispresent", "false"); 943 localized_strings.SetString(L"syncispresent", "false");
931 944
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
985 full_html_.append(json_html); 998 full_html_.append(json_html);
986 size_t after_offset = pos + template_data_placeholder.size(); 999 size_t after_offset = pos + template_data_placeholder.size();
987 full_html_.append(new_tab_html.data() + after_offset, 1000 full_html_.append(new_tab_html.data() + after_offset,
988 new_tab_html.size() - after_offset); 1001 new_tab_html.size() - after_offset);
989 } else { 1002 } else {
990 NOTREACHED(); 1003 NOTREACHED();
991 full_html_.assign(new_tab_html.data(), new_tab_html.size()); 1004 full_html_.assign(new_tab_html.data(), new_tab_html.size());
992 } 1005 }
993 jstemplate_builder::AppendI18nTemplateProcessHtml(&full_html_); 1006 jstemplate_builder::AppendI18nTemplateProcessHtml(&full_html_);
994 } 1007 }
OLDNEW
« no previous file with comments | « chrome/browser/dom_ui/dom_ui_theme_source.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698