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" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 if (reason == USER_GESTURE) { | 84 if (reason == USER_GESTURE) { |
85 // In the USER_GESTURE case, the icon will be in an active state so the | 85 // In the USER_GESTURE case, the icon will be in an active state so the |
86 // bubble doesn't need an arrow. | 86 // bubble doesn't need an arrow. |
87 SetArrowPaintType(views::BubbleBorder::PAINT_TRANSPARENT); | 87 SetArrowPaintType(views::BubbleBorder::PAINT_TRANSPARENT); |
88 GetWidget()->Show(); | 88 GetWidget()->Show(); |
89 } else { | 89 } else { |
90 GetWidget()->ShowInactive(); | 90 GetWidget()->ShowInactive(); |
91 } | 91 } |
92 } | 92 } |
93 | 93 |
94 int LocationBarBubbleDelegateView::GetDialogButtons() const { | |
95 return ui::DIALOG_BUTTON_NONE; | |
96 } | |
97 | |
98 void LocationBarBubbleDelegateView::Observe( | 94 void LocationBarBubbleDelegateView::Observe( |
99 int type, | 95 int type, |
100 const content::NotificationSource& source, | 96 const content::NotificationSource& source, |
101 const content::NotificationDetails& details) { | 97 const content::NotificationDetails& details) { |
102 DCHECK_EQ(chrome::NOTIFICATION_FULLSCREEN_CHANGED, type); | 98 DCHECK_EQ(chrome::NOTIFICATION_FULLSCREEN_CHANGED, type); |
103 GetWidget()->SetVisibilityAnimationTransition(views::Widget::ANIMATE_NONE); | 99 GetWidget()->SetVisibilityAnimationTransition(views::Widget::ANIMATE_NONE); |
104 CloseBubble(); | 100 CloseBubble(); |
105 } | 101 } |
106 | 102 |
107 void LocationBarBubbleDelegateView::CloseBubble() { | 103 void LocationBarBubbleDelegateView::CloseBubble() { |
108 GetWidget()->Close(); | 104 GetWidget()->Close(); |
109 } | 105 } |
110 | 106 |
111 void LocationBarBubbleDelegateView::AdjustForFullscreen( | 107 void LocationBarBubbleDelegateView::AdjustForFullscreen( |
112 const gfx::Rect& screen_bounds) { | 108 const gfx::Rect& screen_bounds) { |
113 if (GetAnchorView()) | 109 if (GetAnchorView()) |
114 return; | 110 return; |
115 | 111 |
116 const int kBubblePaddingFromScreenEdge = 20; | 112 const int kBubblePaddingFromScreenEdge = 20; |
117 int horizontal_offset = width() / 2 + kBubblePaddingFromScreenEdge; | 113 int horizontal_offset = width() / 2 + kBubblePaddingFromScreenEdge; |
118 const int x_pos = base::i18n::IsRTL() | 114 const int x_pos = base::i18n::IsRTL() |
119 ? (screen_bounds.x() + horizontal_offset) | 115 ? (screen_bounds.x() + horizontal_offset) |
120 : (screen_bounds.right() - horizontal_offset); | 116 : (screen_bounds.right() - horizontal_offset); |
121 SetAnchorRect(gfx::Rect(x_pos, screen_bounds.y(), 0, 0)); | 117 SetAnchorRect(gfx::Rect(x_pos, screen_bounds.y(), 0, 0)); |
122 } | 118 } |
OLD | NEW |