| 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/ui/extensions/extension_action_view_controller.h" | 5 #include "chrome/browser/ui/extensions/extension_action_view_controller.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 | 209 |
| 210 content::WebContents* web_contents = view_delegate_->GetCurrentWebContents(); | 210 content::WebContents* web_contents = view_delegate_->GetCurrentWebContents(); |
| 211 ExtensionActionRunner* action_runner = | 211 ExtensionActionRunner* action_runner = |
| 212 ExtensionActionRunner::GetForWebContents(web_contents); | 212 ExtensionActionRunner::GetForWebContents(web_contents); |
| 213 if (!action_runner) | 213 if (!action_runner) |
| 214 return false; | 214 return false; |
| 215 | 215 |
| 216 if (action_runner->RunAction(extension(), grant_tab_permissions) == | 216 if (action_runner->RunAction(extension(), grant_tab_permissions) == |
| 217 ExtensionAction::ACTION_SHOW_POPUP) { | 217 ExtensionAction::ACTION_SHOW_POPUP) { |
| 218 GURL popup_url = extension_action_->GetPopupUrl( | 218 GURL popup_url = extension_action_->GetPopupUrl( |
| 219 SessionTabHelper::IdForTab(view_delegate_->GetCurrentWebContents())); | 219 SessionTabHelper::IdForTab(web_contents)); |
| 220 return GetPreferredPopupViewController() | 220 return GetPreferredPopupViewController() |
| 221 ->TriggerPopupWithUrl(show_action, popup_url, grant_tab_permissions); | 221 ->TriggerPopupWithUrl(show_action, popup_url, grant_tab_permissions); |
| 222 } | 222 } |
| 223 return false; | 223 return false; |
| 224 } | 224 } |
| 225 | 225 |
| 226 void ExtensionActionViewController::RegisterCommand() { | 226 void ExtensionActionViewController::RegisterCommand() { |
| 227 if (!ExtensionIsValid()) | 227 if (!ExtensionIsValid()) |
| 228 return; | 228 return; |
| 229 | 229 |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 extension_action_->GetIsVisible( | 421 extension_action_->GetIsVisible( |
| 422 SessionTabHelper::IdForTab(web_contents)); | 422 SessionTabHelper::IdForTab(web_contents)); |
| 423 } | 423 } |
| 424 | 424 |
| 425 bool ExtensionActionViewController::HasBeenBlocked( | 425 bool ExtensionActionViewController::HasBeenBlocked( |
| 426 content::WebContents* web_contents) const { | 426 content::WebContents* web_contents) const { |
| 427 ExtensionActionRunner* action_runner = | 427 ExtensionActionRunner* action_runner = |
| 428 ExtensionActionRunner::GetForWebContents(web_contents); | 428 ExtensionActionRunner::GetForWebContents(web_contents); |
| 429 return action_runner && action_runner->WantsToRun(extension()); | 429 return action_runner && action_runner->WantsToRun(extension()); |
| 430 } | 430 } |
| OLD | NEW |