OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_UI_VIEWS_MANAGED_FULL_SCREEN_BUBBLE_DELEGATE_VIEW_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_MANAGED_FULL_SCREEN_BUBBLE_DELEGATE_VIEW_H_ |
| 7 |
| 8 #include "content/public/browser/notification_observer.h" |
| 9 #include "content/public/browser/notification_registrar.h" |
| 10 #include "ui/views/bubble/bubble_delegate.h" |
| 11 |
| 12 namespace content { |
| 13 class NotificationDetails; |
| 14 class NotificationSource; |
| 15 class WebContents; |
| 16 }; |
| 17 |
| 18 // View used to automatically close a bubble when the browser transitions in or |
| 19 // out of fullscreen mode. |
| 20 class ManagedFullScreenBubbleDelegateView |
| 21 : public views::BubbleDelegateView, |
| 22 public content::NotificationObserver { |
| 23 public: |
| 24 ManagedFullScreenBubbleDelegateView(views::View* anchor_view, |
| 25 content::WebContents* web_contents); |
| 26 ~ManagedFullScreenBubbleDelegateView() override; |
| 27 |
| 28 // content::NotificationObserver: |
| 29 void Observe(int type, |
| 30 const content::NotificationSource& source, |
| 31 const content::NotificationDetails& details) override; |
| 32 |
| 33 protected: |
| 34 // Closes the bubble. |
| 35 virtual void Close(); |
| 36 |
| 37 // If the bubble is not anchored to a view, places the bubble in the top right |
| 38 // (left in RTL) of the |screen_bounds| that contain web contents's browser |
| 39 // window. Because the positioning is based on the size of the bubble, this |
| 40 // must be called after the bubble is created. |
| 41 void AdjustForFullscreen(const gfx::Rect& screen_bounds); |
| 42 |
| 43 private: |
| 44 // Used to register for fullscreen change notifications. |
| 45 content::NotificationRegistrar registrar_; |
| 46 |
| 47 DISALLOW_COPY_AND_ASSIGN(ManagedFullScreenBubbleDelegateView); |
| 48 }; |
| 49 |
| 50 #endif // CHROME_BROWSER_UI_VIEWS_MANAGED_FULL_SCREEN_BUBBLE_DELEGATE_VIEW_H_ |
OLD | NEW |