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

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

Issue 1518543002: Adds MD ink ripple animations to buttons within location bar (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adds MD ink ripple animations to buttons within location bar (with WidgetObserver) Created 4 years, 10 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_delegate.h"
12 #include "ui/views/widget/widget_observer_view.h"
12 13
13 namespace content { 14 namespace content {
14 class NotificationDetails; 15 class NotificationDetails;
15 class NotificationSource; 16 class NotificationSource;
16 class WebContents; 17 class WebContents;
17 }; 18 };
18 19
19 // Base class for bubbles that are shown from location bar icons. The bubble 20 // 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 21 // will automatically close when the browser transitions in or out of fullscreen
21 // mode. 22 // mode.
22 class LocationBarBubbleDelegateView : public views::BubbleDelegateView, 23 class LocationBarBubbleDelegateView : public views::BubbleDelegateView,
23 public content::NotificationObserver { 24 public content::NotificationObserver {
24 public: 25 public:
25 enum DisplayReason { 26 enum DisplayReason {
26 // The bubble appears as a direct result of a user action (clicking on the 27 // The bubble appears as a direct result of a user action (clicking on the
27 // location bar icon). 28 // location bar icon).
28 USER_GESTURE, 29 USER_GESTURE,
29 30
30 // The bubble appears spontaneously over the course of the user's 31 // 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 32 // interaction with Chrome (e.g. due to some change in the feature's
32 // status). 33 // status).
33 AUTOMATIC, 34 AUTOMATIC,
34 }; 35 };
35 36
36 LocationBarBubbleDelegateView(views::View* anchor_view, 37 LocationBarBubbleDelegateView(views::WidgetObserverView* anchor_view,
37 content::WebContents* web_contents); 38 content::WebContents* web_contents);
38 ~LocationBarBubbleDelegateView() override; 39 ~LocationBarBubbleDelegateView() override;
39 40
40 // Displays the bubble with appearance and behavior tailored for |reason|. 41 // Displays the bubble with appearance and behavior tailored for |reason|.
41 void ShowForReason(DisplayReason reason); 42 void ShowForReason(DisplayReason reason);
42 43
43 // content::NotificationObserver: 44 // content::NotificationObserver:
44 void Observe(int type, 45 void Observe(int type,
45 const content::NotificationSource& source, 46 const content::NotificationSource& source,
46 const content::NotificationDetails& details) override; 47 const content::NotificationDetails& details) override;
47 48
48 protected: 49 protected:
49 // Closes the bubble. 50 // Closes the bubble.
50 virtual void Close(); 51 virtual void Close();
51 52
52 // If the bubble is not anchored to a view, places the bubble in the top right 53 // 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 54 // (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 55 // window. Because the positioning is based on the size of the bubble, this
55 // must be called after the bubble is created. 56 // must be called after the bubble is created.
56 void AdjustForFullscreen(const gfx::Rect& screen_bounds); 57 void AdjustForFullscreen(const gfx::Rect& screen_bounds);
57 58
58 private: 59 private:
59 // Used to register for fullscreen change notifications. 60 // Used to register for fullscreen change notifications.
60 content::NotificationRegistrar registrar_; 61 content::NotificationRegistrar registrar_;
61 62
62 DISALLOW_COPY_AND_ASSIGN(LocationBarBubbleDelegateView); 63 DISALLOW_COPY_AND_ASSIGN(LocationBarBubbleDelegateView);
63 }; 64 };
64 65
65 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_BUBBLE_DELEGATE_VIE W_H_ 66 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_BUBBLE_DELEGATE_VIE W_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698