OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "extensions/browser/extension_function.h" | 5 #include "extensions/browser/extension_function.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "content/public/browser/notification_source.h" | 8 #include "content/public/browser/notification_source.h" |
9 #include "content/public/browser/notification_types.h" | 9 #include "content/public/browser/notification_types.h" |
10 #include "content/public/browser/render_frame_host.h" | 10 #include "content/public/browser/render_frame_host.h" |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 }; | 164 }; |
165 | 165 |
166 ExtensionFunction::ExtensionFunction() | 166 ExtensionFunction::ExtensionFunction() |
167 : request_id_(-1), | 167 : request_id_(-1), |
168 profile_id_(NULL), | 168 profile_id_(NULL), |
169 has_callback_(false), | 169 has_callback_(false), |
170 include_incognito_(false), | 170 include_incognito_(false), |
171 user_gesture_(false), | 171 user_gesture_(false), |
172 bad_message_(false), | 172 bad_message_(false), |
173 histogram_value_(extensions::functions::UNKNOWN), | 173 histogram_value_(extensions::functions::UNKNOWN), |
174 source_tab_id_(-1) { | 174 source_tab_id_(-1), |
| 175 source_context_type_(Feature::UNSPECIFIED_CONTEXT) { |
175 } | 176 } |
176 | 177 |
177 ExtensionFunction::~ExtensionFunction() { | 178 ExtensionFunction::~ExtensionFunction() { |
178 } | 179 } |
179 | 180 |
180 UIThreadExtensionFunction* ExtensionFunction::AsUIThreadExtensionFunction() { | 181 UIThreadExtensionFunction* ExtensionFunction::AsUIThreadExtensionFunction() { |
181 return NULL; | 182 return NULL; |
182 } | 183 } |
183 | 184 |
184 IOThreadExtensionFunction* ExtensionFunction::AsIOThreadExtensionFunction() { | 185 IOThreadExtensionFunction* ExtensionFunction::AsIOThreadExtensionFunction() { |
185 return NULL; | 186 return NULL; |
186 } | 187 } |
187 | 188 |
188 bool ExtensionFunction::HasPermission() { | 189 bool ExtensionFunction::HasPermission() { |
189 Feature::Availability availability = | 190 Feature::Availability availability = |
190 ExtensionAPI::GetSharedInstance()->IsAvailable( | 191 ExtensionAPI::GetSharedInstance()->IsAvailable( |
191 name_, extension_, Feature::BLESSED_EXTENSION_CONTEXT, source_url()); | 192 name_, extension_, source_context_type_, source_url()); |
192 return availability.is_available(); | 193 return availability.is_available(); |
193 } | 194 } |
194 | 195 |
195 void ExtensionFunction::OnQuotaExceeded(const std::string& violation_error) { | 196 void ExtensionFunction::OnQuotaExceeded(const std::string& violation_error) { |
196 error_ = violation_error; | 197 error_ = violation_error; |
197 SendResponse(false); | 198 SendResponse(false); |
198 } | 199 } |
199 | 200 |
200 void ExtensionFunction::SetArgs(const base::ListValue* args) { | 201 void ExtensionFunction::SetArgs(const base::ListValue* args) { |
201 DCHECK(!args_.get()); // Should only be called once. | 202 DCHECK(!args_.get()); // Should only be called once. |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 | 481 |
481 ExtensionFunction::ResponseAction SyncIOThreadExtensionFunction::Run() { | 482 ExtensionFunction::ResponseAction SyncIOThreadExtensionFunction::Run() { |
482 return RespondNow(RunSync() ? ArgumentList(results_.Pass()) : Error(error_)); | 483 return RespondNow(RunSync() ? ArgumentList(results_.Pass()) : Error(error_)); |
483 } | 484 } |
484 | 485 |
485 // static | 486 // static |
486 bool SyncIOThreadExtensionFunction::ValidationFailure( | 487 bool SyncIOThreadExtensionFunction::ValidationFailure( |
487 SyncIOThreadExtensionFunction* function) { | 488 SyncIOThreadExtensionFunction* function) { |
488 return false; | 489 return false; |
489 } | 490 } |
OLD | NEW |