| OLD | NEW |
| 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 #include "chrome/browser/ui/views/managed_full_screen_bubble_delegate_view.h" | 5 #include "chrome/browser/ui/views/managed_full_screen_bubble_delegate_view.h" |
| 6 | 6 |
| 7 #include "chrome/browser/chrome_notification_types.h" | 7 #include "chrome/browser/chrome_notification_types.h" |
| 8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
| 9 #include "chrome/browser/ui/browser_finder.h" | 9 #include "chrome/browser/ui/browser_finder.h" |
| 10 #include "chrome/browser/ui/exclusive_access/exclusive_access_controller_manager
.h" |
| 10 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" | 11 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" |
| 11 #include "content/public/browser/notification_source.h" | 12 #include "content/public/browser/notification_source.h" |
| 12 #include "ui/gfx/geometry/rect.h" | 13 #include "ui/gfx/geometry/rect.h" |
| 13 | 14 |
| 14 ManagedFullScreenBubbleDelegateView::ManagedFullScreenBubbleDelegateView( | 15 ManagedFullScreenBubbleDelegateView::ManagedFullScreenBubbleDelegateView( |
| 15 views::View* anchor_view, | 16 views::View* anchor_view, |
| 16 content::WebContents* web_contents) | 17 content::WebContents* web_contents) |
| 17 : BubbleDelegateView( | 18 : BubbleDelegateView( |
| 18 anchor_view, | 19 anchor_view, |
| 19 anchor_view ? | 20 anchor_view ? |
| 20 views::BubbleBorder::TOP_RIGHT : views::BubbleBorder::NONE) { | 21 views::BubbleBorder::TOP_RIGHT : views::BubbleBorder::NONE) { |
| 21 // Add observer to close the bubble if the fullscreen state changes. | 22 // Add observer to close the bubble if the fullscreen state changes. |
| 22 if (web_contents) { | 23 if (web_contents) { |
| 23 Browser* browser = chrome::FindBrowserWithWebContents(web_contents); | 24 Browser* browser = chrome::FindBrowserWithWebContents(web_contents); |
| 24 registrar_.Add(this, chrome::NOTIFICATION_FULLSCREEN_CHANGED, | 25 registrar_.Add(this, chrome::NOTIFICATION_FULLSCREEN_CHANGED, |
| 25 content::Source<FullscreenController>( | 26 content::Source<FullscreenController>( |
| 26 browser->fullscreen_controller())); | 27 browser->GetExclusiveAccessControllerManager() |
| 28 ->GetFullscreenController())); |
| 27 } | 29 } |
| 28 } | 30 } |
| 29 | 31 |
| 30 ManagedFullScreenBubbleDelegateView::~ManagedFullScreenBubbleDelegateView() { | 32 ManagedFullScreenBubbleDelegateView::~ManagedFullScreenBubbleDelegateView() { |
| 31 } | 33 } |
| 32 | 34 |
| 33 void ManagedFullScreenBubbleDelegateView::Observe( | 35 void ManagedFullScreenBubbleDelegateView::Observe( |
| 34 int type, | 36 int type, |
| 35 const content::NotificationSource& source, | 37 const content::NotificationSource& source, |
| 36 const content::NotificationDetails& details) { | 38 const content::NotificationDetails& details) { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 49 return; | 51 return; |
| 50 | 52 |
| 51 const int kBubblePaddingFromScreenEdge = 20; | 53 const int kBubblePaddingFromScreenEdge = 20; |
| 52 int bubble_half_width = width() / 2; | 54 int bubble_half_width = width() / 2; |
| 53 const int x_pos = base::i18n::IsRTL() ? | 55 const int x_pos = base::i18n::IsRTL() ? |
| 54 (screen_bounds.x() + bubble_half_width + kBubblePaddingFromScreenEdge) : | 56 (screen_bounds.x() + bubble_half_width + kBubblePaddingFromScreenEdge) : |
| 55 (screen_bounds.right() - bubble_half_width - | 57 (screen_bounds.right() - bubble_half_width - |
| 56 kBubblePaddingFromScreenEdge); | 58 kBubblePaddingFromScreenEdge); |
| 57 SetAnchorRect(gfx::Rect(x_pos, screen_bounds.y(), 0, 0)); | 59 SetAnchorRect(gfx::Rect(x_pos, screen_bounds.y(), 0, 0)); |
| 58 } | 60 } |
| OLD | NEW |