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

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

Issue 156843004: Remove ExtensionService::extension_prefs() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: additional cleanup Created 6 years, 10 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/suspicious_extension_bubble_controller.h" 5 #include "chrome/browser/extensions/suspicious_extension_bubble_controller.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 10 matching lines...) Expand all
21 21
22 namespace { 22 namespace {
23 23
24 base::LazyInstance<std::set<Profile*> > g_shown_for_profiles = 24 base::LazyInstance<std::set<Profile*> > g_shown_for_profiles =
25 LAZY_INSTANCE_INITIALIZER; 25 LAZY_INSTANCE_INITIALIZER;
26 26
27 //////////////////////////////////////////////////////////////////////////////// 27 ////////////////////////////////////////////////////////////////////////////////
28 // SuspiciousExtensionBubbleDelegate 28 // SuspiciousExtensionBubbleDelegate
29 29
30 SuspiciousExtensionBubbleDelegate::SuspiciousExtensionBubbleDelegate( 30 SuspiciousExtensionBubbleDelegate::SuspiciousExtensionBubbleDelegate(
31 ExtensionService* service) 31 ExtensionService* service)
James Cook 2014/02/07 00:53:02 optional: This looks like it could just take a Pro
Ken Rockot(use gerrit already) 2014/02/10 18:53:02 Done.
32 : service_(service) { 32 : service_(service) {
33 } 33 }
34 34
35 SuspiciousExtensionBubbleDelegate::~SuspiciousExtensionBubbleDelegate() { 35 SuspiciousExtensionBubbleDelegate::~SuspiciousExtensionBubbleDelegate() {
36 } 36 }
37 37
38 bool SuspiciousExtensionBubbleDelegate::ShouldIncludeExtension( 38 bool SuspiciousExtensionBubbleDelegate::ShouldIncludeExtension(
39 const std::string& extension_id) { 39 const std::string& extension_id) {
40 extensions::ExtensionPrefs* prefs = service_->extension_prefs(); 40 extensions::ExtensionPrefs* prefs =
41 extensions::ExtensionPrefs::Get(service_->profile());
41 if (!prefs->IsExtensionDisabled(extension_id)) 42 if (!prefs->IsExtensionDisabled(extension_id))
42 return false; 43 return false;
43 44
44 int disble_reasons = prefs->GetDisableReasons(extension_id); 45 int disble_reasons = prefs->GetDisableReasons(extension_id);
45 if (disble_reasons & extensions::Extension::DISABLE_NOT_VERIFIED) 46 if (disble_reasons & extensions::Extension::DISABLE_NOT_VERIFIED)
46 return !prefs->HasWipeoutBeenAcknowledged(extension_id); 47 return !prefs->HasWipeoutBeenAcknowledged(extension_id);
47 48
48 return false; 49 return false;
49 } 50 }
50 51
51 void SuspiciousExtensionBubbleDelegate::AcknowledgeExtension( 52 void SuspiciousExtensionBubbleDelegate::AcknowledgeExtension(
52 const std::string& extension_id, 53 const std::string& extension_id,
53 ExtensionMessageBubbleController::BubbleAction user_action) { 54 ExtensionMessageBubbleController::BubbleAction user_action) {
54 extensions::ExtensionPrefs* prefs = service_->extension_prefs(); 55 extensions::ExtensionPrefs* prefs =
56 extensions::ExtensionPrefs::Get(service_->profile());
55 prefs->SetWipeoutAcknowledged(extension_id, true); 57 prefs->SetWipeoutAcknowledged(extension_id, true);
56 } 58 }
57 59
58 void SuspiciousExtensionBubbleDelegate::PerformAction( 60 void SuspiciousExtensionBubbleDelegate::PerformAction(
59 const extensions::ExtensionIdList& list) { 61 const extensions::ExtensionIdList& list) {
60 // This bubble solicits no action from the user. Or as Nimoy would have it: 62 // This bubble solicits no action from the user. Or as Nimoy would have it:
61 // "Well, my work here is done". 63 // "Well, my work here is done".
62 } 64 }
63 65
64 base::string16 SuspiciousExtensionBubbleDelegate::GetTitle() const { 66 base::string16 SuspiciousExtensionBubbleDelegate::GetTitle() const {
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 return !g_shown_for_profiles.Get().count(profile_) && 158 return !g_shown_for_profiles.Get().count(profile_) &&
157 !GetExtensionList().empty(); 159 !GetExtensionList().empty();
158 } 160 }
159 161
160 void SuspiciousExtensionBubbleController::Show(ExtensionMessageBubble* bubble) { 162 void SuspiciousExtensionBubbleController::Show(ExtensionMessageBubble* bubble) {
161 g_shown_for_profiles.Get().insert(profile_); 163 g_shown_for_profiles.Get().insert(profile_);
162 ExtensionMessageBubbleController::Show(bubble); 164 ExtensionMessageBubbleController::Show(bubble);
163 } 165 }
164 166
165 } // namespace extensions 167 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698