Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(452)

Unified Diff: chrome/browser/ui/views/first_run_bubble.h

Issue 1411423014: Ensure that the first run bubble displays as an inactive bubble window which ensures that it does n… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cache the anchor widget instead of the anchor view in the bubble closer class Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/views/first_run_bubble.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
};
« no previous file with comments | « no previous file | chrome/browser/ui/views/first_run_bubble.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698