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

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

Issue 9169096: Remove a bunch of GetProfileSyncService callers to use the new factory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rm todos Created 8 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 <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"
11 #include "base/memory/ref_counted_memory.h" 11 #include "base/memory/ref_counted_memory.h"
12 #include "base/string16.h" 12 #include "base/string16.h"
13 #include "base/string_number_conversions.h" 13 #include "base/string_number_conversions.h"
14 #include "base/stringprintf.h" 14 #include "base/stringprintf.h"
15 #include "base/time.h" 15 #include "base/time.h"
16 #include "base/utf_string_conversions.h" 16 #include "base/utf_string_conversions.h"
17 #include "base/values.h" 17 #include "base/values.h"
18 #include "chrome/browser/defaults.h" 18 #include "chrome/browser/defaults.h"
19 #include "chrome/browser/google/google_util.h" 19 #include "chrome/browser/google/google_util.h"
20 #include "chrome/browser/prefs/pref_service.h" 20 #include "chrome/browser/prefs/pref_service.h"
21 #include "chrome/browser/profiles/profile.h" 21 #include "chrome/browser/profiles/profile.h"
22 #include "chrome/browser/sync/profile_sync_service.h" 22 #include "chrome/browser/sync/profile_sync_service.h"
23 #include "chrome/browser/sync/profile_sync_service_factory.h"
23 #include "chrome/browser/themes/theme_service.h" 24 #include "chrome/browser/themes/theme_service.h"
24 #include "chrome/browser/themes/theme_service_factory.h" 25 #include "chrome/browser/themes/theme_service_factory.h"
25 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" 26 #include "chrome/browser/ui/webui/chrome_url_data_manager.h"
26 #include "chrome/browser/ui/webui/ntp/new_tab_page_handler.h" 27 #include "chrome/browser/ui/webui/ntp/new_tab_page_handler.h"
27 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" 28 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h"
28 #include "chrome/browser/ui/webui/ntp/ntp_login_handler.h" 29 #include "chrome/browser/ui/webui/ntp/ntp_login_handler.h"
29 #include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h" 30 #include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h"
30 #include "chrome/browser/ui/webui/sync_setup_handler.h" 31 #include "chrome/browser/ui/webui/sync_setup_handler.h"
31 #include "chrome/browser/web_resource/promo_resource_service.h" 32 #include "chrome/browser/web_resource/promo_resource_service.h"
32 #include "chrome/common/chrome_notification_types.h" 33 #include "chrome/common/chrome_notification_types.h"
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 #if defined(OS_CHROMEOS) 333 #if defined(OS_CHROMEOS)
333 localized_strings.SetString("expandMenu", 334 localized_strings.SetString("expandMenu",
334 l10n_util::GetStringUTF16(IDS_NEW_TAB_CLOSE_MENU_EXPAND)); 335 l10n_util::GetStringUTF16(IDS_NEW_TAB_CLOSE_MENU_EXPAND));
335 #endif 336 #endif
336 337
337 NewTabPageHandler::GetLocalizedValues(profile_, &localized_strings); 338 NewTabPageHandler::GetLocalizedValues(profile_, &localized_strings);
338 NTPLoginHandler::GetLocalizedValues(profile_, &localized_strings); 339 NTPLoginHandler::GetLocalizedValues(profile_, &localized_strings);
339 340
340 // Don't initiate the sync related message passing with the page if the sync 341 // Don't initiate the sync related message passing with the page if the sync
341 // code is not present. 342 // code is not present.
342 if (profile_->GetProfileSyncService()) 343 if (ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile_))
343 localized_strings.SetString("syncispresent", "true"); 344 localized_strings.SetString("syncispresent", "true");
344 else 345 else
345 localized_strings.SetString("syncispresent", "false"); 346 localized_strings.SetString("syncispresent", "false");
346 347
347 ChromeURLDataManager::DataSource::SetFontAndTextDirection(&localized_strings); 348 ChromeURLDataManager::DataSource::SetFontAndTextDirection(&localized_strings);
348 349
349 // Control fade and resize animations. 350 // Control fade and resize animations.
350 std::string anim = 351 std::string anim =
351 ui::Animation::ShouldRenderRichAnimation() ? "true" : "false"; 352 ui::Animation::ShouldRenderRichAnimation() ? "true" : "false";
352 localized_strings.SetString("anim", anim); 353 localized_strings.SetString("anim", anim);
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 // Get our template. 505 // Get our template.
505 static const base::StringPiece new_tab_theme_css( 506 static const base::StringPiece new_tab_theme_css(
506 ResourceBundle::GetSharedInstance().GetRawDataResource( 507 ResourceBundle::GetSharedInstance().GetRawDataResource(
507 IDR_NEW_TAB_4_THEME_CSS)); 508 IDR_NEW_TAB_4_THEME_CSS));
508 509
509 // Create the string from our template and the replacements. 510 // Create the string from our template and the replacements.
510 std::string css_string; 511 std::string css_string;
511 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); 512 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL);
512 new_tab_css_ = base::RefCountedString::TakeString(&css_string); 513 new_tab_css_ = base::RefCountedString::TakeString(&css_string);
513 } 514 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/ntp/ntp_login_handler.cc ('k') | chrome/browser/ui/webui/options/options_sync_setup_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698