Index: chrome/browser/ui/views/first_run_bubble.h |
diff --git a/chrome/browser/ui/views/first_run_bubble.h b/chrome/browser/ui/views/first_run_bubble.h |
index b12a05a26ba1725426f1682f16de435b3ff2a6ed..470e985c8e0509502bd22441d1bf179609105555 100644 |
--- a/chrome/browser/ui/views/first_run_bubble.h |
+++ b/chrome/browser/ui/views/first_run_bubble.h |
@@ -5,6 +5,7 @@ |
#ifndef CHROME_BROWSER_UI_VIEWS_FIRST_RUN_BUBBLE_H_ |
#define CHROME_BROWSER_UI_VIEWS_FIRST_RUN_BUBBLE_H_ |
+#include "base/macros.h" |
#include "ui/views/bubble/bubble_delegate.h" |
#include "ui/views/controls/link_listener.h" |
@@ -24,10 +25,34 @@ class FirstRunBubble : public views::BubbleDelegateView, |
FirstRunBubble(Browser* browser, views::View* anchor_view); |
~FirstRunBubble() override; |
+ // This class observes keyboard events targeted towards the target view |
+ // dismisses the first run bubble accordingly. |
+ class FirstRunBubbleCloser : public ui::EventHandler { |
+ public: |
+ FirstRunBubbleCloser(FirstRunBubble* bubble, views::View* anchor_view); |
+ ~FirstRunBubbleCloser() override; |
+ |
+ // ui::EventHandler overrides. |
+ void OnKeyEvent(ui::KeyEvent* event) override; |
+ |
+ private: |
+ void AddKeyboardEventObserver(); |
+ void RemoveKeyboardEventObserver(); |
+ |
+ // The bubble instance. |
+ FirstRunBubble* bubble_; |
+ |
+ // The widget we are observing for keyboard events. |
+ views::Widget* anchor_widget_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(FirstRunBubbleCloser); |
+ }; |
+ |
// views::LinkListener overrides: |
void LinkClicked(views::Link* source, int event_flags) override; |
Browser* browser_; |
+ FirstRunBubbleCloser bubble_closer_; |
DISALLOW_COPY_AND_ASSIGN(FirstRunBubble); |
}; |