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

Side by Side Diff: chrome/browser/extensions/default_apps.cc

Issue 5750005: Default apps promo was getting expired early if NTP open. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 10 years 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/default_apps.h" 5 #include "chrome/browser/extensions/default_apps.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "chrome/browser/prefs/pref_service.h" 9 #include "chrome/browser/prefs/pref_service.h"
10 #include "chrome/common/chrome_switches.h" 10 #include "chrome/common/chrome_switches.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 // Note that we use std::includes here instead of == because apps might have 45 // Note that we use std::includes here instead of == because apps might have
46 // been manually installed while the the default apps were installing and we 46 // been manually installed while the the default apps were installing and we
47 // wouldn't want to keep trying to install them in that case. 47 // wouldn't want to keep trying to install them in that case.
48 if (!GetDefaultAppsInstalled() && 48 if (!GetDefaultAppsInstalled() &&
49 std::includes(installed_ids.begin(), installed_ids.end(), 49 std::includes(installed_ids.begin(), installed_ids.end(),
50 ids_.begin(), ids_.end())) { 50 ids_.begin(), ids_.end())) {
51 SetDefaultAppsInstalled(true); 51 SetDefaultAppsInstalled(true);
52 } 52 }
53 } 53 }
54 54
55 bool DefaultApps::ShouldShowPromo(const ExtensionIdSet& installed_ids) { 55 bool DefaultApps::CheckShouldShowPromo(const ExtensionIdSet& installed_ids) {
56 #if defined(OS_CHROMEOS) 56 #if defined(OS_CHROMEOS)
57 // Don't show the promo at all on Chrome OS. 57 // Don't show the promo at all on Chrome OS.
58 return false; 58 return false;
59 #endif 59 #endif
60 if (CommandLine::ForCurrentProcess()->HasSwitch( 60 if (CommandLine::ForCurrentProcess()->HasSwitch(
61 switches::kForceAppsPromoVisible)) { 61 switches::kForceAppsPromoVisible)) {
62 return true; 62 return true;
63 } 63 }
64 64
65 if (GetDefaultAppsInstalled() && GetPromoCounter() < kAppsPromoCounterMax) { 65 if (GetDefaultAppsInstalled() && GetPromoCounter() < kAppsPromoCounterMax) {
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 } 113 }
114 114
115 bool DefaultApps::GetDefaultAppsInstalled() const { 115 bool DefaultApps::GetDefaultAppsInstalled() const {
116 return prefs_->GetBoolean(prefs::kDefaultAppsInstalled); 116 return prefs_->GetBoolean(prefs::kDefaultAppsInstalled);
117 } 117 }
118 118
119 void DefaultApps::SetDefaultAppsInstalled(bool val) { 119 void DefaultApps::SetDefaultAppsInstalled(bool val) {
120 prefs_->SetBoolean(prefs::kDefaultAppsInstalled, val); 120 prefs_->SetBoolean(prefs::kDefaultAppsInstalled, val);
121 prefs_->ScheduleSavePersistentPrefs(); 121 prefs_->ScheduleSavePersistentPrefs();
122 } 122 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/default_apps.h ('k') | chrome/browser/extensions/default_apps_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698