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/renderer/extensions/dispatcher.h" | 5 #include "chrome/renderer/extensions/dispatcher.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/debug/alias.h" | 9 #include "base/debug/alias.h" |
10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
(...skipping 1424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1435 static const char kMessage[] = | 1435 static const char kMessage[] = |
1436 "%s cannot be used within a sandboxed frame."; | 1436 "%s cannot be used within a sandboxed frame."; |
1437 std::string error_msg = base::StringPrintf(kMessage, function_name.c_str()); | 1437 std::string error_msg = base::StringPrintf(kMessage, function_name.c_str()); |
1438 v8::ThrowException( | 1438 v8::ThrowException( |
1439 v8::Exception::Error(v8::String::New(error_msg.c_str()))); | 1439 v8::Exception::Error(v8::String::New(error_msg.c_str()))); |
1440 return false; | 1440 return false; |
1441 } | 1441 } |
1442 | 1442 |
1443 Feature::Availability availability = context->GetAvailability(function_name); | 1443 Feature::Availability availability = context->GetAvailability(function_name); |
1444 if (!availability.is_available()) { | 1444 if (!availability.is_available()) { |
1445 Feature::AvailabilityResult result = availability.result(); | |
1446 if (result != Feature::INVALID_MIN_MANIFEST_VERSION && | |
1447 result != Feature::INVALID_MAX_MANIFEST_VERSION && | |
1448 result != Feature::UNSUPPORTED_CHANNEL) { | |
not at google - send to devlin
2013/07/11 19:22:33
these flags seem a bit arbitrary, is there any cha
felt
2013/07/12 01:53:04
Done.
| |
1449 APIActivityLogger::LogBlockedCall(context->extension()->id(), | |
1450 function_name); | |
1451 } | |
1445 v8::ThrowException(v8::Exception::Error( | 1452 v8::ThrowException(v8::Exception::Error( |
1446 v8::String::New(availability.message().c_str()))); | 1453 v8::String::New(availability.message().c_str()))); |
1447 } | 1454 } |
1448 | 1455 |
1449 return availability.is_available(); | 1456 return availability.is_available(); |
1450 } | 1457 } |
1451 | 1458 |
1452 void Dispatcher::DispatchEvent(const std::string& extension_id, | 1459 void Dispatcher::DispatchEvent(const std::string& extension_id, |
1453 const std::string& event_name) const { | 1460 const std::string& event_name) const { |
1454 base::ListValue args; | 1461 base::ListValue args; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1495 RenderView* background_view = | 1502 RenderView* background_view = |
1496 ExtensionHelper::GetBackgroundPage(extension_id); | 1503 ExtensionHelper::GetBackgroundPage(extension_id); |
1497 if (background_view) { | 1504 if (background_view) { |
1498 background_view->Send(new ExtensionHostMsg_EventAck( | 1505 background_view->Send(new ExtensionHostMsg_EventAck( |
1499 background_view->GetRoutingID())); | 1506 background_view->GetRoutingID())); |
1500 } | 1507 } |
1501 } | 1508 } |
1502 } | 1509 } |
1503 | 1510 |
1504 } // namespace extensions | 1511 } // namespace extensions |
OLD | NEW |