OLD | NEW |
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/requirements_checker.h" | 5 #include "chrome/browser/extensions/requirements_checker.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/browser/gpu/gpu_feature_checker.h" | 9 #include "chrome/browser/gpu/gpu_feature_checker.h" |
10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 | 23 |
24 RequirementsChecker::RequirementsChecker() | 24 RequirementsChecker::RequirementsChecker() |
25 : pending_requirement_checks_(0) { | 25 : pending_requirement_checks_(0) { |
26 } | 26 } |
27 | 27 |
28 RequirementsChecker::~RequirementsChecker() { | 28 RequirementsChecker::~RequirementsChecker() { |
29 } | 29 } |
30 | 30 |
31 void RequirementsChecker::Check(scoped_refptr<const Extension> extension, | 31 void RequirementsChecker::Check(scoped_refptr<const Extension> extension, |
32 base::Callback<void(std::vector<std::string> errors)> callback) { | 32 base::Callback<void(std::vector<std::string> errors)> callback) { |
33 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 33 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
34 | 34 |
35 callback_ = callback; | 35 callback_ = callback; |
36 const RequirementsInfo& requirements = | 36 const RequirementsInfo& requirements = |
37 RequirementsInfo::GetRequirements(extension.get()); | 37 RequirementsInfo::GetRequirements(extension.get()); |
38 | 38 |
39 if (requirements.npapi) { | 39 if (requirements.npapi) { |
40 #if defined(OS_CHROMEOS) | 40 #if defined(OS_CHROMEOS) |
41 errors_.push_back( | 41 errors_.push_back( |
42 l10n_util::GetStringUTF8(IDS_EXTENSION_NPAPI_NOT_SUPPORTED)); | 42 l10n_util::GetStringUTF8(IDS_EXTENSION_NPAPI_NOT_SUPPORTED)); |
43 #endif // defined(OS_CHROMEOS) | 43 #endif // defined(OS_CHROMEOS) |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 if (--pending_requirement_checks_ == 0) { | 107 if (--pending_requirement_checks_ == 0) { |
108 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, | 108 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, |
109 base::Bind(callback_, errors_)); | 109 base::Bind(callback_, errors_)); |
110 // Reset the callback so any ref-counted bound parameters will get released. | 110 // Reset the callback so any ref-counted bound parameters will get released. |
111 callback_.Reset(); | 111 callback_.Reset(); |
112 errors_.clear(); | 112 errors_.clear(); |
113 } | 113 } |
114 } | 114 } |
115 | 115 |
116 } // namespace extensions | 116 } // namespace extensions |
OLD | NEW |