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

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

Issue 11150002: New post-sideload UI: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: !!! Created 8 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) 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/extension_prefs.h" 5 #include "chrome/browser/extensions/extension_prefs.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/string_util.h" 9 #include "base/string_util.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 60
61 // Indicates whether an extension is blacklisted. 61 // Indicates whether an extension is blacklisted.
62 const char kPrefBlacklist[] = "blacklist"; 62 const char kPrefBlacklist[] = "blacklist";
63 63
64 // The oauth client id used for app notification setup. 64 // The oauth client id used for app notification setup.
65 const char kPrefAppNotificationClientId[] = "app_notif_client_id"; 65 const char kPrefAppNotificationClientId[] = "app_notif_client_id";
66 66
67 // Indicates whether the user has disabled notifications or not. 67 // Indicates whether the user has disabled notifications or not.
68 const char kPrefAppNotificationDisbaled[] = "app_notif_disabled"; 68 const char kPrefAppNotificationDisbaled[] = "app_notif_disabled";
69 69
70 // The count of how many times we prompted the user to acknowledge an
71 // extension.
72 const char kPrefAcknowledgePromptCount[] = "ack_prompt_count";
73
70 // Indicates whether the user has acknowledged various types of extensions. 74 // Indicates whether the user has acknowledged various types of extensions.
71 const char kPrefExternalAcknowledged[] = "ack_external"; 75 const char kPrefExternalAcknowledged[] = "ack_external";
72 const char kPrefBlacklistAcknowledged[] = "ack_blacklist"; 76 const char kPrefBlacklistAcknowledged[] = "ack_blacklist";
73 const char kPrefOrphanAcknowledged[] = "ack_orphan"; 77 const char kPrefOrphanAcknowledged[] = "ack_orphan";
74 78
75 // Indicates whether to show an install warning when the user enables. 79 // Indicates whether to show an install warning when the user enables.
76 const char kExtensionDidEscalatePermissions[] = "install_warning_on_enable"; 80 const char kExtensionDidEscalatePermissions[] = "install_warning_on_enable";
77 81
78 // DO NOT USE, use kPrefDisableReasons instead. 82 // DO NOT USE, use kPrefDisableReasons instead.
79 // Indicates whether the extension was updated while it was disabled. 83 // Indicates whether the extension was updated while it was disabled.
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 } 597 }
594 } 598 }
595 599
596 bool ExtensionPrefs::IsExtensionOrphaned(const std::string& extension_id) { 600 bool ExtensionPrefs::IsExtensionOrphaned(const std::string& extension_id) {
597 // TODO(miket): we believe that this test will hinge on the number of 601 // TODO(miket): we believe that this test will hinge on the number of
598 // consecutive times that an update check has returned a certain response 602 // consecutive times that an update check has returned a certain response
599 // versus a success response. For now nobody is orphaned. 603 // versus a success response. For now nobody is orphaned.
600 return false; 604 return false;
601 } 605 }
602 606
607 int ExtensionPrefs::IncrementAcknowledgePromptCount(
608 const std::string& extension_id) {
609 int count = 0;
610 ReadExtensionPrefInteger(extension_id, kPrefAcknowledgePromptCount, &count);
611 ++count;
612 UpdateExtensionPref(extension_id, kPrefAcknowledgePromptCount,
613 Value::CreateIntegerValue(count));
614 return count;
615 }
616
603 bool ExtensionPrefs::IsExternalExtensionAcknowledged( 617 bool ExtensionPrefs::IsExternalExtensionAcknowledged(
604 const std::string& extension_id) { 618 const std::string& extension_id) {
605 return ReadExtensionPrefBoolean(extension_id, kPrefExternalAcknowledged); 619 return ReadExtensionPrefBoolean(extension_id, kPrefExternalAcknowledged);
606 } 620 }
607 621
608 void ExtensionPrefs::AcknowledgeExternalExtension( 622 void ExtensionPrefs::AcknowledgeExternalExtension(
609 const std::string& extension_id) { 623 const std::string& extension_id) {
610 DCHECK(Extension::IdIsValid(extension_id)); 624 DCHECK(Extension::IdIsValid(extension_id));
611 UpdateExtensionPref(extension_id, kPrefExternalAcknowledged, 625 UpdateExtensionPref(extension_id, kPrefExternalAcknowledged,
612 Value::CreateBooleanValue(true)); 626 Value::CreateBooleanValue(true));
627 UpdateExtensionPref(extension_id, kPrefAcknowledgePromptCount, NULL);
613 } 628 }
614 629
615 bool ExtensionPrefs::IsBlacklistedExtensionAcknowledged( 630 bool ExtensionPrefs::IsBlacklistedExtensionAcknowledged(
616 const std::string& extension_id) { 631 const std::string& extension_id) {
617 return ReadExtensionPrefBoolean(extension_id, kPrefBlacklistAcknowledged); 632 return ReadExtensionPrefBoolean(extension_id, kPrefBlacklistAcknowledged);
618 } 633 }
619 634
620 void ExtensionPrefs::AcknowledgeBlacklistedExtension( 635 void ExtensionPrefs::AcknowledgeBlacklistedExtension(
621 const std::string& extension_id) { 636 const std::string& extension_id) {
622 DCHECK(Extension::IdIsValid(extension_id)); 637 DCHECK(Extension::IdIsValid(extension_id));
623 UpdateExtensionPref(extension_id, kPrefBlacklistAcknowledged, 638 UpdateExtensionPref(extension_id, kPrefBlacklistAcknowledged,
624 Value::CreateBooleanValue(true)); 639 Value::CreateBooleanValue(true));
640 UpdateExtensionPref(extension_id, kPrefAcknowledgePromptCount, NULL);
625 } 641 }
626 642
627 bool ExtensionPrefs::IsOrphanedExtensionAcknowledged( 643 bool ExtensionPrefs::IsOrphanedExtensionAcknowledged(
628 const std::string& extension_id) { 644 const std::string& extension_id) {
629 return ReadExtensionPrefBoolean(extension_id, kPrefOrphanAcknowledged); 645 return ReadExtensionPrefBoolean(extension_id, kPrefOrphanAcknowledged);
630 } 646 }
631 647
632 void ExtensionPrefs::AcknowledgeOrphanedExtension( 648 void ExtensionPrefs::AcknowledgeOrphanedExtension(
633 const std::string& extension_id) { 649 const std::string& extension_id) {
634 DCHECK(Extension::IdIsValid(extension_id)); 650 DCHECK(Extension::IdIsValid(extension_id));
635 UpdateExtensionPref(extension_id, kPrefOrphanAcknowledged, 651 UpdateExtensionPref(extension_id, kPrefOrphanAcknowledged,
636 Value::CreateBooleanValue(true)); 652 Value::CreateBooleanValue(true));
653 UpdateExtensionPref(extension_id, kPrefAcknowledgePromptCount, NULL);
637 } 654 }
638 655
639 bool ExtensionPrefs::SetAlertSystemFirstRun() { 656 bool ExtensionPrefs::SetAlertSystemFirstRun() {
640 if (prefs_->GetBoolean(prefs::kExtensionAlertsInitializedPref)) { 657 if (prefs_->GetBoolean(prefs::kExtensionAlertsInitializedPref)) {
641 return true; 658 return true;
642 } 659 }
643 prefs_->SetBoolean(prefs::kExtensionAlertsInitializedPref, true); 660 prefs_->SetBoolean(prefs::kExtensionAlertsInitializedPref, true);
644 return false; 661 return false;
645 } 662 }
646 663
(...skipping 1591 matching lines...) Expand 10 before | Expand all | Expand 10 after
2238 const ExtensionIdList& strings) { 2255 const ExtensionIdList& strings) {
2239 ListPrefUpdate update(prefs_, pref); 2256 ListPrefUpdate update(prefs_, pref);
2240 ListValue* list_of_values = update.Get(); 2257 ListValue* list_of_values = update.Get();
2241 list_of_values->Clear(); 2258 list_of_values->Clear();
2242 for (ExtensionIdList::const_iterator iter = strings.begin(); 2259 for (ExtensionIdList::const_iterator iter = strings.begin();
2243 iter != strings.end(); ++iter) 2260 iter != strings.end(); ++iter)
2244 list_of_values->Append(new StringValue(*iter)); 2261 list_of_values->Append(new StringValue(*iter));
2245 } 2262 }
2246 2263
2247 } // namespace extensions 2264 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_prefs.h ('k') | chrome/browser/extensions/extension_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698