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.
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_
8 #include "content/public/browser/notification_observer.h"
9 #include "content/public/browser/notification_registrar.h"
10 #include "ui/views/bubble/bubble_delegate.h"
13 class NotificationDetails
;
14 class NotificationSource
;
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
{
24 ManagedFullScreenBubbleDelegateView(views::View
* anchor_view
,
25 content::WebContents
* web_contents
);
26 ~ManagedFullScreenBubbleDelegateView() override
;
28 // content::NotificationObserver:
29 void Observe(int type
,
30 const content::NotificationSource
& source
,
31 const content::NotificationDetails
& details
) override
;
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
);
44 // Used to register for fullscreen change notifications.
45 content::NotificationRegistrar registrar_
;
47 DISALLOW_COPY_AND_ASSIGN(ManagedFullScreenBubbleDelegateView
);
50 #endif // CHROME_BROWSER_UI_VIEWS_MANAGED_FULL_SCREEN_BUBBLE_DELEGATE_VIEW_H_