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

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

Issue 8746007: ntp string cleanse (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <vector> 7 #include <vector>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 new_tab_incognito_html_ = base::RefCountedString::TakeString(&full_html); 275 new_tab_incognito_html_ = base::RefCountedString::TakeString(&full_html);
276 } 276 }
277 277
278 void NTPResourceCache::CreateNewTabHTML() { 278 void NTPResourceCache::CreateNewTabHTML() {
279 // TODO(estade): these strings should be defined in their relevant handlers 279 // TODO(estade): these strings should be defined in their relevant handlers
280 // (in GetLocalizedValues) and should have more legible names. 280 // (in GetLocalizedValues) and should have more legible names.
281 // Show the profile name in the title and most visited labels if the current 281 // Show the profile name in the title and most visited labels if the current
282 // profile is not the default. 282 // profile is not the default.
283 string16 apps = l10n_util::GetStringUTF16(IDS_NEW_TAB_APPS); 283 string16 apps = l10n_util::GetStringUTF16(IDS_NEW_TAB_APPS);
284 string16 title = l10n_util::GetStringUTF16(IDS_NEW_TAB_TITLE); 284 string16 title = l10n_util::GetStringUTF16(IDS_NEW_TAB_TITLE);
285 string16 most_visited = l10n_util::GetStringUTF16(IDS_NEW_TAB_MOST_VISITED);
286 DictionaryValue localized_strings; 285 DictionaryValue localized_strings;
287 localized_strings.SetString("bookmarkbarattached", 286 localized_strings.SetString("bookmarkbarattached",
288 profile_->GetPrefs()->GetBoolean(prefs::kShowBookmarkBar) ? 287 profile_->GetPrefs()->GetBoolean(prefs::kShowBookmarkBar) ?
289 "true" : "false"); 288 "true" : "false");
290 localized_strings.SetString("hasattribution", 289 localized_strings.SetString("hasattribution",
291 ThemeServiceFactory::GetForProfile(profile_)->HasCustomImage( 290 ThemeServiceFactory::GetForProfile(profile_)->HasCustomImage(
292 IDR_THEME_NTP_ATTRIBUTION) ? 291 IDR_THEME_NTP_ATTRIBUTION) ?
293 "true" : "false"); 292 "true" : "false");
294 localized_strings.SetString("apps", apps); 293 localized_strings.SetString("apps", apps);
295 localized_strings.SetString("title", title); 294 localized_strings.SetString("title", title);
296 localized_strings.SetString("mostvisited", most_visited); 295 localized_strings.SetString("mostvisited",
297 localized_strings.SetString("bookmarksPage", 296 l10n_util::GetStringUTF16(IDS_NEW_TAB_MOST_VISITED));
298 l10n_util::GetStringUTF16(IDS_NEW_TAB_BOOKMARKS_PAGE_TITLE));
299 localized_strings.SetString("restorethumbnails",
300 l10n_util::GetStringUTF16(IDS_NEW_TAB_RESTORE_THUMBNAILS_LINK));
301 localized_strings.SetString("restoreThumbnailsShort", 297 localized_strings.SetString("restoreThumbnailsShort",
302 l10n_util::GetStringUTF16(IDS_NEW_TAB_RESTORE_THUMBNAILS_SHORT_LINK)); 298 l10n_util::GetStringUTF16(IDS_NEW_TAB_RESTORE_THUMBNAILS_SHORT_LINK));
303 localized_strings.SetString("recentlyclosed", 299 localized_strings.SetString("recentlyclosed",
304 l10n_util::GetStringUTF16(IDS_NEW_TAB_RECENTLY_CLOSED)); 300 l10n_util::GetStringUTF16(IDS_NEW_TAB_RECENTLY_CLOSED));
305 localized_strings.SetString("closedwindowsingle", 301 localized_strings.SetString("closedwindowsingle",
306 l10n_util::GetStringUTF16(IDS_NEW_TAB_RECENTLY_CLOSED_WINDOW_SINGLE)); 302 l10n_util::GetStringUTF16(IDS_NEW_TAB_RECENTLY_CLOSED_WINDOW_SINGLE));
307 localized_strings.SetString("foreignsessions",
308 l10n_util::GetStringUTF16(IDS_SYNC_DATATYPE_TABS));
309 localized_strings.SetString("closedwindowmultiple", 303 localized_strings.SetString("closedwindowmultiple",
310 l10n_util::GetStringUTF16(IDS_NEW_TAB_RECENTLY_CLOSED_WINDOW_MULTIPLE)); 304 l10n_util::GetStringUTF16(IDS_NEW_TAB_RECENTLY_CLOSED_WINDOW_MULTIPLE));
311 localized_strings.SetString("attributionintro", 305 localized_strings.SetString("attributionintro",
312 l10n_util::GetStringUTF16(IDS_NEW_TAB_ATTRIBUTION_INTRO)); 306 l10n_util::GetStringUTF16(IDS_NEW_TAB_ATTRIBUTION_INTRO));
313 localized_strings.SetString("thumbnailremovednotification", 307 localized_strings.SetString("thumbnailremovednotification",
314 l10n_util::GetStringUTF16(IDS_NEW_TAB_THUMBNAIL_REMOVED_NOTIFICATION)); 308 l10n_util::GetStringUTF16(IDS_NEW_TAB_THUMBNAIL_REMOVED_NOTIFICATION));
315 localized_strings.SetString("undothumbnailremove", 309 localized_strings.SetString("undothumbnailremove",
316 l10n_util::GetStringUTF16(IDS_NEW_TAB_UNDO_THUMBNAIL_REMOVE)); 310 l10n_util::GetStringUTF16(IDS_NEW_TAB_UNDO_THUMBNAIL_REMOVE));
317 localized_strings.SetString("removethumbnailtooltip", 311 localized_strings.SetString("removethumbnailtooltip",
318 l10n_util::GetStringUTF16(IDS_NEW_TAB_REMOVE_THUMBNAIL_TOOLTIP)); 312 l10n_util::GetStringUTF16(IDS_NEW_TAB_REMOVE_THUMBNAIL_TOOLTIP));
319 localized_strings.SetString("pinthumbnailtooltip",
320 l10n_util::GetStringUTF16(IDS_NEW_TAB_PIN_THUMBNAIL_TOOLTIP));
321 localized_strings.SetString("unpinthumbnailtooltip",
322 l10n_util::GetStringUTF16(IDS_NEW_TAB_UNPIN_THUMBNAIL_TOOLTIP));
323 localized_strings.SetString("showhidethumbnailtooltip",
324 l10n_util::GetStringUTF16(IDS_NEW_TAB_SHOW_HIDE_THUMBNAIL_TOOLTIP));
325 localized_strings.SetString("showhidelisttooltip",
326 l10n_util::GetStringUTF16(IDS_NEW_TAB_SHOW_HIDE_LIST_TOOLTIP));
327 localized_strings.SetString("pagedisplaytooltip",
328 l10n_util::GetStringUTF16(IDS_NEW_TAB_PAGE_DISPLAY_TOOLTIP));
329 localized_strings.SetString("close", l10n_util::GetStringUTF16(IDS_CLOSE));
330 localized_strings.SetString("history",
331 l10n_util::GetStringUTF16(IDS_NEW_TAB_HISTORY));
332 localized_strings.SetString("downloads",
333 l10n_util::GetStringUTF16(IDS_NEW_TAB_DOWNLOADS));
334 localized_strings.SetString("help",
335 l10n_util::GetStringUTF16(IDS_NEW_TAB_HELP));
336 localized_strings.SetString("helpurl",
337 GetUrlWithLang(GURL(kHelpContentUrl)));
338 localized_strings.SetString("appsettings",
339 l10n_util::GetStringUTF16(IDS_NEW_TAB_APP_SETTINGS));
340 localized_strings.SetString("appuninstall", 313 localized_strings.SetString("appuninstall",
341 l10n_util::GetStringFUTF16( 314 l10n_util::GetStringFUTF16(
342 IDS_NEW_TAB_APP_UNINSTALL, 315 IDS_NEW_TAB_APP_UNINSTALL,
343 l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME))); 316 l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME)));
344 localized_strings.SetString("appoptions", 317 localized_strings.SetString("appoptions",
345 l10n_util::GetStringUTF16(IDS_NEW_TAB_APP_OPTIONS)); 318 l10n_util::GetStringUTF16(IDS_NEW_TAB_APP_OPTIONS));
346 localized_strings.SetString("appcreateshortcut", 319 localized_strings.SetString("appcreateshortcut",
347 l10n_util::GetStringUTF16(IDS_NEW_TAB_APP_CREATE_SHORTCUT)); 320 l10n_util::GetStringUTF16(IDS_NEW_TAB_APP_CREATE_SHORTCUT));
348 localized_strings.SetString("appDefaultPageName", 321 localized_strings.SetString("appDefaultPageName",
349 l10n_util::GetStringUTF16(IDS_APP_DEFAULT_PAGE_NAME)); 322 l10n_util::GetStringUTF16(IDS_APP_DEFAULT_PAGE_NAME));
350 localized_strings.SetString("applaunchtypepinned", 323 localized_strings.SetString("applaunchtypepinned",
351 l10n_util::GetStringUTF16(IDS_APP_CONTEXT_MENU_OPEN_PINNED)); 324 l10n_util::GetStringUTF16(IDS_APP_CONTEXT_MENU_OPEN_PINNED));
352 localized_strings.SetString("applaunchtyperegular", 325 localized_strings.SetString("applaunchtyperegular",
353 l10n_util::GetStringUTF16(IDS_APP_CONTEXT_MENU_OPEN_REGULAR)); 326 l10n_util::GetStringUTF16(IDS_APP_CONTEXT_MENU_OPEN_REGULAR));
354 localized_strings.SetString("applaunchtypewindow", 327 localized_strings.SetString("applaunchtypewindow",
355 l10n_util::GetStringUTF16(IDS_APP_CONTEXT_MENU_OPEN_WINDOW)); 328 l10n_util::GetStringUTF16(IDS_APP_CONTEXT_MENU_OPEN_WINDOW));
356 localized_strings.SetString("applaunchtypefullscreen", 329 localized_strings.SetString("applaunchtypefullscreen",
357 l10n_util::GetStringUTF16(IDS_APP_CONTEXT_MENU_OPEN_FULLSCREEN)); 330 l10n_util::GetStringUTF16(IDS_APP_CONTEXT_MENU_OPEN_FULLSCREEN));
358 localized_strings.SetString("web_store_title",
359 l10n_util::GetStringUTF16(IDS_EXTENSION_WEB_STORE_TITLE));
360 localized_strings.SetString("web_store_url",
361 GetUrlWithLang(GURL(extension_urls::GetWebstoreLaunchURL())));
362 localized_strings.SetString("syncpromotext", 331 localized_strings.SetString("syncpromotext",
363 l10n_util::GetStringUTF16(IDS_SYNC_START_SYNC_BUTTON_LABEL)); 332 l10n_util::GetStringUTF16(IDS_SYNC_START_SYNC_BUTTON_LABEL));
364 localized_strings.SetString("syncLinkText", 333 localized_strings.SetString("syncLinkText",
365 l10n_util::GetStringUTF16(IDS_SYNC_ADVANCED_OPTIONS)); 334 l10n_util::GetStringUTF16(IDS_SYNC_ADVANCED_OPTIONS));
366 localized_strings.SetString("bookmarksManagerLinkTitle",
367 l10n_util::GetStringUTF16(IDS_NEW_TAB_BOOKMARKS_MANAGER_LINK_TITLE));
368 localized_strings.SetString("bookmarksShowAllLinkTitle",
369 l10n_util::GetStringUTF16(IDS_NEW_TAB_BOOKMARKS_SHOW_ALL_LINK_TITLE));
370 localized_strings.SetString("importDataLinkTitle",
371 l10n_util::GetStringUTF16(IDS_NEW_TAB_BOOKMARKS_IMPORT_LINK_TITLE));
372 #if defined(OS_CHROMEOS) 335 #if defined(OS_CHROMEOS)
373 localized_strings.SetString("expandMenu", 336 localized_strings.SetString("expandMenu",
374 l10n_util::GetStringUTF16(IDS_NEW_TAB_CLOSE_MENU_EXPAND)); 337 l10n_util::GetStringUTF16(IDS_NEW_TAB_CLOSE_MENU_EXPAND));
375 #endif 338 #endif
376 339
377 NewTabPageHandler::GetLocalizedValues(profile_, &localized_strings); 340 NewTabPageHandler::GetLocalizedValues(profile_, &localized_strings);
378 NTPLoginHandler::GetLocalizedValues(profile_, &localized_strings); 341 NTPLoginHandler::GetLocalizedValues(profile_, &localized_strings);
379 342
380 SyncSetupHandler::GetStaticLocalizedValues(&localized_strings); 343 SyncSetupHandler::GetStaticLocalizedValues(&localized_strings);
381 344
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 IDR_NEW_TAB_4_THEME_CSS : IDR_NEW_TAB_THEME_CSS; 546 IDR_NEW_TAB_4_THEME_CSS : IDR_NEW_TAB_THEME_CSS;
584 static const base::StringPiece new_tab_theme_css( 547 static const base::StringPiece new_tab_theme_css(
585 ResourceBundle::GetSharedInstance().GetRawDataResource( 548 ResourceBundle::GetSharedInstance().GetRawDataResource(
586 ntp_css_resource_id)); 549 ntp_css_resource_id));
587 550
588 // Create the string from our template and the replacements. 551 // Create the string from our template and the replacements.
589 std::string css_string; 552 std::string css_string;
590 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); 553 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL);
591 new_tab_css_ = base::RefCountedString::TakeString(&css_string); 554 new_tab_css_ = base::RefCountedString::TakeString(&css_string);
592 } 555 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698