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

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

Issue 12045022: Move code in ui\webui\jstemplate_builder.* to webui namespace for consistency. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 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
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 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 bool bookmark_bar_attached = profile_->GetPrefs()->GetBoolean( 290 bool bookmark_bar_attached = profile_->GetPrefs()->GetBoolean(
291 prefs::kShowBookmarkBar); 291 prefs::kShowBookmarkBar);
292 localized_strings.SetBoolean("bookmarkbarattached", bookmark_bar_attached); 292 localized_strings.SetBoolean("bookmarkbarattached", bookmark_bar_attached);
293 293
294 web_ui_util::SetFontAndTextDirection(&localized_strings); 294 web_ui_util::SetFontAndTextDirection(&localized_strings);
295 295
296 static const base::StringPiece incognito_tab_html( 296 static const base::StringPiece incognito_tab_html(
297 ResourceBundle::GetSharedInstance().GetRawDataResource( 297 ResourceBundle::GetSharedInstance().GetRawDataResource(
298 new_tab_html_idr)); 298 new_tab_html_idr));
299 299
300 std::string full_html = jstemplate_builder::GetI18nTemplateHtml( 300 std::string full_html = webui::GetI18nTemplateHtml(
301 incognito_tab_html, &localized_strings); 301 incognito_tab_html, &localized_strings);
302 302
303 new_tab_incognito_html_ = base::RefCountedString::TakeString(&full_html); 303 new_tab_incognito_html_ = base::RefCountedString::TakeString(&full_html);
304 } 304 }
305 305
306 void NTPResourceCache::CreateNewTabHTML() { 306 void NTPResourceCache::CreateNewTabHTML() {
307 // TODO(estade): these strings should be defined in their relevant handlers 307 // TODO(estade): these strings should be defined in their relevant handlers
308 // (in GetLocalizedValues) and should have more legible names. 308 // (in GetLocalizedValues) and should have more legible names.
309 // Show the profile name in the title and most visited labels if the current 309 // Show the profile name in the title and most visited labels if the current
310 // profile is not the default. 310 // profile is not the default.
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 switches::kDisableNTPOtherSessionsMenu); 446 switches::kDisableNTPOtherSessionsMenu);
447 load_time_data.SetBoolean("showOtherSessionsMenu", 447 load_time_data.SetBoolean("showOtherSessionsMenu",
448 show_other_sessions_menu); 448 show_other_sessions_menu);
449 load_time_data.SetBoolean("isUserSignedIn", 449 load_time_data.SetBoolean("isUserSignedIn",
450 !prefs->GetString(prefs::kGoogleServicesUsername).empty()); 450 !prefs->GetString(prefs::kGoogleServicesUsername).empty());
451 451
452 // Load the new tab page appropriate for this build 452 // Load the new tab page appropriate for this build
453 base::StringPiece new_tab_html(ResourceBundle::GetSharedInstance(). 453 base::StringPiece new_tab_html(ResourceBundle::GetSharedInstance().
454 GetRawDataResource(chrome::search::IsInstantExtendedAPIEnabled(profile_) ? 454 GetRawDataResource(chrome::search::IsInstantExtendedAPIEnabled(profile_) ?
455 IDR_NEW_TAB_SEARCH_HTML : IDR_NEW_TAB_4_HTML)); 455 IDR_NEW_TAB_SEARCH_HTML : IDR_NEW_TAB_4_HTML));
456 jstemplate_builder::UseVersion2 version2; 456 webui::UseVersion2 version2;
457 std::string full_html = 457 std::string full_html =
458 jstemplate_builder::GetI18nTemplateHtml(new_tab_html, &load_time_data); 458 webui::GetI18nTemplateHtml(new_tab_html, &load_time_data);
459 new_tab_html_ = base::RefCountedString::TakeString(&full_html); 459 new_tab_html_ = base::RefCountedString::TakeString(&full_html);
460 } 460 }
461 461
462 void NTPResourceCache::CreateNewTabIncognitoCSS() { 462 void NTPResourceCache::CreateNewTabIncognitoCSS() {
463 ui::ThemeProvider* tp = ThemeServiceFactory::GetForProfile(profile_); 463 ui::ThemeProvider* tp = ThemeServiceFactory::GetForProfile(profile_);
464 DCHECK(tp); 464 DCHECK(tp);
465 465
466 // Get our theme colors 466 // Get our theme colors
467 SkColor color_background = 467 SkColor color_background =
468 GetThemeColor(tp, ThemeService::COLOR_NTP_BACKGROUND); 468 GetThemeColor(tp, ThemeService::COLOR_NTP_BACKGROUND);
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 static const base::StringPiece new_tab_theme_css( 579 static const base::StringPiece new_tab_theme_css(
580 ResourceBundle::GetSharedInstance().GetRawDataResource( 580 ResourceBundle::GetSharedInstance().GetRawDataResource(
581 chrome::search::IsInstantExtendedAPIEnabled(profile_) ? 581 chrome::search::IsInstantExtendedAPIEnabled(profile_) ?
582 IDR_NEW_TAB_SEARCH_THEME_CSS : IDR_NEW_TAB_4_THEME_CSS)); 582 IDR_NEW_TAB_SEARCH_THEME_CSS : IDR_NEW_TAB_4_THEME_CSS));
583 583
584 // Create the string from our template and the replacements. 584 // Create the string from our template and the replacements.
585 std::string css_string; 585 std::string css_string;
586 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); 586 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL);
587 new_tab_css_ = base::RefCountedString::TakeString(&css_string); 587 new_tab_css_ = base::RefCountedString::TakeString(&css_string);
588 } 588 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/chromeos/system_info_ui.cc ('k') | chrome/browser/ui/webui/ntp/ntp_resource_cache_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698