OLD | NEW |
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/extensions/apps_promo.h" | 5 #include "chrome/browser/extensions/apps_promo.h" |
6 | 6 |
7 #include "base/base64.h" | 7 #include "base/base64.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 | 195 |
196 AppsPromo::AppsPromo(PrefService* prefs) | 196 AppsPromo::AppsPromo(PrefService* prefs) |
197 : prefs_(prefs) { | 197 : prefs_(prefs) { |
198 // Poppit, Entanglement | 198 // Poppit, Entanglement |
199 old_default_app_ids_.insert("mcbkbpnkkkipelfledbfocopglifcfmi"); | 199 old_default_app_ids_.insert("mcbkbpnkkkipelfledbfocopglifcfmi"); |
200 old_default_app_ids_.insert("aciahcmjmecflokailenpkdchphgkefd"); | 200 old_default_app_ids_.insert("aciahcmjmecflokailenpkdchphgkefd"); |
201 } | 201 } |
202 | 202 |
203 AppsPromo::~AppsPromo() {} | 203 AppsPromo::~AppsPromo() {} |
204 | 204 |
205 bool AppsPromo::ShouldShowPromo(const ExtensionIdSet& installed_ids, | 205 bool AppsPromo::ShouldShowPromo(const extensions::ExtensionIdSet& installed_ids, |
206 bool* just_expired) { | 206 bool* just_expired) { |
207 *just_expired = false; | 207 *just_expired = false; |
208 | 208 |
209 if (CommandLine::ForCurrentProcess()->HasSwitch( | 209 if (CommandLine::ForCurrentProcess()->HasSwitch( |
210 switches::kForceAppsPromoVisible)) { | 210 switches::kForceAppsPromoVisible)) { |
211 return true; | 211 return true; |
212 } | 212 } |
213 | 213 |
214 // Don't show the promo if the policy says not to. | 214 // Don't show the promo if the policy says not to. |
215 if (prefs_->GetBoolean(prefs::kNtpHideWebStorePromo)) { | 215 if (prefs_->GetBoolean(prefs::kNtpHideWebStorePromo)) { |
(...skipping 30 matching lines...) Expand all Loading... |
246 SetPromoCounter(++promo_counter); | 246 SetPromoCounter(++promo_counter); |
247 } | 247 } |
248 return true; | 248 return true; |
249 } else if (installed_ids.empty()) { | 249 } else if (installed_ids.empty()) { |
250 return true; | 250 return true; |
251 } | 251 } |
252 | 252 |
253 return false; | 253 return false; |
254 } | 254 } |
255 | 255 |
256 bool AppsPromo::ShouldShowAppLauncher(const ExtensionIdSet& installed_ids) { | 256 bool AppsPromo::ShouldShowAppLauncher( |
| 257 const extensions::ExtensionIdSet& installed_ids) { |
257 // On Chrome OS the default apps are installed via a separate mechanism that | 258 // On Chrome OS the default apps are installed via a separate mechanism that |
258 // is always enabled. Therefore we always show the launcher. | 259 // is always enabled. Therefore we always show the launcher. |
259 #if defined(OS_CHROMEOS) | 260 #if defined(OS_CHROMEOS) |
260 return true; | 261 return true; |
261 #else | 262 #else |
262 | 263 |
263 // Always show the app launcher if an app is installed. | 264 // Always show the app launcher if an app is installed. |
264 if (!installed_ids.empty()) | 265 if (!installed_ids.empty()) |
265 return true; | 266 return true; |
266 | 267 |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 content::NotificationService::current()->Notify( | 376 content::NotificationService::current()->Notify( |
376 chrome::NOTIFICATION_WEB_STORE_PROMO_LOADED, | 377 chrome::NOTIFICATION_WEB_STORE_PROMO_LOADED, |
377 content::Source<Profile>(profile_), | 378 content::Source<Profile>(profile_), |
378 content::NotificationService::NoDetails()); | 379 content::NotificationService::NoDetails()); |
379 } | 380 } |
380 | 381 |
381 bool AppsPromoLogoFetcher::SupportsLogoURL() { | 382 bool AppsPromoLogoFetcher::SupportsLogoURL() { |
382 URLPattern allowed_urls(URLPattern::SCHEME_HTTPS, kValidLogoPattern); | 383 URLPattern allowed_urls(URLPattern::SCHEME_HTTPS, kValidLogoPattern); |
383 return allowed_urls.MatchesURL(promo_data_.logo); | 384 return allowed_urls.MatchesURL(promo_data_.logo); |
384 } | 385 } |
OLD | NEW |