| Index: chrome/browser/extensions/active_script_controller.cc
|
| diff --git a/chrome/browser/extensions/active_script_controller.cc b/chrome/browser/extensions/active_script_controller.cc
|
| index 72a48ef4df145db24a50981f7fdce15b42cb8467..c286a7828831c0996e02ef97dedfb6b012049644 100644
|
| --- a/chrome/browser/extensions/active_script_controller.cc
|
| +++ b/chrome/browser/extensions/active_script_controller.cc
|
| @@ -142,19 +142,34 @@ void ActiveScriptController::OnNavigated() {
|
| pending_requests_.clear();
|
| }
|
|
|
| -void ActiveScriptController::OnNotifyExtensionScriptExecution(
|
| +void ActiveScriptController::OnRequestContentScriptPermission(
|
| const std::string& extension_id,
|
| - int page_id) {
|
| + int page_id,
|
| + int request_id) {
|
| if (!Extension::IdIsValid(extension_id)) {
|
| NOTREACHED() << "'" << extension_id << "' is not a valid id.";
|
| return;
|
| }
|
|
|
| + // This base::Unretained() is safe, because this can only be called from
|
| + // itself.
|
| GetPermissionForInjection(
|
| extension_id,
|
| page_id,
|
| - scoped_ptr<const base::Closure>(
|
| - new base::Closure(base::Bind(&base::DoNothing))));
|
| + scoped_ptr<const base::Closure>(new base::Closure(
|
| + base::Bind(&ActiveScriptController::GrantContentScriptPermission,
|
| + base::Unretained(this),
|
| + request_id))));
|
| +}
|
| +
|
| +void ActiveScriptController::GrantContentScriptPermission(int request_id) {
|
| + content::RenderViewHost* render_view_host =
|
| + web_contents()->GetRenderViewHost();
|
| + if (render_view_host) {
|
| + render_view_host->Send(new ExtensionMsg_GrantContentScriptPermission(
|
| + render_view_host->GetRoutingID(),
|
| + request_id));
|
| + }
|
| }
|
|
|
| void ActiveScriptController::AddOrProcessRequest(
|
| @@ -188,8 +203,8 @@ void ActiveScriptController::AddOrProcessRequest(
|
| bool ActiveScriptController::OnMessageReceived(const IPC::Message& message) {
|
| bool handled = true;
|
| IPC_BEGIN_MESSAGE_MAP(ActiveScriptController, message)
|
| - IPC_MESSAGE_HANDLER(ExtensionHostMsg_NotifyExtensionScriptExecution,
|
| - OnNotifyExtensionScriptExecution)
|
| + IPC_MESSAGE_HANDLER(ExtensionHostMsg_RequestContentScriptPermission,
|
| + OnRequestContentScriptPermission)
|
| IPC_MESSAGE_UNHANDLED(handled = false)
|
| IPC_END_MESSAGE_MAP()
|
| return handled;
|
|
|