| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/browser_list.h" | 8 #include "chrome/browser/browser_list.h" |
| 9 #include "chrome/browser/extensions/extension_browser_event_router.h" | 9 #include "chrome/browser/extensions/extension_browser_event_router.h" |
| 10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 // Make the menu appear below the button. | 133 // Make the menu appear below the button. |
| 134 menu_origin.Offset(0, height()); | 134 menu_origin.Offset(0, height()); |
| 135 ShowContextMenu(menu_origin, true); | 135 ShowContextMenu(menu_origin, true); |
| 136 return; | 136 return; |
| 137 } | 137 } |
| 138 | 138 |
| 139 ExecuteAction(button, false); // inspect_with_devtools | 139 ExecuteAction(button, false); // inspect_with_devtools |
| 140 } | 140 } |
| 141 | 141 |
| 142 bool PageActionImageView::OnKeyPressed(const views::KeyEvent& e) { | 142 bool PageActionImageView::OnKeyPressed(const views::KeyEvent& e) { |
| 143 if (e.GetKeyCode() == ui::VKEY_SPACE || | 143 if (e.key_code() == ui::VKEY_SPACE || e.key_code() == ui::VKEY_RETURN) { |
| 144 e.GetKeyCode() == ui::VKEY_RETURN) { | |
| 145 ExecuteAction(1, false); | 144 ExecuteAction(1, false); |
| 146 return true; | 145 return true; |
| 147 } | 146 } |
| 148 return false; | 147 return false; |
| 149 } | 148 } |
| 150 | 149 |
| 151 void PageActionImageView::ShowContextMenu(const gfx::Point& p, | 150 void PageActionImageView::ShowContextMenu(const gfx::Point& p, |
| 152 bool is_mouse_gesture) { | 151 bool is_mouse_gesture) { |
| 153 const Extension* extension = profile_->GetExtensionService()-> | 152 const Extension* extension = profile_->GetExtensionService()-> |
| 154 GetExtensionById(page_action()->extension_id(), false); | 153 GetExtensionById(page_action()->extension_id(), false); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 void PageActionImageView::ExtensionPopupIsClosing(ExtensionPopup* popup) { | 240 void PageActionImageView::ExtensionPopupIsClosing(ExtensionPopup* popup) { |
| 242 DCHECK_EQ(popup_, popup); | 241 DCHECK_EQ(popup_, popup); |
| 243 // ExtensionPopup is ref-counted, so we don't need to delete it. | 242 // ExtensionPopup is ref-counted, so we don't need to delete it. |
| 244 popup_ = NULL; | 243 popup_ = NULL; |
| 245 } | 244 } |
| 246 | 245 |
| 247 void PageActionImageView::HidePopup() { | 246 void PageActionImageView::HidePopup() { |
| 248 if (popup_) | 247 if (popup_) |
| 249 popup_->Close(); | 248 popup_->Close(); |
| 250 } | 249 } |
| OLD | NEW |