| 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 // Anything that gets here should have a page or browser action. | 113 // Anything that gets here should have a page or browser action. |
| 114 DCHECK(extension_action); | 114 DCHECK(extension_action); |
| 115 int tab_id = SessionTabHelper::IdForTab(web_contents()); | 115 int tab_id = SessionTabHelper::IdForTab(web_contents()); |
| 116 if (!extension_action->GetIsVisible(tab_id)) | 116 if (!extension_action->GetIsVisible(tab_id)) |
| 117 return ExtensionAction::ACTION_NONE; | 117 return ExtensionAction::ACTION_NONE; |
| 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 extension); |
| 124 return ExtensionAction::ACTION_NONE; | 125 return ExtensionAction::ACTION_NONE; |
| 125 } | 126 } |
| 126 | 127 |
| 127 void ExtensionActionRunner::RunBlockedActions(const Extension* extension) { | 128 void ExtensionActionRunner::RunBlockedActions(const Extension* extension) { |
| 128 DCHECK(base::ContainsKey(pending_scripts_, extension->id()) || | 129 DCHECK(base::ContainsKey(pending_scripts_, extension->id()) || |
| 129 web_request_blocked_.count(extension->id()) != 0); | 130 web_request_blocked_.count(extension->id()) != 0); |
| 130 | 131 |
| 131 // Clicking to run the extension counts as granting it permission to run on | 132 // Clicking to run the extension counts as granting it permission to run on |
| 132 // the given tab. | 133 // the given tab. |
| 133 // The extension may already have active tab at this point, but granting | 134 // The extension may already have active tab at this point, but granting |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 UnloadedExtensionInfo::Reason reason) { | 423 UnloadedExtensionInfo::Reason reason) { |
| 423 PendingScriptMap::iterator iter = pending_scripts_.find(extension->id()); | 424 PendingScriptMap::iterator iter = pending_scripts_.find(extension->id()); |
| 424 if (iter != pending_scripts_.end()) { | 425 if (iter != pending_scripts_.end()) { |
| 425 pending_scripts_.erase(iter); | 426 pending_scripts_.erase(iter); |
| 426 ExtensionActionAPI::Get(browser_context_) | 427 ExtensionActionAPI::Get(browser_context_) |
| 427 ->NotifyPageActionsChanged(web_contents()); | 428 ->NotifyPageActionsChanged(web_contents()); |
| 428 } | 429 } |
| 429 } | 430 } |
| 430 | 431 |
| 431 } // namespace extensions | 432 } // namespace extensions |
| OLD | NEW |