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

Side by Side Diff: chrome/browser/ui/views/location_bar/location_bar_bubble_delegate_view.h

Issue 1759453002: Convert location bar bubble delegates to bubble dialog delegates (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: unit test Created 4 years, 9 months 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_LOCATION_BAR_LOCATION_BAR_BUBBLE_DELEGATE_VIEW_H _ 5 #ifndef CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_BUBBLE_DELEGATE_VIEW_H _
6 #define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_BUBBLE_DELEGATE_VIEW_H _ 6 #define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_BUBBLE_DELEGATE_VIEW_H _
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "content/public/browser/notification_observer.h" 9 #include "content/public/browser/notification_observer.h"
10 #include "content/public/browser/notification_registrar.h" 10 #include "content/public/browser/notification_registrar.h"
11 #include "ui/views/bubble/bubble_delegate.h" 11 #include "ui/views/bubble/bubble_dialog_delegate.h"
12 12
13 namespace content { 13 namespace content {
14 class NotificationDetails; 14 class NotificationDetails;
15 class NotificationSource; 15 class NotificationSource;
16 class WebContents; 16 class WebContents;
17 }; 17 };
18 18
19 // Base class for bubbles that are shown from location bar icons. The bubble 19 // Base class for bubbles that are shown from location bar icons. The bubble
20 // will automatically close when the browser transitions in or out of fullscreen 20 // will automatically close when the browser transitions in or out of fullscreen
21 // mode. 21 // mode.
22 class LocationBarBubbleDelegateView : public views::BubbleDelegateView, 22 class LocationBarBubbleDelegateView : public views::BubbleDialogDelegateView,
23 public content::NotificationObserver { 23 public content::NotificationObserver {
24 public: 24 public:
25 enum DisplayReason { 25 enum DisplayReason {
26 // The bubble appears as a direct result of a user action (clicking on the 26 // The bubble appears as a direct result of a user action (clicking on the
27 // location bar icon). 27 // location bar icon).
28 USER_GESTURE, 28 USER_GESTURE,
29 29
30 // The bubble appears spontaneously over the course of the user's 30 // The bubble appears spontaneously over the course of the user's
31 // interaction with Chrome (e.g. due to some change in the feature's 31 // interaction with Chrome (e.g. due to some change in the feature's
32 // status). 32 // status).
33 AUTOMATIC, 33 AUTOMATIC,
34 }; 34 };
35 35
36 LocationBarBubbleDelegateView(views::View* anchor_view, 36 LocationBarBubbleDelegateView(views::View* anchor_view,
37 content::WebContents* web_contents); 37 content::WebContents* web_contents);
38 ~LocationBarBubbleDelegateView() override; 38 ~LocationBarBubbleDelegateView() override;
39 39
40 // Displays the bubble with appearance and behavior tailored for |reason|. 40 // Displays the bubble with appearance and behavior tailored for |reason|.
41 void ShowForReason(DisplayReason reason); 41 void ShowForReason(DisplayReason reason);
42 42
43 // views::BubbleDialogDelegateView:
44 int GetDialogButtons() const override;
45
43 // content::NotificationObserver: 46 // content::NotificationObserver:
44 void Observe(int type, 47 void Observe(int type,
45 const content::NotificationSource& source, 48 const content::NotificationSource& source,
46 const content::NotificationDetails& details) override; 49 const content::NotificationDetails& details) override;
47 50
48 protected: 51 protected:
49 // Closes the bubble. 52 // Closes the bubble.
50 virtual void Close(); 53 virtual void CloseBubble();
sky 2016/03/09 16:18:38 Why do you need CloseBubble()? Can't you use GetWi
Evan Stade 2016/03/09 22:37:50 There are some overrides, like ZoomBubbleView::Clo
51 54
52 // If the bubble is not anchored to a view, places the bubble in the top right 55 // If the bubble is not anchored to a view, places the bubble in the top right
53 // (left in RTL) of the |screen_bounds| that contain web contents's browser 56 // (left in RTL) of the |screen_bounds| that contain web contents's browser
54 // window. Because the positioning is based on the size of the bubble, this 57 // window. Because the positioning is based on the size of the bubble, this
55 // must be called after the bubble is created. 58 // must be called after the bubble is created.
56 void AdjustForFullscreen(const gfx::Rect& screen_bounds); 59 void AdjustForFullscreen(const gfx::Rect& screen_bounds);
57 60
58 private: 61 private:
59 // Used to register for fullscreen change notifications. 62 // Used to register for fullscreen change notifications.
60 content::NotificationRegistrar registrar_; 63 content::NotificationRegistrar registrar_;
61 64
62 DISALLOW_COPY_AND_ASSIGN(LocationBarBubbleDelegateView); 65 DISALLOW_COPY_AND_ASSIGN(LocationBarBubbleDelegateView);
63 }; 66 };
64 67
65 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_BUBBLE_DELEGATE_VIE W_H_ 68 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_BUBBLE_DELEGATE_VIE W_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698