| OLD | NEW |
| 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" |
| 11 | 11 |
| 12 const int DefaultApps::kAppsPromoCounterMax = 10; | 12 const int DefaultApps::kAppsPromoCounterMax = 10; |
| 13 | 13 |
| 14 // static | 14 // static |
| 15 void DefaultApps::RegisterUserPrefs(PrefService* prefs) { | 15 void DefaultApps::RegisterUserPrefs(PrefService* prefs) { |
| 16 prefs->RegisterBooleanPref(prefs::kDefaultAppsInstalled, false); | 16 prefs->RegisterBooleanPref(prefs::kDefaultAppsInstalled, false); |
| 17 prefs->RegisterIntegerPref(prefs::kAppsPromoCounter, 0); | 17 prefs->RegisterIntegerPref(prefs::kAppsPromoCounter, 0); |
| 18 } | 18 } |
| 19 | 19 |
| 20 DefaultApps::DefaultApps(PrefService* prefs) | 20 DefaultApps::DefaultApps(PrefService* prefs) |
| 21 : prefs_(prefs) { | 21 : prefs_(prefs) { |
| 22 // gmail, calendar, docs | 22 // gmail, calendar, docs |
| 23 ids_.insert("pjkljhegncpnkpknbcohdijeoejaedia"); | 23 ids_.insert("pjkljhegncpnkpknbcohdijeoejaedia"); |
| 24 ids_.insert("ejjicmeblgpmajnghnpcppodonldlgfn"); | 24 ids_.insert("ejjicmeblgpmajnghnpcppodonldlgfn"); |
| 25 ids_.insert("apdfllckaahabafndbhieahigkjlhalf"); | 25 ids_.insert("apdfllckaahabafndbhieahigkjlhalf"); |
| 26 } | 26 } |
| 27 | 27 |
| 28 DefaultApps::~DefaultApps() {} |
| 29 |
| 28 const ExtensionIdSet* DefaultApps::GetAppsToInstall() const { | 30 const ExtensionIdSet* DefaultApps::GetAppsToInstall() const { |
| 29 if (GetDefaultAppsInstalled()) | 31 if (GetDefaultAppsInstalled()) |
| 30 return NULL; | 32 return NULL; |
| 31 else | 33 else |
| 32 return &ids_; | 34 return &ids_; |
| 33 } | 35 } |
| 34 | 36 |
| 35 void DefaultApps::DidInstallApp(const ExtensionIdSet& installed_ids) { | 37 void DefaultApps::DidInstallApp(const ExtensionIdSet& installed_ids) { |
| 36 // If all the default apps have been installed, stop trying to install them. | 38 // If all the default apps have been installed, stop trying to install them. |
| 37 // Note that we use std::includes here instead of == because apps might have | 39 // Note that we use std::includes here instead of == because apps might have |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 } | 98 } |
| 97 | 99 |
| 98 bool DefaultApps::GetDefaultAppsInstalled() const { | 100 bool DefaultApps::GetDefaultAppsInstalled() const { |
| 99 return prefs_->GetBoolean(prefs::kDefaultAppsInstalled); | 101 return prefs_->GetBoolean(prefs::kDefaultAppsInstalled); |
| 100 } | 102 } |
| 101 | 103 |
| 102 void DefaultApps::SetDefaultAppsInstalled(bool val) { | 104 void DefaultApps::SetDefaultAppsInstalled(bool val) { |
| 103 prefs_->SetBoolean(prefs::kDefaultAppsInstalled, val); | 105 prefs_->SetBoolean(prefs::kDefaultAppsInstalled, val); |
| 104 prefs_->ScheduleSavePersistentPrefs(); | 106 prefs_->ScheduleSavePersistentPrefs(); |
| 105 } | 107 } |
| OLD | NEW |