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

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

Issue 3903002: Uninstall default apps if user hides promo (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add DCHECK Created 10 years, 2 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) 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 "chrome/browser/prefs/pref_service.h" 8 #include "chrome/browser/prefs/pref_service.h"
9 #include "chrome/common/chrome_switches.h" 9 #include "chrome/common/chrome_switches.h"
10 #include "chrome/common/pref_names.h" 10 #include "chrome/common/pref_names.h"
(...skipping 16 matching lines...) Expand all
27 27
28 DefaultApps::~DefaultApps() {} 28 DefaultApps::~DefaultApps() {}
29 29
30 const ExtensionIdSet* DefaultApps::GetAppsToInstall() const { 30 const ExtensionIdSet* DefaultApps::GetAppsToInstall() const {
31 if (GetDefaultAppsInstalled()) 31 if (GetDefaultAppsInstalled())
32 return NULL; 32 return NULL;
33 else 33 else
34 return &ids_; 34 return &ids_;
35 } 35 }
36 36
37 const ExtensionIdSet* DefaultApps::GetDefaultApps() const {
38 return &ids_;
39 }
40
37 void DefaultApps::DidInstallApp(const ExtensionIdSet& installed_ids) { 41 void DefaultApps::DidInstallApp(const ExtensionIdSet& installed_ids) {
38 // If all the default apps have been installed, stop trying to install them. 42 // If all the default apps have been installed, stop trying to install them.
39 // Note that we use std::includes here instead of == because apps might have 43 // Note that we use std::includes here instead of == because apps might have
40 // been manually installed while the the default apps were installing and we 44 // been manually installed while the the default apps were installing and we
41 // wouldn't want to keep trying to install them in that case. 45 // wouldn't want to keep trying to install them in that case.
42 if (!GetDefaultAppsInstalled() && 46 if (!GetDefaultAppsInstalled() &&
43 std::includes(installed_ids.begin(), installed_ids.end(), 47 std::includes(installed_ids.begin(), installed_ids.end(),
44 ids_.begin(), ids_.end())) { 48 ids_.begin(), ids_.end())) {
45 SetDefaultAppsInstalled(true); 49 SetDefaultAppsInstalled(true);
46 } 50 }
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 } 102 }
99 103
100 bool DefaultApps::GetDefaultAppsInstalled() const { 104 bool DefaultApps::GetDefaultAppsInstalled() const {
101 return prefs_->GetBoolean(prefs::kDefaultAppsInstalled); 105 return prefs_->GetBoolean(prefs::kDefaultAppsInstalled);
102 } 106 }
103 107
104 void DefaultApps::SetDefaultAppsInstalled(bool val) { 108 void DefaultApps::SetDefaultAppsInstalled(bool val) {
105 prefs_->SetBoolean(prefs::kDefaultAppsInstalled, val); 109 prefs_->SetBoolean(prefs::kDefaultAppsInstalled, val);
106 prefs_->ScheduleSavePersistentPrefs(); 110 prefs_->ScheduleSavePersistentPrefs();
107 } 111 }
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