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

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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 57
58 // Indicates whether an extension is blacklisted. 58 // Indicates whether an extension is blacklisted.
59 const char kPrefBlacklist[] = "blacklist"; 59 const char kPrefBlacklist[] = "blacklist";
60 60
61 // The oauth client id used for app notification setup. 61 // The oauth client id used for app notification setup.
62 const char kPrefAppNotificationClientId[] = "app_notif_client_id"; 62 const char kPrefAppNotificationClientId[] = "app_notif_client_id";
63 63
64 // Indicates whether the user has disabled notifications or not. 64 // Indicates whether the user has disabled notifications or not.
65 const char kPrefAppNotificationDisbaled[] = "app_notif_disabled"; 65 const char kPrefAppNotificationDisbaled[] = "app_notif_disabled";
66 66
67 // The count of how many times we prompted the user to acknowledge an
68 // extension.
69 const char kPrefAcknowledgePromptCount[] = "ack_prompt_count";
70
67 // Indicates whether the user has acknowledged various types of extensions. 71 // Indicates whether the user has acknowledged various types of extensions.
68 const char kPrefExternalAcknowledged[] = "ack_external"; 72 const char kPrefExternalAcknowledged[] = "ack_external";
69 const char kPrefBlacklistAcknowledged[] = "ack_blacklist"; 73 const char kPrefBlacklistAcknowledged[] = "ack_blacklist";
70 const char kPrefOrphanAcknowledged[] = "ack_orphan"; 74 const char kPrefOrphanAcknowledged[] = "ack_orphan";
71 75
72 // Indicates whether to show an install warning when the user enables. 76 // Indicates whether to show an install warning when the user enables.
73 const char kExtensionDidEscalatePermissions[] = "install_warning_on_enable"; 77 const char kExtensionDidEscalatePermissions[] = "install_warning_on_enable";
74 78
75 // DO NOT USE, use kPrefDisableReasons instead. 79 // DO NOT USE, use kPrefDisableReasons instead.
76 // Indicates whether the extension was updated while it was disabled. 80 // Indicates whether the extension was updated while it was disabled.
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 } 594 }
591 } 595 }
592 596
593 bool ExtensionPrefs::IsExtensionOrphaned(const std::string& extension_id) { 597 bool ExtensionPrefs::IsExtensionOrphaned(const std::string& extension_id) {
594 // TODO(miket): we believe that this test will hinge on the number of 598 // TODO(miket): we believe that this test will hinge on the number of
595 // consecutive times that an update check has returned a certain response 599 // consecutive times that an update check has returned a certain response
596 // versus a success response. For now nobody is orphaned. 600 // versus a success response. For now nobody is orphaned.
597 return false; 601 return false;
598 } 602 }
599 603
604 int ExtensionPrefs::IncrementAcknowledgePromptCount(
605 const std::string& extension_id) {
606 int count = 0;
607 ReadExtensionPrefInteger(extension_id, kPrefAcknowledgePromptCount, &count);
608 ++count;
609 UpdateExtensionPref(extension_id, kPrefAcknowledgePromptCount,
610 Value::CreateIntegerValue(count));
611 return count;
612 }
613
600 bool ExtensionPrefs::IsExternalExtensionAcknowledged( 614 bool ExtensionPrefs::IsExternalExtensionAcknowledged(
601 const std::string& extension_id) { 615 const std::string& extension_id) {
602 return ReadExtensionPrefBoolean(extension_id, kPrefExternalAcknowledged); 616 return ReadExtensionPrefBoolean(extension_id, kPrefExternalAcknowledged);
603 } 617 }
604 618
605 void ExtensionPrefs::AcknowledgeExternalExtension( 619 void ExtensionPrefs::AcknowledgeExternalExtension(
606 const std::string& extension_id) { 620 const std::string& extension_id) {
607 DCHECK(Extension::IdIsValid(extension_id)); 621 DCHECK(Extension::IdIsValid(extension_id));
608 UpdateExtensionPref(extension_id, kPrefExternalAcknowledged, 622 UpdateExtensionPref(extension_id, kPrefExternalAcknowledged,
609 Value::CreateBooleanValue(true)); 623 Value::CreateBooleanValue(true));
624 UpdateExtensionPref(extension_id, kPrefAcknowledgePromptCount, NULL);
610 } 625 }
611 626
612 bool ExtensionPrefs::IsBlacklistedExtensionAcknowledged( 627 bool ExtensionPrefs::IsBlacklistedExtensionAcknowledged(
613 const std::string& extension_id) { 628 const std::string& extension_id) {
614 return ReadExtensionPrefBoolean(extension_id, kPrefBlacklistAcknowledged); 629 return ReadExtensionPrefBoolean(extension_id, kPrefBlacklistAcknowledged);
615 } 630 }
616 631
617 void ExtensionPrefs::AcknowledgeBlacklistedExtension( 632 void ExtensionPrefs::AcknowledgeBlacklistedExtension(
618 const std::string& extension_id) { 633 const std::string& extension_id) {
619 DCHECK(Extension::IdIsValid(extension_id)); 634 DCHECK(Extension::IdIsValid(extension_id));
620 UpdateExtensionPref(extension_id, kPrefBlacklistAcknowledged, 635 UpdateExtensionPref(extension_id, kPrefBlacklistAcknowledged,
621 Value::CreateBooleanValue(true)); 636 Value::CreateBooleanValue(true));
637 UpdateExtensionPref(extension_id, kPrefAcknowledgePromptCount, NULL);
622 } 638 }
623 639
624 bool ExtensionPrefs::IsOrphanedExtensionAcknowledged( 640 bool ExtensionPrefs::IsOrphanedExtensionAcknowledged(
625 const std::string& extension_id) { 641 const std::string& extension_id) {
626 return ReadExtensionPrefBoolean(extension_id, kPrefOrphanAcknowledged); 642 return ReadExtensionPrefBoolean(extension_id, kPrefOrphanAcknowledged);
627 } 643 }
628 644
629 void ExtensionPrefs::AcknowledgeOrphanedExtension( 645 void ExtensionPrefs::AcknowledgeOrphanedExtension(
630 const std::string& extension_id) { 646 const std::string& extension_id) {
631 DCHECK(Extension::IdIsValid(extension_id)); 647 DCHECK(Extension::IdIsValid(extension_id));
632 UpdateExtensionPref(extension_id, kPrefOrphanAcknowledged, 648 UpdateExtensionPref(extension_id, kPrefOrphanAcknowledged,
633 Value::CreateBooleanValue(true)); 649 Value::CreateBooleanValue(true));
650 UpdateExtensionPref(extension_id, kPrefAcknowledgePromptCount, NULL);
634 } 651 }
635 652
636 bool ExtensionPrefs::SetAlertSystemFirstRun() { 653 bool ExtensionPrefs::SetAlertSystemFirstRun() {
637 if (prefs_->GetBoolean(prefs::kExtensionAlertsInitializedPref)) { 654 if (prefs_->GetBoolean(prefs::kExtensionAlertsInitializedPref)) {
638 return true; 655 return true;
639 } 656 }
640 prefs_->SetBoolean(prefs::kExtensionAlertsInitializedPref, true); 657 prefs_->SetBoolean(prefs::kExtensionAlertsInitializedPref, true);
641 return false; 658 return false;
642 } 659 }
643 660
(...skipping 1576 matching lines...) Expand 10 before | Expand all | Expand 10 after
2220 const ExtensionIdList& strings) { 2237 const ExtensionIdList& strings) {
2221 ListPrefUpdate update(prefs_, pref); 2238 ListPrefUpdate update(prefs_, pref);
2222 ListValue* list_of_values = update.Get(); 2239 ListValue* list_of_values = update.Get();
2223 list_of_values->Clear(); 2240 list_of_values->Clear();
2224 for (ExtensionIdList::const_iterator iter = strings.begin(); 2241 for (ExtensionIdList::const_iterator iter = strings.begin();
2225 iter != strings.end(); ++iter) 2242 iter != strings.end(); ++iter)
2226 list_of_values->Append(new StringValue(*iter)); 2243 list_of_values->Append(new StringValue(*iter));
2227 } 2244 }
2228 2245
2229 } // namespace extensions 2246 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698