| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/extension_action_runner.h" | 5 #include "chrome/browser/extensions/extension_action_runner.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 | 118 |
| 119 if (extension_action->HasPopup(tab_id)) | 119 if (extension_action->HasPopup(tab_id)) |
| 120 return ExtensionAction::ACTION_SHOW_POPUP; | 120 return ExtensionAction::ACTION_SHOW_POPUP; |
| 121 | 121 |
| 122 ExtensionActionAPI::Get(browser_context_) | 122 ExtensionActionAPI::Get(browser_context_) |
| 123 ->DispatchExtensionActionClicked(*extension_action, web_contents()); | 123 ->DispatchExtensionActionClicked(*extension_action, web_contents()); |
| 124 return ExtensionAction::ACTION_NONE; | 124 return ExtensionAction::ACTION_NONE; |
| 125 } | 125 } |
| 126 | 126 |
| 127 void ExtensionActionRunner::RunBlockedActions(const Extension* extension) { | 127 void ExtensionActionRunner::RunBlockedActions(const Extension* extension) { |
| 128 DCHECK(ContainsKey(pending_scripts_, extension->id()) || | 128 DCHECK(base::ContainsKey(pending_scripts_, extension->id()) || |
| 129 web_request_blocked_.count(extension->id()) != 0); | 129 web_request_blocked_.count(extension->id()) != 0); |
| 130 | 130 |
| 131 // Clicking to run the extension counts as granting it permission to run on | 131 // Clicking to run the extension counts as granting it permission to run on |
| 132 // the given tab. | 132 // the given tab. |
| 133 // The extension may already have active tab at this point, but granting | 133 // The extension may already have active tab at this point, but granting |
| 134 // it twice is essentially a no-op. | 134 // it twice is essentially a no-op. |
| 135 TabHelper::FromWebContents(web_contents()) | 135 TabHelper::FromWebContents(web_contents()) |
| 136 ->active_tab_permission_granter() | 136 ->active_tab_permission_granter() |
| 137 ->GrantIfRequested(extension); | 137 ->GrantIfRequested(extension); |
| 138 | 138 |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 UnloadedExtensionInfo::Reason reason) { | 419 UnloadedExtensionInfo::Reason reason) { |
| 420 PendingScriptMap::iterator iter = pending_scripts_.find(extension->id()); | 420 PendingScriptMap::iterator iter = pending_scripts_.find(extension->id()); |
| 421 if (iter != pending_scripts_.end()) { | 421 if (iter != pending_scripts_.end()) { |
| 422 pending_scripts_.erase(iter); | 422 pending_scripts_.erase(iter); |
| 423 ExtensionActionAPI::Get(browser_context_) | 423 ExtensionActionAPI::Get(browser_context_) |
| 424 ->NotifyPageActionsChanged(web_contents()); | 424 ->NotifyPageActionsChanged(web_contents()); |
| 425 } | 425 } |
| 426 } | 426 } |
| 427 | 427 |
| 428 } // namespace extensions | 428 } // namespace extensions |
| OLD | NEW |