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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/views/first_run_bubble.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef CHROME_BROWSER_UI_VIEWS_FIRST_RUN_BUBBLE_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_FIRST_RUN_BUBBLE_H_
6 #define CHROME_BROWSER_UI_VIEWS_FIRST_RUN_BUBBLE_H_ 6 #define CHROME_BROWSER_UI_VIEWS_FIRST_RUN_BUBBLE_H_
7 7
8 #include "base/macros.h"
8 #include "ui/views/bubble/bubble_delegate.h" 9 #include "ui/views/bubble/bubble_delegate.h"
9 #include "ui/views/controls/link_listener.h" 10 #include "ui/views/controls/link_listener.h"
10 11
11 class Browser; 12 class Browser;
12 13
13 class FirstRunBubble : public views::BubbleDelegateView, 14 class FirstRunBubble : public views::BubbleDelegateView,
14 public views::LinkListener { 15 public views::LinkListener {
15 public: 16 public:
16 // |browser| is the opening browser and is NULL in unittests. 17 // |browser| is the opening browser and is NULL in unittests.
17 static FirstRunBubble* ShowBubble(Browser* browser, views::View* anchor_view); 18 static FirstRunBubble* ShowBubble(Browser* browser, views::View* anchor_view);
18 19
19 protected: 20 protected:
20 // views::BubbleDelegateView overrides: 21 // views::BubbleDelegateView overrides:
21 void Init() override; 22 void Init() override;
22 23
23 private: 24 private:
24 FirstRunBubble(Browser* browser, views::View* anchor_view); 25 FirstRunBubble(Browser* browser, views::View* anchor_view);
25 ~FirstRunBubble() override; 26 ~FirstRunBubble() override;
26 27
28 // This class observes keyboard events targeted towards the target view
29 // dismisses the first run bubble accordingly.
30 class FirstRunBubbleCloser : public ui::EventHandler {
31 public:
32 FirstRunBubbleCloser(FirstRunBubble* bubble, views::View* anchor_view);
33 ~FirstRunBubbleCloser() override;
34
35 // ui::EventHandler overrides.
36 void OnKeyEvent(ui::KeyEvent* event) override;
37
38 private:
39 void AddKeyboardEventObserver();
40 void RemoveKeyboardEventObserver();
41
42 // The bubble instance.
43 FirstRunBubble* bubble_;
44
45 // The widget we are observing for keyboard events.
46 views::Widget* anchor_widget_;
47
48 DISALLOW_COPY_AND_ASSIGN(FirstRunBubbleCloser);
49 };
50
27 // views::LinkListener overrides: 51 // views::LinkListener overrides:
28 void LinkClicked(views::Link* source, int event_flags) override; 52 void LinkClicked(views::Link* source, int event_flags) override;
29 53
30 Browser* browser_; 54 Browser* browser_;
55 FirstRunBubbleCloser bubble_closer_;
31 56
32 DISALLOW_COPY_AND_ASSIGN(FirstRunBubble); 57 DISALLOW_COPY_AND_ASSIGN(FirstRunBubble);
33 }; 58 };
34 59
35 #endif // CHROME_BROWSER_UI_VIEWS_FIRST_RUN_BUBBLE_H_ 60 #endif // CHROME_BROWSER_UI_VIEWS_FIRST_RUN_BUBBLE_H_
OLDNEW
« 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