| 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/api/declarative/declarative_api.h" | 5 #include "chrome/browser/extensions/api/declarative/declarative_api.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/task_runner_util.h" | 9 #include "base/task_runner_util.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 | 62 |
| 63 bool RulesFunction::HasPermission() { | 63 bool RulesFunction::HasPermission() { |
| 64 std::string event_name; | 64 std::string event_name; |
| 65 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &event_name)); | 65 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &event_name)); |
| 66 if (IsWebViewEvent(event_name) && | 66 if (IsWebViewEvent(event_name) && |
| 67 extension_->permissions_data()->HasAPIPermission( | 67 extension_->permissions_data()->HasAPIPermission( |
| 68 extensions::APIPermission::kWebView)) | 68 extensions::APIPermission::kWebView)) |
| 69 return true; | 69 return true; |
| 70 Feature::Availability availability = | 70 Feature::Availability availability = |
| 71 ExtensionAPI::GetSharedInstance()->IsAvailable( | 71 ExtensionAPI::GetSharedInstance()->IsAvailable( |
| 72 event_name, extension_, Feature::BLESSED_EXTENSION_CONTEXT, | 72 event_name, |
| 73 extension_.get(), |
| 74 Feature::BLESSED_EXTENSION_CONTEXT, |
| 73 source_url()); | 75 source_url()); |
| 74 return availability.is_available(); | 76 return availability.is_available(); |
| 75 } | 77 } |
| 76 | 78 |
| 77 bool RulesFunction::RunAsync() { | 79 bool RulesFunction::RunAsync() { |
| 78 std::string event_name; | 80 std::string event_name; |
| 79 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &event_name)); | 81 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &event_name)); |
| 80 | 82 |
| 81 int webview_instance_id = 0; | 83 int webview_instance_id = 0; |
| 82 EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(1, &webview_instance_id)); | 84 EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(1, &webview_instance_id)); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 } else { | 154 } else { |
| 153 rules_registry_->GetAllRules(extension_id(), &rules); | 155 rules_registry_->GetAllRules(extension_id(), &rules); |
| 154 } | 156 } |
| 155 | 157 |
| 156 results_ = GetRules::Results::Create(rules); | 158 results_ = GetRules::Results::Create(rules); |
| 157 | 159 |
| 158 return true; | 160 return true; |
| 159 } | 161 } |
| 160 | 162 |
| 161 } // namespace extensions | 163 } // namespace extensions |
| OLD | NEW |