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

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

Issue 11885021: Don't derive from ChromeURLDataManager::DataSource, and instead have these classes implement a dele… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: nits 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 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 GetUrlWithLang(GURL(new_tab_link)))); 291 GetUrlWithLang(GURL(new_tab_link))));
292 localized_strings.SetString("extensionsmessage", 292 localized_strings.SetString("extensionsmessage",
293 l10n_util::GetStringFUTF16( 293 l10n_util::GetStringFUTF16(
294 IDS_NEW_TAB_OTR_EXTENSIONS_MESSAGE, 294 IDS_NEW_TAB_OTR_EXTENSIONS_MESSAGE,
295 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME), 295 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME),
296 ASCIIToUTF16(chrome::kChromeUIExtensionsURL))); 296 ASCIIToUTF16(chrome::kChromeUIExtensionsURL)));
297 bool bookmark_bar_attached = profile_->GetPrefs()->GetBoolean( 297 bool bookmark_bar_attached = profile_->GetPrefs()->GetBoolean(
298 prefs::kShowBookmarkBar); 298 prefs::kShowBookmarkBar);
299 localized_strings.SetBoolean("bookmarkbarattached", bookmark_bar_attached); 299 localized_strings.SetBoolean("bookmarkbarattached", bookmark_bar_attached);
300 300
301 ChromeURLDataManager::DataSource::SetFontAndTextDirection(&localized_strings); 301 URLDataSource::SetFontAndTextDirection(&localized_strings);
302 302
303 static const base::StringPiece incognito_tab_html( 303 static const base::StringPiece incognito_tab_html(
304 ResourceBundle::GetSharedInstance().GetRawDataResource( 304 ResourceBundle::GetSharedInstance().GetRawDataResource(
305 new_tab_html_idr)); 305 new_tab_html_idr));
306 306
307 std::string full_html = jstemplate_builder::GetI18nTemplateHtml( 307 std::string full_html = jstemplate_builder::GetI18nTemplateHtml(
308 incognito_tab_html, &localized_strings); 308 incognito_tab_html, &localized_strings);
309 309
310 new_tab_incognito_html_ = base::RefCountedString::TakeString(&full_html); 310 new_tab_incognito_html_ = base::RefCountedString::TakeString(&full_html);
311 } 311 }
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 is_swipe_tracking_from_scroll_events_enabled_); 408 is_swipe_tracking_from_scroll_events_enabled_);
409 409
410 #if defined(OS_CHROMEOS) 410 #if defined(OS_CHROMEOS)
411 load_time_data.SetString("expandMenu", 411 load_time_data.SetString("expandMenu",
412 l10n_util::GetStringUTF16(IDS_NEW_TAB_CLOSE_MENU_EXPAND)); 412 l10n_util::GetStringUTF16(IDS_NEW_TAB_CLOSE_MENU_EXPAND));
413 #endif 413 #endif
414 414
415 NewTabPageHandler::GetLocalizedValues(profile_, &load_time_data); 415 NewTabPageHandler::GetLocalizedValues(profile_, &load_time_data);
416 NTPLoginHandler::GetLocalizedValues(profile_, &load_time_data); 416 NTPLoginHandler::GetLocalizedValues(profile_, &load_time_data);
417 417
418 ChromeURLDataManager::DataSource::SetFontAndTextDirection(&load_time_data); 418 URLDataSource::SetFontAndTextDirection(&load_time_data);
419 419
420 // Control fade and resize animations. 420 // Control fade and resize animations.
421 load_time_data.SetBoolean("anim", ui::Animation::ShouldRenderRichAnimation()); 421 load_time_data.SetBoolean("anim", ui::Animation::ShouldRenderRichAnimation());
422 422
423 int alignment; 423 int alignment;
424 ui::ThemeProvider* tp = ThemeServiceFactory::GetForProfile(profile_); 424 ui::ThemeProvider* tp = ThemeServiceFactory::GetForProfile(profile_);
425 tp->GetDisplayProperty(ThemeService::NTP_BACKGROUND_ALIGNMENT, &alignment); 425 tp->GetDisplayProperty(ThemeService::NTP_BACKGROUND_ALIGNMENT, &alignment);
426 load_time_data.SetString("themegravity", 426 load_time_data.SetString("themegravity",
427 (alignment & ThemeService::ALIGN_RIGHT) ? "right" : ""); 427 (alignment & ThemeService::ALIGN_RIGHT) ? "right" : "");
428 428
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 // Get our template. 589 // Get our template.
590 static const base::StringPiece new_tab_theme_css( 590 static const base::StringPiece new_tab_theme_css(
591 ResourceBundle::GetSharedInstance().GetRawDataResource(is_ntp_search ? 591 ResourceBundle::GetSharedInstance().GetRawDataResource(is_ntp_search ?
592 IDR_NEW_TAB_SEARCH_THEME_CSS : IDR_NEW_TAB_4_THEME_CSS)); 592 IDR_NEW_TAB_SEARCH_THEME_CSS : IDR_NEW_TAB_4_THEME_CSS));
593 593
594 // Create the string from our template and the replacements. 594 // Create the string from our template and the replacements.
595 std::string css_string; 595 std::string css_string;
596 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); 596 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL);
597 new_tab_css_ = base::RefCountedString::TakeString(&css_string); 597 new_tab_css_ = base::RefCountedString::TakeString(&css_string);
598 } 598 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698