| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/location_bar/page_action_image_view.h" | 5 #include "chrome/browser/ui/views/location_bar/page_action_image_view.h" |
| 6 | 6 |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.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/commands/command_service_factory.h" | 9 #include "chrome/browser/extensions/api/commands/command_service_factory.h" |
| 10 #include "chrome/browser/extensions/extension_context_menu_model.h" | 10 #include "chrome/browser/extensions/extension_context_menu_model.h" |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 popup_->GetWidget()->RemoveObserver(this); | 125 popup_->GetWidget()->RemoveObserver(this); |
| 126 HidePopup(); | 126 HidePopup(); |
| 127 } | 127 } |
| 128 | 128 |
| 129 void PageActionImageView::ExecuteAction( | 129 void PageActionImageView::ExecuteAction( |
| 130 ExtensionPopup::ShowAction show_action) { | 130 ExtensionPopup::ShowAction show_action) { |
| 131 TabContents* tab_contents = owner_->GetTabContents(); | 131 TabContents* tab_contents = owner_->GetTabContents(); |
| 132 if (!tab_contents) | 132 if (!tab_contents) |
| 133 return; | 133 return; |
| 134 | 134 |
| 135 extensions::TabHelper* extensions_tab_helper = |
| 136 extensions::TabHelper::FromWebContents(tab_contents->web_contents()); |
| 135 LocationBarController* controller = | 137 LocationBarController* controller = |
| 136 tab_contents->extension_tab_helper()->location_bar_controller(); | 138 extensions_tab_helper->location_bar_controller(); |
| 137 | 139 |
| 138 switch (controller->OnClicked(page_action_->extension_id(), 1)) { | 140 switch (controller->OnClicked(page_action_->extension_id(), 1)) { |
| 139 case LocationBarController::ACTION_NONE: | 141 case LocationBarController::ACTION_NONE: |
| 140 break; | 142 break; |
| 141 | 143 |
| 142 case LocationBarController::ACTION_SHOW_POPUP: | 144 case LocationBarController::ACTION_SHOW_POPUP: |
| 143 ShowPopupWithURL(page_action_->GetPopupUrl(current_tab_id_), show_action); | 145 ShowPopupWithURL(page_action_->GetPopupUrl(current_tab_id_), show_action); |
| 144 break; | 146 break; |
| 145 | 147 |
| 146 case LocationBarController::ACTION_SHOW_CONTEXT_MENU: | 148 case LocationBarController::ACTION_SHOW_CONTEXT_MENU: |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 | 318 |
| 317 popup_ = ExtensionPopup::ShowPopup(popup_url, browser_, this, arrow_location, | 319 popup_ = ExtensionPopup::ShowPopup(popup_url, browser_, this, arrow_location, |
| 318 show_action); | 320 show_action); |
| 319 popup_->GetWidget()->AddObserver(this); | 321 popup_->GetWidget()->AddObserver(this); |
| 320 } | 322 } |
| 321 | 323 |
| 322 void PageActionImageView::HidePopup() { | 324 void PageActionImageView::HidePopup() { |
| 323 if (popup_) | 325 if (popup_) |
| 324 popup_->GetWidget()->Close(); | 326 popup_->GetWidget()->Close(); |
| 325 } | 327 } |
| OLD | NEW |