| 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 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 ExclusiveAccessBubbleViewsContext* context, | 259 ExclusiveAccessBubbleViewsContext* context, |
| 260 const GURL& url, | 260 const GURL& url, |
| 261 ExclusiveAccessBubbleType bubble_type) | 261 ExclusiveAccessBubbleType bubble_type) |
| 262 : ExclusiveAccessBubble(context->GetExclusiveAccessManager(), | 262 : ExclusiveAccessBubble(context->GetExclusiveAccessManager(), |
| 263 url, | 263 url, |
| 264 bubble_type), | 264 bubble_type), |
| 265 bubble_view_context_(context), | 265 bubble_view_context_(context), |
| 266 popup_(nullptr), | 266 popup_(nullptr), |
| 267 animation_(new gfx::SlideAnimation(this)), | 267 animation_(new gfx::SlideAnimation(this)), |
| 268 animated_attribute_(ANIMATED_ATTRIBUTE_BOUNDS) { | 268 animated_attribute_(ANIMATED_ATTRIBUTE_BOUNDS) { |
| 269 animation_->Reset(1); | 269 // With the simplified fullscreen UI flag, initially hide the bubble; |
| 270 // otherwise, initially show it. |
| 271 double initial_value = |
| 272 ExclusiveAccessManager::IsSimplifiedFullscreenUIEnabled() ? 0 : 1; |
| 273 animation_->Reset(initial_value); |
| 270 | 274 |
| 271 // Create the contents view. | 275 // Create the contents view. |
| 272 ui::Accelerator accelerator(ui::VKEY_UNKNOWN, ui::EF_NONE); | 276 ui::Accelerator accelerator(ui::VKEY_UNKNOWN, ui::EF_NONE); |
| 273 bool got_accelerator = | 277 bool got_accelerator = |
| 274 bubble_view_context_->GetBubbleAssociatedWidget()->GetAccelerator( | 278 bubble_view_context_->GetBubbleAssociatedWidget()->GetAccelerator( |
| 275 IDC_FULLSCREEN, &accelerator); | 279 IDC_FULLSCREEN, &accelerator); |
| 276 DCHECK(got_accelerator); | 280 DCHECK(got_accelerator); |
| 277 view_ = new ExclusiveAccessView(this, accelerator.GetShortcutText(), url, | 281 view_ = new ExclusiveAccessView(this, accelerator.GetShortcutText(), url, |
| 278 bubble_type_); | 282 bubble_type_); |
| 279 | 283 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 290 popup_->Init(params); | 294 popup_->Init(params); |
| 291 popup_->SetContentsView(view_); | 295 popup_->SetContentsView(view_); |
| 292 gfx::Size size = GetPopupRect(true).size(); | 296 gfx::Size size = GetPopupRect(true).size(); |
| 293 popup_->SetBounds(GetPopupRect(false)); | 297 popup_->SetBounds(GetPopupRect(false)); |
| 294 // We set layout manager to nullptr to prevent the widget from sizing its | 298 // We set layout manager to nullptr to prevent the widget from sizing its |
| 295 // contents to the same size as itself. This prevents the widget contents from | 299 // contents to the same size as itself. This prevents the widget contents from |
| 296 // shrinking while we animate the height of the popup to give the impression | 300 // shrinking while we animate the height of the popup to give the impression |
| 297 // that it is sliding off the top of the screen. | 301 // that it is sliding off the top of the screen. |
| 298 popup_->GetRootView()->SetLayoutManager(nullptr); | 302 popup_->GetRootView()->SetLayoutManager(nullptr); |
| 299 view_->SetBounds(0, 0, size.width(), size.height()); | 303 view_->SetBounds(0, 0, size.width(), size.height()); |
| 300 popup_->ShowInactive(); // This does not activate the popup. | 304 if (!ExclusiveAccessManager::IsSimplifiedFullscreenUIEnabled()) |
| 305 popup_->ShowInactive(); // This does not activate the popup. |
| 301 | 306 |
| 302 popup_->AddObserver(this); | 307 popup_->AddObserver(this); |
| 303 | 308 |
| 304 registrar_.Add(this, chrome::NOTIFICATION_FULLSCREEN_CHANGED, | 309 registrar_.Add(this, chrome::NOTIFICATION_FULLSCREEN_CHANGED, |
| 305 content::Source<FullscreenController>( | 310 content::Source<FullscreenController>( |
| 306 bubble_view_context_->GetExclusiveAccessManager() | 311 bubble_view_context_->GetExclusiveAccessManager() |
| 307 ->fullscreen_controller())); | 312 ->fullscreen_controller())); |
| 308 | 313 |
| 309 UpdateForImmersiveState(); | 314 UpdateForImmersiveState(); |
| 310 } | 315 } |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 const content::NotificationDetails& details) { | 523 const content::NotificationDetails& details) { |
| 519 DCHECK_EQ(chrome::NOTIFICATION_FULLSCREEN_CHANGED, type); | 524 DCHECK_EQ(chrome::NOTIFICATION_FULLSCREEN_CHANGED, type); |
| 520 UpdateForImmersiveState(); | 525 UpdateForImmersiveState(); |
| 521 } | 526 } |
| 522 | 527 |
| 523 void ExclusiveAccessBubbleViews::OnWidgetVisibilityChanged( | 528 void ExclusiveAccessBubbleViews::OnWidgetVisibilityChanged( |
| 524 views::Widget* widget, | 529 views::Widget* widget, |
| 525 bool visible) { | 530 bool visible) { |
| 526 UpdateMouseWatcher(); | 531 UpdateMouseWatcher(); |
| 527 } | 532 } |
| OLD | NEW |