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/chrome_requirements_checker.h" | 5 #include "chrome/browser/extensions/chrome_requirements_checker.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 #include "chrome/browser/gpu/gpu_feature_checker.h" | 9 #include "chrome/browser/gpu/gpu_feature_checker.h" |
10 #include "chrome/grit/generated_resources.h" | 10 #include "chrome/grit/generated_resources.h" |
11 #include "content/public/browser/browser_thread.h" | 11 #include "content/public/browser/browser_thread.h" |
12 #include "extensions/common/extension.h" | 12 #include "extensions/common/extension.h" |
13 #include "extensions/common/manifest.h" | 13 #include "extensions/common/manifest.h" |
14 #include "extensions/common/manifest_handlers/requirements_info.h" | 14 #include "extensions/common/manifest_handlers/requirements_info.h" |
15 #include "gpu/config/gpu_feature_type.h" | 15 #include "gpu/config/gpu_feature_type.h" |
16 #include "ui/base/l10n/l10n_util.h" | 16 #include "ui/base/l10n/l10n_util.h" |
17 | 17 |
18 #if defined(OS_WIN) | |
19 #include "base/win/metro.h" | |
20 #endif | |
21 | |
22 namespace extensions { | 18 namespace extensions { |
23 | 19 |
24 ChromeRequirementsChecker::ChromeRequirementsChecker() | 20 ChromeRequirementsChecker::ChromeRequirementsChecker() |
25 : pending_requirement_checks_(0), weak_ptr_factory_(this) { | 21 : pending_requirement_checks_(0), weak_ptr_factory_(this) { |
26 } | 22 } |
27 | 23 |
28 ChromeRequirementsChecker::~ChromeRequirementsChecker() { | 24 ChromeRequirementsChecker::~ChromeRequirementsChecker() { |
29 } | 25 } |
30 | 26 |
31 void ChromeRequirementsChecker::Check( | 27 void ChromeRequirementsChecker::Check( |
32 const scoped_refptr<const Extension>& extension, | 28 const scoped_refptr<const Extension>& extension, |
33 const RequirementsCheckedCallback& callback) { | 29 const RequirementsCheckedCallback& callback) { |
34 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 30 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
35 | 31 |
36 callback_ = callback; | 32 callback_ = callback; |
37 const RequirementsInfo& requirements = | 33 const RequirementsInfo& requirements = |
38 RequirementsInfo::GetRequirements(extension.get()); | 34 RequirementsInfo::GetRequirements(extension.get()); |
39 | 35 |
40 if (requirements.npapi) { | 36 if (requirements.npapi) { |
41 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 37 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
42 errors_.push_back( | 38 errors_.push_back( |
43 l10n_util::GetStringUTF8(IDS_EXTENSION_NPAPI_NOT_SUPPORTED)); | 39 l10n_util::GetStringUTF8(IDS_EXTENSION_NPAPI_NOT_SUPPORTED)); |
44 #endif | 40 #endif |
45 #if defined(OS_WIN) | |
46 if (base::win::IsMetroProcess()) { | |
47 errors_.push_back( | |
48 l10n_util::GetStringUTF8(IDS_EXTENSION_NPAPI_NOT_SUPPORTED)); | |
49 } | |
50 #endif | |
51 } | 41 } |
52 | 42 |
53 if (requirements.window_shape) { | 43 if (requirements.window_shape) { |
54 #if !defined(USE_AURA) | 44 #if !defined(USE_AURA) |
55 errors_.push_back( | 45 errors_.push_back( |
56 l10n_util::GetStringUTF8(IDS_EXTENSION_WINDOW_SHAPE_NOT_SUPPORTED)); | 46 l10n_util::GetStringUTF8(IDS_EXTENSION_WINDOW_SHAPE_NOT_SUPPORTED)); |
57 #endif | 47 #endif |
58 } | 48 } |
59 | 49 |
60 if (requirements.webgl) { | 50 if (requirements.webgl) { |
(...skipping 29 matching lines...) Expand all Loading... |
90 if (--pending_requirement_checks_ == 0) { | 80 if (--pending_requirement_checks_ == 0) { |
91 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, | 81 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, |
92 base::Bind(callback_, errors_)); | 82 base::Bind(callback_, errors_)); |
93 // Reset the callback so any ref-counted bound parameters will get released. | 83 // Reset the callback so any ref-counted bound parameters will get released. |
94 callback_.Reset(); | 84 callback_.Reset(); |
95 errors_.clear(); | 85 errors_.clear(); |
96 } | 86 } |
97 } | 87 } |
98 | 88 |
99 } // namespace extensions | 89 } // namespace extensions |
OLD | NEW |