OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_reenabler.h" | 5 #include "chrome/browser/extensions/extension_reenabler.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "chrome/browser/extensions/extension_service.h" | 8 #include "chrome/browser/extensions/extension_service.h" |
9 #include "chrome/browser/extensions/webstore_data_fetcher.h" | 9 #include "chrome/browser/extensions/webstore_data_fetcher.h" |
10 #include "chrome/browser/extensions/webstore_inline_installer.h" | 10 #include "chrome/browser/extensions/webstore_inline_installer.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 Finish(ABORTED); | 22 Finish(ABORTED); |
23 } | 23 } |
24 | 24 |
25 // static | 25 // static |
26 scoped_ptr<ExtensionReenabler> ExtensionReenabler::PromptForReenable( | 26 scoped_ptr<ExtensionReenabler> ExtensionReenabler::PromptForReenable( |
27 const scoped_refptr<const Extension>& extension, | 27 const scoped_refptr<const Extension>& extension, |
28 content::BrowserContext* browser_context, | 28 content::BrowserContext* browser_context, |
29 content::WebContents* web_contents, | 29 content::WebContents* web_contents, |
30 const GURL& referrer_url, | 30 const GURL& referrer_url, |
31 const Callback& callback) { | 31 const Callback& callback) { |
32 #if DCHECK_IS_ON | 32 #if DCHECK_IS_ON() |
33 // We should only try to reenable an extension that is, in fact, disabled. | 33 // We should only try to reenable an extension that is, in fact, disabled. |
34 DCHECK(ExtensionRegistry::Get(browser_context)->disabled_extensions(). | 34 DCHECK(ExtensionRegistry::Get(browser_context)->disabled_extensions(). |
35 Contains(extension->id())); | 35 Contains(extension->id())); |
36 // Currently, this should only be used for extensions that are disabled due | 36 // Currently, this should only be used for extensions that are disabled due |
37 // to a permissions increase. | 37 // to a permissions increase. |
38 int disable_reasons = | 38 int disable_reasons = |
39 ExtensionPrefs::Get(browser_context)->GetDisableReasons(extension->id()); | 39 ExtensionPrefs::Get(browser_context)->GetDisableReasons(extension->id()); |
40 DCHECK_NE(0, disable_reasons & Extension::DISABLE_PERMISSIONS_INCREASE); | 40 DCHECK_NE(0, disable_reasons & Extension::DISABLE_PERMISSIONS_INCREASE); |
41 #endif // DCHECK_IS_ON | 41 #endif // DCHECK_IS_ON() |
42 | 42 |
43 return make_scoped_ptr(new ExtensionReenabler( | 43 return make_scoped_ptr(new ExtensionReenabler( |
44 extension, | 44 extension, |
45 browser_context, | 45 browser_context, |
46 referrer_url, | 46 referrer_url, |
47 callback, | 47 callback, |
48 make_scoped_ptr(new ExtensionInstallPrompt(web_contents)))); | 48 make_scoped_ptr(new ExtensionInstallPrompt(web_contents)))); |
49 } | 49 } |
50 | 50 |
51 // static | 51 // static |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 } | 154 } |
155 | 155 |
156 void ExtensionReenabler::Finish(ReenableResult result) { | 156 void ExtensionReenabler::Finish(ReenableResult result) { |
157 DCHECK(!finished_); | 157 DCHECK(!finished_); |
158 finished_ = true; | 158 finished_ = true; |
159 registry_observer_.RemoveAll(); | 159 registry_observer_.RemoveAll(); |
160 callback_.Run(result); | 160 callback_.Run(result); |
161 } | 161 } |
162 | 162 |
163 } // namespace extensions | 163 } // namespace extensions |
OLD | NEW |