| 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/script_bubble_icon_view.h" | 5 #include "chrome/browser/ui/views/location_bar/script_bubble_icon_view.h" |
| 6 | 6 |
| 7 #include "base/string_number_conversions.h" | 7 #include "base/string_number_conversions.h" |
| 8 #include "chrome/browser/ui/view_ids.h" | 8 #include "chrome/browser/ui/view_ids.h" |
| 9 #include "chrome/browser/ui/views/script_bubble_view.h" | 9 #include "chrome/browser/ui/views/script_bubble_view.h" |
| 10 #include "chrome/common/icon_with_badge_image_source.h" | 10 #include "chrome/common/icon_with_badge_image_source.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 | 77 |
| 78 bool ScriptBubbleIconView::OnKeyPressed(const ui::KeyEvent& event) { | 78 bool ScriptBubbleIconView::OnKeyPressed(const ui::KeyEvent& event) { |
| 79 if (event.key_code() == ui::VKEY_SPACE || | 79 if (event.key_code() == ui::VKEY_SPACE || |
| 80 event.key_code() == ui::VKEY_RETURN) { | 80 event.key_code() == ui::VKEY_RETURN) { |
| 81 ShowScriptBubble(this, location_bar_delegate_->GetWebContents()); | 81 ShowScriptBubble(this, location_bar_delegate_->GetWebContents()); |
| 82 return true; | 82 return true; |
| 83 } | 83 } |
| 84 return false; | 84 return false; |
| 85 } | 85 } |
| 86 | 86 |
| 87 ui::EventResult ScriptBubbleIconView::OnGestureEvent(ui::GestureEvent* event) { | 87 void ScriptBubbleIconView::OnGestureEvent(ui::GestureEvent* event) { |
| 88 if (event->type() == ui::ET_GESTURE_TAP) { | 88 if (event->type() == ui::ET_GESTURE_TAP) { |
| 89 ShowScriptBubble(this, location_bar_delegate_->GetWebContents()); | 89 ShowScriptBubble(this, location_bar_delegate_->GetWebContents()); |
| 90 return ui::ER_CONSUMED; | 90 event->SetHandled(); |
| 91 } | 91 } |
| 92 return ui::ER_UNHANDLED; | |
| 93 } | 92 } |
| 94 | 93 |
| 95 void ScriptBubbleIconView::ShowScriptBubble(views::View* anchor_view, | 94 void ScriptBubbleIconView::ShowScriptBubble(views::View* anchor_view, |
| 96 WebContents* web_contents) { | 95 WebContents* web_contents) { |
| 97 ScriptBubbleView* script_bubble = new ScriptBubbleView(anchor_view, | 96 ScriptBubbleView* script_bubble = new ScriptBubbleView(anchor_view, |
| 98 web_contents); | 97 web_contents); |
| 99 views::BubbleDelegateView::CreateBubble(script_bubble); | 98 views::BubbleDelegateView::CreateBubble(script_bubble); |
| 100 script_bubble->Show(); | 99 script_bubble->Show(); |
| 101 } | 100 } |
| OLD | NEW |