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/views/extensions/extension_action_view_controller.h" | 5 #include "chrome/browser/ui/views/extensions/extension_action_view_controller.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "chrome/browser/extensions/api/commands/command_service.h" | 8 #include "chrome/browser/extensions/api/commands/command_service.h" |
9 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" | 9 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" |
10 #include "chrome/browser/extensions/extension_action.h" | 10 #include "chrome/browser/extensions/extension_action.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 void ExtensionActionViewController::ExecuteActionByUser() { | 65 void ExtensionActionViewController::ExecuteActionByUser() { |
66 ExecuteAction(ExtensionPopup::SHOW, true); | 66 ExecuteAction(ExtensionPopup::SHOW, true); |
67 } | 67 } |
68 | 68 |
69 bool ExtensionActionViewController::ExecuteAction( | 69 bool ExtensionActionViewController::ExecuteAction( |
70 ExtensionPopup::ShowAction show_action, bool grant_tab_permissions) { | 70 ExtensionPopup::ShowAction show_action, bool grant_tab_permissions) { |
71 if (extensions::ExtensionActionAPI::Get(browser_->profile())-> | 71 if (extensions::ExtensionActionAPI::Get(browser_->profile())-> |
72 ExecuteExtensionAction(extension_, browser_, grant_tab_permissions) == | 72 ExecuteExtensionAction(extension_, browser_, grant_tab_permissions) == |
73 ExtensionAction::ACTION_SHOW_POPUP) { | 73 ExtensionAction::ACTION_SHOW_POPUP) { |
74 GURL popup_url = extension_action_->GetPopupUrl(GetCurrentTabId()); | 74 GURL popup_url = extension_action_->GetPopupUrl(GetCurrentTabId()); |
75 if (ShowPopupWithUrl(show_action, popup_url)) { | 75 if (delegate_->GetPreferredPopupViewController()->ShowPopupWithUrl( |
| 76 show_action, popup_url)) { |
76 delegate_->OnPopupShown(grant_tab_permissions); | 77 delegate_->OnPopupShown(grant_tab_permissions); |
77 return true; | 78 return true; |
78 } | 79 } |
79 } | 80 } |
80 return false; | 81 return false; |
81 } | 82 } |
82 | 83 |
83 void ExtensionActionViewController::HidePopup() { | 84 void ExtensionActionViewController::HidePopup() { |
84 if (popup_) | 85 if (popup_) |
85 CleanupPopup(true); | 86 CleanupPopup(true); |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 } | 306 } |
306 | 307 |
307 void ExtensionActionViewController::CleanupPopup(bool close_widget) { | 308 void ExtensionActionViewController::CleanupPopup(bool close_widget) { |
308 DCHECK(popup_); | 309 DCHECK(popup_); |
309 delegate_->CleanupPopup(); | 310 delegate_->CleanupPopup(); |
310 popup_->GetWidget()->RemoveObserver(this); | 311 popup_->GetWidget()->RemoveObserver(this); |
311 if (close_widget) | 312 if (close_widget) |
312 popup_->GetWidget()->Close(); | 313 popup_->GetWidget()->Close(); |
313 popup_ = NULL; | 314 popup_ = NULL; |
314 } | 315 } |
OLD | NEW |