OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/exclusive_access_bubble_views.h" | 5 #include "chrome/browser/ui/views/exclusive_access_bubble_views.h" |
6 | 6 |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/app/chrome_command_ids.h" | 9 #include "chrome/app/chrome_command_ids.h" |
10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
(...skipping 26 matching lines...) Expand all Loading... | |
37 #include "ui/base/l10n/l10n_util_win.h" | 37 #include "ui/base/l10n/l10n_util_win.h" |
38 #endif | 38 #endif |
39 | 39 |
40 // ExclusiveAccessView --------------------------------------------------------- | 40 // ExclusiveAccessView --------------------------------------------------------- |
41 | 41 |
42 namespace { | 42 namespace { |
43 | 43 |
44 // Space between the site info label and the buttons / link. | 44 // Space between the site info label and the buttons / link. |
45 const int kMiddlePaddingPx = 30; | 45 const int kMiddlePaddingPx = 30; |
46 | 46 |
47 // Gets the opacity of the bubble when not animating. | 47 float GetBackgroundOpacity() { |
48 int GetMaximumOpacity() { | 48 return ExclusiveAccessManager::IsSimplifiedFullscreenUIEnabled() ? 0.7 : 1.0; |
49 return ExclusiveAccessManager::IsSimplifiedFullscreenUIEnabled() ? 180 : 255; | |
50 } | 49 } |
51 | 50 |
52 class ButtonView : public views::View { | 51 class ButtonView : public views::View { |
53 public: | 52 public: |
54 ButtonView(views::ButtonListener* listener, int between_button_spacing); | 53 ButtonView(views::ButtonListener* listener, int between_button_spacing); |
55 ~ButtonView() override; | 54 ~ButtonView() override; |
56 | 55 |
57 // Returns an empty size when the view is not visible. | 56 // Returns an empty size when the view is not visible. |
58 gfx::Size GetPreferredSize() const override; | 57 gfx::Size GetPreferredSize() const override; |
59 | 58 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
102 const GURL& url, | 101 const GURL& url, |
103 ExclusiveAccessBubbleType bubble_type); | 102 ExclusiveAccessBubbleType bubble_type); |
104 ~ExclusiveAccessView() override; | 103 ~ExclusiveAccessView() override; |
105 | 104 |
106 // views::ButtonListener | 105 // views::ButtonListener |
107 void ButtonPressed(views::Button* sender, const ui::Event& event) override; | 106 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
108 | 107 |
109 // views::LinkListener | 108 // views::LinkListener |
110 void LinkClicked(views::Link* source, int event_flags) override; | 109 void LinkClicked(views::Link* source, int event_flags) override; |
111 | 110 |
111 // views::View | |
112 gfx::Size GetPreferredSize() const override; | |
113 void Layout() override; | |
114 | |
112 void UpdateContent(const GURL& url, ExclusiveAccessBubbleType bubble_type); | 115 void UpdateContent(const GURL& url, ExclusiveAccessBubbleType bubble_type); |
113 | 116 |
114 private: | 117 private: |
115 ExclusiveAccessBubbleViews* bubble_; | 118 ExclusiveAccessBubbleViews* bubble_; |
116 | 119 |
120 // Background and border (semi-transparent). | |
121 views::View* background_; | |
msw
2015/10/22 22:03:44
Why do we need new container views to set the opac
Matt Giuca
2015/10/26 03:10:38
O_o why didn't I think of that?
Thanks, fixed.
A
| |
122 // Container for all text, button and link views. | |
123 views::View* contents_; | |
124 | |
117 // Clickable hint text for exiting fullscreen mode. | 125 // Clickable hint text for exiting fullscreen mode. |
118 views::Link* link_; | 126 views::Link* link_; |
119 // Instruction for exiting mouse lock. | 127 // Instruction for exiting mouse lock. |
120 views::Label* mouse_lock_exit_instruction_; | 128 views::Label* mouse_lock_exit_instruction_; |
121 // Informational label: 'www.foo.com has gone fullscreen'. | 129 // Informational label: 'www.foo.com has gone fullscreen'. |
122 views::Label* message_label_; | 130 views::Label* message_label_; |
123 ButtonView* button_view_; | 131 ButtonView* button_view_; |
124 const base::string16 browser_fullscreen_exit_accelerator_; | 132 const base::string16 browser_fullscreen_exit_accelerator_; |
125 | 133 |
126 DISALLOW_COPY_AND_ASSIGN(ExclusiveAccessView); | 134 DISALLOW_COPY_AND_ASSIGN(ExclusiveAccessView); |
(...skipping 18 matching lines...) Expand all Loading... | |
145 shadow_type = views::BubbleBorder::SMALL_SHADOW; | 153 shadow_type = views::BubbleBorder::SMALL_SHADOW; |
146 #endif | 154 #endif |
147 if (ExclusiveAccessManager::IsSimplifiedFullscreenUIEnabled()) | 155 if (ExclusiveAccessManager::IsSimplifiedFullscreenUIEnabled()) |
148 shadow_type = views::BubbleBorder::NO_SHADOW; | 156 shadow_type = views::BubbleBorder::NO_SHADOW; |
149 | 157 |
150 ui::NativeTheme* theme = ui::NativeTheme::instance(); | 158 ui::NativeTheme* theme = ui::NativeTheme::instance(); |
151 SkColor background_color = | 159 SkColor background_color = |
152 ExclusiveAccessManager::IsSimplifiedFullscreenUIEnabled() | 160 ExclusiveAccessManager::IsSimplifiedFullscreenUIEnabled() |
153 ? SK_ColorBLACK | 161 ? SK_ColorBLACK |
154 : theme->GetSystemColor(ui::NativeTheme::kColorId_BubbleBackground); | 162 : theme->GetSystemColor(ui::NativeTheme::kColorId_BubbleBackground); |
163 SkColor label_background_color = | |
164 ExclusiveAccessManager::IsSimplifiedFullscreenUIEnabled() | |
165 ? SK_ColorTRANSPARENT | |
166 : background_color; | |
155 SkColor foreground_color = | 167 SkColor foreground_color = |
156 ExclusiveAccessManager::IsSimplifiedFullscreenUIEnabled() | 168 ExclusiveAccessManager::IsSimplifiedFullscreenUIEnabled() |
157 ? SK_ColorWHITE | 169 ? SK_ColorWHITE |
158 : theme->GetSystemColor(ui::NativeTheme::kColorId_LabelEnabledColor); | 170 : theme->GetSystemColor(ui::NativeTheme::kColorId_LabelEnabledColor); |
159 | 171 |
160 scoped_ptr<views::BubbleBorder> bubble_border(new views::BubbleBorder( | |
161 views::BubbleBorder::NONE, shadow_type, background_color)); | |
162 set_background(new views::BubbleBackground(bubble_border.get())); | |
163 SetBorder(bubble_border.Pass()); | |
164 SetFocusable(false); | 172 SetFocusable(false); |
165 | 173 |
166 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 174 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
167 const gfx::FontList& medium_font_list = | 175 const gfx::FontList& medium_font_list = |
168 rb.GetFontList(ui::ResourceBundle::MediumFont); | 176 rb.GetFontList(ui::ResourceBundle::MediumFont); |
169 | 177 |
178 background_ = new views::View(); | |
179 scoped_ptr<views::BubbleBorder> bubble_border(new views::BubbleBorder( | |
180 views::BubbleBorder::NONE, shadow_type, background_color)); | |
181 background_->set_background(new views::BubbleBackground(bubble_border.get())); | |
182 background_->SetBorder(bubble_border.Pass()); | |
183 | |
170 if (!ExclusiveAccessManager::IsSimplifiedFullscreenUIEnabled()) { | 184 if (!ExclusiveAccessManager::IsSimplifiedFullscreenUIEnabled()) { |
171 message_label_ = new views::Label(base::string16(), medium_font_list); | 185 message_label_ = new views::Label(base::string16(), medium_font_list); |
172 message_label_->SetEnabledColor(foreground_color); | 186 message_label_->SetEnabledColor(foreground_color); |
173 message_label_->SetBackgroundColor(background_color); | 187 message_label_->SetBackgroundColor(label_background_color); |
174 } | 188 } |
175 | 189 |
176 mouse_lock_exit_instruction_ = | 190 mouse_lock_exit_instruction_ = |
177 new views::Label(bubble_->GetInstructionText(), medium_font_list); | 191 new views::Label(bubble_->GetInstructionText(), medium_font_list); |
178 mouse_lock_exit_instruction_->set_collapse_when_hidden(true); | 192 mouse_lock_exit_instruction_->set_collapse_when_hidden(true); |
179 | 193 |
180 mouse_lock_exit_instruction_->SetEnabledColor(foreground_color); | 194 mouse_lock_exit_instruction_->SetEnabledColor(foreground_color); |
181 mouse_lock_exit_instruction_->SetBackgroundColor(background_color); | 195 mouse_lock_exit_instruction_->SetBackgroundColor(label_background_color); |
182 | 196 |
183 link_ = new views::Link(); | 197 link_ = new views::Link(); |
184 link_->set_collapse_when_hidden(true); | 198 link_->set_collapse_when_hidden(true); |
185 link_->SetFocusable(false); | 199 link_->SetFocusable(false); |
186 #if defined(OS_CHROMEOS) | 200 #if defined(OS_CHROMEOS) |
187 // On CrOS, the link text doesn't change, since it doesn't show the shortcut. | 201 // On CrOS, the link text doesn't change, since it doesn't show the shortcut. |
188 link_->SetText(l10n_util::GetStringUTF16(IDS_EXIT_FULLSCREEN_MODE)); | 202 link_->SetText(l10n_util::GetStringUTF16(IDS_EXIT_FULLSCREEN_MODE)); |
189 #endif | 203 #endif |
190 link_->set_listener(this); | 204 link_->set_listener(this); |
191 link_->SetFontList(medium_font_list); | 205 link_->SetFontList(medium_font_list); |
192 link_->SetPressedColor(foreground_color); | 206 link_->SetPressedColor(foreground_color); |
193 link_->SetEnabledColor(foreground_color); | 207 link_->SetEnabledColor(foreground_color); |
194 link_->SetBackgroundColor(background_color); | 208 link_->SetBackgroundColor(label_background_color); |
195 link_->SetVisible(false); | 209 link_->SetVisible(false); |
196 | 210 |
197 button_view_ = new ButtonView(this, kPaddingPx); | 211 button_view_ = new ButtonView(this, kPaddingPx); |
198 | 212 |
199 views::GridLayout* layout = new views::GridLayout(this); | 213 contents_ = new views::View(); |
214 views::GridLayout* layout = new views::GridLayout(contents_); | |
200 views::ColumnSet* columns = layout->AddColumnSet(0); | 215 views::ColumnSet* columns = layout->AddColumnSet(0); |
201 if (!ExclusiveAccessManager::IsSimplifiedFullscreenUIEnabled()) { | 216 if (!ExclusiveAccessManager::IsSimplifiedFullscreenUIEnabled()) { |
202 // In the simplified UI, do not show the message label, only the exit | 217 // In the simplified UI, do not show the message label, only the exit |
203 // instruction. | 218 // instruction. |
204 columns->AddColumn(views::GridLayout::LEADING, views::GridLayout::CENTER, 0, | 219 columns->AddColumn(views::GridLayout::LEADING, views::GridLayout::CENTER, 0, |
205 views::GridLayout::USE_PREF, 0, 0); | 220 views::GridLayout::USE_PREF, 0, 0); |
206 columns->AddPaddingColumn(1, kMiddlePaddingPx); | 221 columns->AddPaddingColumn(1, kMiddlePaddingPx); |
207 } | 222 } |
208 columns->AddColumn(views::GridLayout::LEADING, views::GridLayout::CENTER, 0, | 223 columns->AddColumn(views::GridLayout::LEADING, views::GridLayout::CENTER, 0, |
209 views::GridLayout::USE_PREF, 0, 0); | 224 views::GridLayout::USE_PREF, 0, 0); |
210 columns->AddColumn(views::GridLayout::LEADING, views::GridLayout::CENTER, 0, | 225 columns->AddColumn(views::GridLayout::LEADING, views::GridLayout::CENTER, 0, |
211 views::GridLayout::USE_PREF, 0, 0); | 226 views::GridLayout::USE_PREF, 0, 0); |
212 columns->AddColumn(views::GridLayout::LEADING, views::GridLayout::CENTER, 0, | 227 columns->AddColumn(views::GridLayout::LEADING, views::GridLayout::CENTER, 0, |
213 views::GridLayout::USE_PREF, 0, 0); | 228 views::GridLayout::USE_PREF, 0, 0); |
214 | 229 |
215 layout->StartRow(0, 0); | 230 layout->StartRow(0, 0); |
216 if (!ExclusiveAccessManager::IsSimplifiedFullscreenUIEnabled()) { | 231 if (!ExclusiveAccessManager::IsSimplifiedFullscreenUIEnabled()) { |
217 DCHECK(message_label_); | 232 DCHECK(message_label_); |
218 layout->AddView(message_label_); | 233 layout->AddView(message_label_); |
219 } | 234 } |
220 layout->AddView(button_view_); | 235 layout->AddView(button_view_); |
221 layout->AddView(mouse_lock_exit_instruction_); | 236 layout->AddView(mouse_lock_exit_instruction_); |
222 layout->AddView(link_); | 237 layout->AddView(link_); |
223 | 238 |
224 gfx::Insets padding(kPaddingPx, kPaddingPx, kPaddingPx, kPaddingPx); | 239 gfx::Insets padding(kPaddingPx, kPaddingPx, kPaddingPx, kPaddingPx); |
225 padding += GetInsets(); | 240 padding += GetInsets(); |
226 layout->SetInsets(padding); | 241 layout->SetInsets(padding); |
227 SetLayoutManager(layout); | 242 contents_->SetLayoutManager(layout); |
243 | |
244 background_->SetPaintToLayer(true); | |
msw
2015/10/22 22:03:44
Shouldn't these values be contingent on the new UI
Matt Giuca
2015/10/26 03:10:39
N/A
| |
245 background_->SetFillsBoundsOpaquely(false); | |
246 background_->layer()->SetOpacity(GetBackgroundOpacity()); | |
247 contents_->SetPaintToLayer(true); | |
248 contents_->SetFillsBoundsOpaquely(false); | |
249 AddChildView(background_); | |
250 AddChildView(contents_); | |
228 | 251 |
229 UpdateContent(url, bubble_type); | 252 UpdateContent(url, bubble_type); |
230 } | 253 } |
231 | 254 |
232 ExclusiveAccessBubbleViews::ExclusiveAccessView::~ExclusiveAccessView() { | 255 ExclusiveAccessBubbleViews::ExclusiveAccessView::~ExclusiveAccessView() { |
233 } | 256 } |
234 | 257 |
235 void ExclusiveAccessBubbleViews::ExclusiveAccessView::ButtonPressed( | 258 void ExclusiveAccessBubbleViews::ExclusiveAccessView::ButtonPressed( |
236 views::Button* sender, | 259 views::Button* sender, |
237 const ui::Event& event) { | 260 const ui::Event& event) { |
238 if (sender == button_view_->accept_button()) | 261 if (sender == button_view_->accept_button()) |
239 bubble_->Accept(); | 262 bubble_->Accept(); |
240 else | 263 else |
241 bubble_->Cancel(); | 264 bubble_->Cancel(); |
242 } | 265 } |
243 | 266 |
244 void ExclusiveAccessBubbleViews::ExclusiveAccessView::LinkClicked( | 267 void ExclusiveAccessBubbleViews::ExclusiveAccessView::LinkClicked( |
245 views::Link* link, | 268 views::Link* link, |
246 int event_flags) { | 269 int event_flags) { |
247 bubble_->ExitExclusiveAccess(); | 270 bubble_->ExitExclusiveAccess(); |
248 } | 271 } |
249 | 272 |
273 gfx::Size ExclusiveAccessBubbleViews::ExclusiveAccessView::GetPreferredSize() | |
274 const { | |
275 return contents_->GetPreferredSize(); | |
276 } | |
277 | |
278 void ExclusiveAccessBubbleViews::ExclusiveAccessView::Layout() { | |
279 // The background's bounds rect must extend out beyond its parent's bounds, to | |
280 // account for the border. | |
281 gfx::Rect background_rect(GetContentsBounds()); | |
282 background_rect.Inset(-background_->GetInsets()); | |
283 background_->SetBoundsRect(background_rect); | |
284 contents_->SetBoundsRect(GetContentsBounds()); | |
285 } | |
286 | |
250 void ExclusiveAccessBubbleViews::ExclusiveAccessView::UpdateContent( | 287 void ExclusiveAccessBubbleViews::ExclusiveAccessView::UpdateContent( |
251 const GURL& url, | 288 const GURL& url, |
252 ExclusiveAccessBubbleType bubble_type) { | 289 ExclusiveAccessBubbleType bubble_type) { |
253 DCHECK_NE(EXCLUSIVE_ACCESS_BUBBLE_TYPE_NONE, bubble_type); | 290 DCHECK_NE(EXCLUSIVE_ACCESS_BUBBLE_TYPE_NONE, bubble_type); |
254 | 291 |
255 if (!ExclusiveAccessManager::IsSimplifiedFullscreenUIEnabled()) { | 292 if (!ExclusiveAccessManager::IsSimplifiedFullscreenUIEnabled()) { |
256 DCHECK(message_label_); | 293 DCHECK(message_label_); |
257 message_label_->SetText(bubble_->GetCurrentMessageText()); | 294 message_label_->SetText(bubble_->GetCurrentMessageText()); |
258 } | 295 } |
259 | 296 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
334 params.parent = | 371 params.parent = |
335 bubble_view_context_->GetBubbleAssociatedWidget()->GetNativeView(); | 372 bubble_view_context_->GetBubbleAssociatedWidget()->GetNativeView(); |
336 // The simplified UI just shows a notice; clicks should go through to the | 373 // The simplified UI just shows a notice; clicks should go through to the |
337 // underlying window. | 374 // underlying window. |
338 params.accept_events = | 375 params.accept_events = |
339 !ExclusiveAccessManager::IsSimplifiedFullscreenUIEnabled(); | 376 !ExclusiveAccessManager::IsSimplifiedFullscreenUIEnabled(); |
340 popup_->Init(params); | 377 popup_->Init(params); |
341 popup_->SetContentsView(view_); | 378 popup_->SetContentsView(view_); |
342 gfx::Size size = GetPopupRect(true).size(); | 379 gfx::Size size = GetPopupRect(true).size(); |
343 popup_->SetBounds(GetPopupRect(false)); | 380 popup_->SetBounds(GetPopupRect(false)); |
344 popup_->SetOpacity(GetMaximumOpacity()); | |
345 // We set layout manager to nullptr to prevent the widget from sizing its | 381 // We set layout manager to nullptr to prevent the widget from sizing its |
346 // contents to the same size as itself. This prevents the widget contents from | 382 // contents to the same size as itself. This prevents the widget contents from |
347 // shrinking while we animate the height of the popup to give the impression | 383 // shrinking while we animate the height of the popup to give the impression |
348 // that it is sliding off the top of the screen. | 384 // that it is sliding off the top of the screen. |
349 popup_->GetRootView()->SetLayoutManager(nullptr); | 385 popup_->GetRootView()->SetLayoutManager(nullptr); |
350 view_->SetBounds(0, 0, size.width(), size.height()); | 386 view_->SetBounds(0, 0, size.width(), size.height()); |
351 if (!ExclusiveAccessManager::IsSimplifiedFullscreenUIEnabled()) | 387 if (!ExclusiveAccessManager::IsSimplifiedFullscreenUIEnabled()) |
352 popup_->ShowInactive(); // This does not activate the popup. | 388 popup_->ShowInactive(); // This does not activate the popup. |
353 | 389 |
354 popup_->AddObserver(this); | 390 popup_->AddObserver(this); |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
438 // switching the animated attribute midway through the animation looks | 474 // switching the animated attribute midway through the animation looks |
439 // weird. | 475 // weird. |
440 animation_->End(); | 476 animation_->End(); |
441 | 477 |
442 animated_attribute_ = expected_animated_attribute; | 478 animated_attribute_ = expected_animated_attribute; |
443 | 479 |
444 // We may have finished hiding |popup_|. However, the bounds animation | 480 // We may have finished hiding |popup_|. However, the bounds animation |
445 // assumes |popup_| has the opacity when it is fully shown and the opacity | 481 // assumes |popup_| has the opacity when it is fully shown and the opacity |
446 // animation assumes |popup_| has the bounds when |popup_| is fully shown. | 482 // animation assumes |popup_| has the bounds when |popup_| is fully shown. |
447 if (animated_attribute_ == ANIMATED_ATTRIBUTE_BOUNDS) | 483 if (animated_attribute_ == ANIMATED_ATTRIBUTE_BOUNDS) |
448 popup_->SetOpacity(GetMaximumOpacity()); | 484 popup_->SetOpacity(255); |
449 else | 485 else |
450 UpdateBounds(); | 486 UpdateBounds(); |
451 } | 487 } |
452 | 488 |
453 UpdateMouseWatcher(); | 489 UpdateMouseWatcher(); |
454 } | 490 } |
455 | 491 |
456 void ExclusiveAccessBubbleViews::UpdateBounds() { | 492 void ExclusiveAccessBubbleViews::UpdateBounds() { |
457 gfx::Rect popup_rect(GetPopupRect(false)); | 493 gfx::Rect popup_rect(GetPopupRect(false)); |
458 if (!popup_rect.IsEmpty()) { | 494 if (!popup_rect.IsEmpty()) { |
459 popup_->SetBounds(popup_rect); | 495 popup_->SetBounds(popup_rect); |
460 view_->SetY(popup_rect.height() - view_->height()); | 496 view_->SetY(popup_rect.height() - view_->height()); |
461 } | 497 } |
462 } | 498 } |
463 | 499 |
464 views::View* ExclusiveAccessBubbleViews::GetBrowserRootView() const { | 500 views::View* ExclusiveAccessBubbleViews::GetBrowserRootView() const { |
465 return bubble_view_context_->GetBubbleAssociatedWidget()->GetRootView(); | 501 return bubble_view_context_->GetBubbleAssociatedWidget()->GetRootView(); |
466 } | 502 } |
467 | 503 |
468 void ExclusiveAccessBubbleViews::AnimationProgressed( | 504 void ExclusiveAccessBubbleViews::AnimationProgressed( |
469 const gfx::Animation* animation) { | 505 const gfx::Animation* animation) { |
470 if (animated_attribute_ == ANIMATED_ATTRIBUTE_OPACITY) { | 506 if (animated_attribute_ == ANIMATED_ATTRIBUTE_OPACITY) { |
471 int opacity = animation_->CurrentValueBetween(0, GetMaximumOpacity()); | 507 int opacity = animation_->CurrentValueBetween(0, 255); |
472 if (opacity == 0) { | 508 if (opacity == 0) { |
473 popup_->Hide(); | 509 popup_->Hide(); |
474 } else { | 510 } else { |
475 popup_->Show(); | 511 popup_->Show(); |
476 popup_->SetOpacity(opacity); | 512 popup_->SetOpacity(opacity); |
477 } | 513 } |
478 } else { | 514 } else { |
479 if (GetPopupRect(false).IsEmpty()) { | 515 if (GetPopupRect(false).IsEmpty()) { |
480 popup_->Hide(); | 516 popup_->Hide(); |
481 } else { | 517 } else { |
(...skipping 28 matching lines...) Expand all Loading... | |
510 // - The top container height is always zero in non-immersive fullscreen. | 546 // - The top container height is always zero in non-immersive fullscreen. |
511 // - Querying the top container height may return the height before entering | 547 // - Querying the top container height may return the height before entering |
512 // fullscreen because layout is disabled while entering fullscreen. | 548 // fullscreen because layout is disabled while entering fullscreen. |
513 // A visual glitch due to the delayed layout is avoided in immersive | 549 // A visual glitch due to the delayed layout is avoided in immersive |
514 // fullscreen because entering fullscreen starts with the top container | 550 // fullscreen because entering fullscreen starts with the top container |
515 // revealed. When revealed, the top container has the same height as before | 551 // revealed. When revealed, the top container has the same height as before |
516 // entering fullscreen. | 552 // entering fullscreen. |
517 top_container_bottom = | 553 top_container_bottom = |
518 bubble_view_context_->GetTopContainerBoundsInScreen().bottom(); | 554 bubble_view_context_->GetTopContainerBoundsInScreen().bottom(); |
519 } | 555 } |
520 // |desired_top| is the top of the bubble area including the shadow. | 556 // |desired_top| is the top of the bubble area excluding the shadow. |
521 int desired_top = kPopupTopPx - view_->border()->GetInsets().top(); | 557 int desired_top = kPopupTopPx; |
522 int y = top_container_bottom + desired_top; | 558 int y = top_container_bottom + desired_top; |
523 | 559 |
524 if (!ignore_animation_state && | 560 if (!ignore_animation_state && |
525 animated_attribute_ == ANIMATED_ATTRIBUTE_BOUNDS) { | 561 animated_attribute_ == ANIMATED_ATTRIBUTE_BOUNDS) { |
526 int total_height = size.height() + desired_top; | 562 int total_height = size.height() + desired_top; |
527 int popup_bottom = animation_->CurrentValueBetween(total_height, 0); | 563 int popup_bottom = animation_->CurrentValueBetween(total_height, 0); |
528 int y_offset = std::min(popup_bottom, desired_top); | 564 int y_offset = std::min(popup_bottom, desired_top); |
529 size.set_height(size.height() - popup_bottom + y_offset); | 565 size.set_height(size.height() - popup_bottom + y_offset); |
530 y -= y_offset; | 566 y -= y_offset; |
531 } | 567 } |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
573 const content::NotificationDetails& details) { | 609 const content::NotificationDetails& details) { |
574 DCHECK_EQ(chrome::NOTIFICATION_FULLSCREEN_CHANGED, type); | 610 DCHECK_EQ(chrome::NOTIFICATION_FULLSCREEN_CHANGED, type); |
575 UpdateForImmersiveState(); | 611 UpdateForImmersiveState(); |
576 } | 612 } |
577 | 613 |
578 void ExclusiveAccessBubbleViews::OnWidgetVisibilityChanged( | 614 void ExclusiveAccessBubbleViews::OnWidgetVisibilityChanged( |
579 views::Widget* widget, | 615 views::Widget* widget, |
580 bool visible) { | 616 bool visible) { |
581 UpdateMouseWatcher(); | 617 UpdateMouseWatcher(); |
582 } | 618 } |
OLD | NEW |