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

Side by Side Diff: chrome/browser/web_resource/promo_resource_service.cc

Issue 7799008: Fix crash on NTP related to multi-profile extensions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix sources for incognito Created 9 years, 3 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) 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/web_resource/promo_resource_service.h" 5 #include "chrome/browser/web_resource/promo_resource_service.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/string_number_conversions.h" 8 #include "base/string_number_conversions.h"
9 #include "base/threading/thread_restrictions.h" 9 #include "base/threading/thread_restrictions.h"
10 #include "base/time.h" 10 #include "base/time.h"
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 } 125 }
126 126
127 PromoResourceService::PromoResourceService(Profile* profile) 127 PromoResourceService::PromoResourceService(Profile* profile)
128 : WebResourceService(profile->GetPrefs(), 128 : WebResourceService(profile->GetPrefs(),
129 GetPromoResourceURL(), 129 GetPromoResourceURL(),
130 true, // append locale to URL 130 true, // append locale to URL
131 chrome::NOTIFICATION_PROMO_RESOURCE_STATE_CHANGED, 131 chrome::NOTIFICATION_PROMO_RESOURCE_STATE_CHANGED,
132 prefs::kNTPPromoResourceCacheUpdate, 132 prefs::kNTPPromoResourceCacheUpdate,
133 kStartResourceFetchDelay, 133 kStartResourceFetchDelay,
134 kCacheUpdateDelay), 134 kCacheUpdateDelay),
135 profile_(profile),
135 web_resource_cache_(NULL), 136 web_resource_cache_(NULL),
136 channel_(chrome::VersionInfo::CHANNEL_UNKNOWN) { 137 channel_(chrome::VersionInfo::CHANNEL_UNKNOWN) {
137 Init(); 138 Init();
138 } 139 }
139 140
140 PromoResourceService::~PromoResourceService() { } 141 PromoResourceService::~PromoResourceService() { }
141 142
142 void PromoResourceService::Init() { 143 void PromoResourceService::Init() {
143 ScheduleNotificationOnInit(); 144 ScheduleNotificationOnInit();
144 } 145 }
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 387
387 if (!signal_found) { 388 if (!signal_found) {
388 // If no web store promos target this build, then clear all the prefs. 389 // If no web store promos target this build, then clear all the prefs.
389 AppsPromo::ClearPromo(); 390 AppsPromo::ClearPromo();
390 } 391 }
391 392
392 AppsPromo::SetWebStoreSupportedForLocale(is_webstore_active); 393 AppsPromo::SetWebStoreSupportedForLocale(is_webstore_active);
393 394
394 NotificationService::current()->Notify( 395 NotificationService::current()->Notify(
395 chrome::NOTIFICATION_WEB_STORE_PROMO_LOADED, 396 chrome::NOTIFICATION_WEB_STORE_PROMO_LOADED,
396 Source<PromoResourceService>(this), 397 Source<Profile>(profile_),
397 NotificationService::NoDetails()); 398 NotificationService::NoDetails());
398 399
399 return; 400 return;
400 } 401 }
401 402
402 void PromoResourceService::UnpackLogoSignal( 403 void PromoResourceService::UnpackLogoSignal(
403 const DictionaryValue& parsed_json) { 404 const DictionaryValue& parsed_json) {
404 DictionaryValue* topic_dict; 405 DictionaryValue* topic_dict;
405 ListValue* answer_list; 406 ListValue* answer_list;
406 double old_logo_start = 0; 407 double old_logo_start = 0;
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 base::ThreadRestrictions::ScopedAllowIO allow_io; 486 base::ThreadRestrictions::ScopedAllowIO allow_io;
486 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); 487 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel();
487 is_promo_build = PromoResourceService::IsBuildTargeted( 488 is_promo_build = PromoResourceService::IsBuildTargeted(
488 channel, prefs->GetInteger(prefs::kNTPPromoBuild)); 489 channel, prefs->GetInteger(prefs::kNTPPromoBuild));
489 } 490 }
490 491
491 return !promo_closed && !is_synced && is_promo_build; 492 return !promo_closed && !is_synced && is_promo_build;
492 } 493 }
493 494
494 } // namespace PromoResourceServiceUtil 495 } // namespace PromoResourceServiceUtil
OLDNEW
« chrome/browser/ui/browser.cc ('K') | « chrome/browser/web_resource/promo_resource_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698