| 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/location_bar/location_bar_bubble_delegate_view
.h" | 5 #include "chrome/browser/ui/views/location_bar/location_bar_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/fullscreen_controller.h" | 10 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" |
| 11 #include "content/public/browser/notification_source.h" | 11 #include "content/public/browser/notification_source.h" |
| 12 #include "ui/gfx/geometry/rect.h" | 12 #include "ui/gfx/geometry/rect.h" |
| 13 | 13 |
| 14 LocationBarBubbleDelegateView::LocationBarBubbleDelegateView( | 14 LocationBarBubbleDelegateView::LocationBarBubbleDelegateView( |
| 15 views::View* anchor_view, | 15 views::WidgetObserverView* anchor_view, |
| 16 content::WebContents* web_contents) | 16 content::WebContents* web_contents) |
| 17 : BubbleDelegateView(anchor_view, | 17 : BubbleDelegateView(anchor_view, |
| 18 anchor_view ? views::BubbleBorder::TOP_RIGHT | 18 anchor_view ? views::BubbleBorder::TOP_RIGHT |
| 19 : views::BubbleBorder::NONE) { | 19 : views::BubbleBorder::NONE) { |
| 20 // Add observer to close the bubble if the fullscreen state changes. | 20 // Add observer to close the bubble if the fullscreen state changes. |
| 21 if (web_contents) { | 21 if (web_contents) { |
| 22 Browser* browser = chrome::FindBrowserWithWebContents(web_contents); | 22 Browser* browser = chrome::FindBrowserWithWebContents(web_contents); |
| 23 registrar_.Add( | 23 registrar_.Add( |
| 24 this, chrome::NOTIFICATION_FULLSCREEN_CHANGED, | 24 this, chrome::NOTIFICATION_FULLSCREEN_CHANGED, |
| 25 content::Source<FullscreenController>( | 25 content::Source<FullscreenController>( |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 if (GetAnchorView()) | 59 if (GetAnchorView()) |
| 60 return; | 60 return; |
| 61 | 61 |
| 62 const int kBubblePaddingFromScreenEdge = 20; | 62 const int kBubblePaddingFromScreenEdge = 20; |
| 63 int horizontal_offset = width() / 2 + kBubblePaddingFromScreenEdge; | 63 int horizontal_offset = width() / 2 + kBubblePaddingFromScreenEdge; |
| 64 const int x_pos = base::i18n::IsRTL() | 64 const int x_pos = base::i18n::IsRTL() |
| 65 ? (screen_bounds.x() + horizontal_offset) | 65 ? (screen_bounds.x() + horizontal_offset) |
| 66 : (screen_bounds.right() - horizontal_offset); | 66 : (screen_bounds.right() - horizontal_offset); |
| 67 SetAnchorRect(gfx::Rect(x_pos, screen_bounds.y(), 0, 0)); | 67 SetAnchorRect(gfx::Rect(x_pos, screen_bounds.y(), 0, 0)); |
| 68 } | 68 } |
| OLD | NEW |