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 double initial_value = |
msw
2015/08/04 18:23:57
nit: maybe add a comment here
Matt Giuca
2015/08/05 03:27:20
Done.
| |
270 ExclusiveAccessManager::IsSimplifiedFullscreenUIEnabled() ? 0 : 1; | |
271 animation_->Reset(initial_value); | |
270 | 272 |
271 // Create the contents view. | 273 // Create the contents view. |
272 ui::Accelerator accelerator(ui::VKEY_UNKNOWN, ui::EF_NONE); | 274 ui::Accelerator accelerator(ui::VKEY_UNKNOWN, ui::EF_NONE); |
273 bool got_accelerator = | 275 bool got_accelerator = |
274 bubble_view_context_->GetBubbleAssociatedWidget()->GetAccelerator( | 276 bubble_view_context_->GetBubbleAssociatedWidget()->GetAccelerator( |
275 IDC_FULLSCREEN, &accelerator); | 277 IDC_FULLSCREEN, &accelerator); |
276 DCHECK(got_accelerator); | 278 DCHECK(got_accelerator); |
277 view_ = new ExclusiveAccessView(this, accelerator.GetShortcutText(), url, | 279 view_ = new ExclusiveAccessView(this, accelerator.GetShortcutText(), url, |
278 bubble_type_); | 280 bubble_type_); |
279 | 281 |
(...skipping 11 matching lines...) Expand all Loading... | |
291 popup_->SetContentsView(view_); | 293 popup_->SetContentsView(view_); |
292 gfx::Size size = GetPopupRect(true).size(); | 294 gfx::Size size = GetPopupRect(true).size(); |
293 popup_->SetBounds(GetPopupRect(false)); | 295 popup_->SetBounds(GetPopupRect(false)); |
294 // We set layout manager to nullptr to prevent the widget from sizing its | 296 // 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 | 297 // 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 | 298 // shrinking while we animate the height of the popup to give the impression |
297 // that it is sliding off the top of the screen. | 299 // that it is sliding off the top of the screen. |
298 popup_->GetRootView()->SetLayoutManager(nullptr); | 300 popup_->GetRootView()->SetLayoutManager(nullptr); |
299 view_->SetBounds(0, 0, size.width(), size.height()); | 301 view_->SetBounds(0, 0, size.width(), size.height()); |
300 popup_->ShowInactive(); // This does not activate the popup. | 302 popup_->ShowInactive(); // This does not activate the popup. |
303 if (ExclusiveAccessManager::IsSimplifiedFullscreenUIEnabled()) | |
304 popup_->Hide(); // Keep hidden by default. | |
msw
2015/08/04 18:23:57
nit: can you just avoid the ShowInactive instead o
Matt Giuca
2015/08/05 03:27:20
Done.
| |
301 | 305 |
302 popup_->AddObserver(this); | 306 popup_->AddObserver(this); |
303 | 307 |
304 registrar_.Add(this, chrome::NOTIFICATION_FULLSCREEN_CHANGED, | 308 registrar_.Add(this, chrome::NOTIFICATION_FULLSCREEN_CHANGED, |
305 content::Source<FullscreenController>( | 309 content::Source<FullscreenController>( |
306 bubble_view_context_->GetExclusiveAccessManager() | 310 bubble_view_context_->GetExclusiveAccessManager() |
307 ->fullscreen_controller())); | 311 ->fullscreen_controller())); |
308 | 312 |
309 UpdateForImmersiveState(); | 313 UpdateForImmersiveState(); |
310 } | 314 } |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
518 const content::NotificationDetails& details) { | 522 const content::NotificationDetails& details) { |
519 DCHECK_EQ(chrome::NOTIFICATION_FULLSCREEN_CHANGED, type); | 523 DCHECK_EQ(chrome::NOTIFICATION_FULLSCREEN_CHANGED, type); |
520 UpdateForImmersiveState(); | 524 UpdateForImmersiveState(); |
521 } | 525 } |
522 | 526 |
523 void ExclusiveAccessBubbleViews::OnWidgetVisibilityChanged( | 527 void ExclusiveAccessBubbleViews::OnWidgetVisibilityChanged( |
524 views::Widget* widget, | 528 views::Widget* widget, |
525 bool visible) { | 529 bool visible) { |
526 UpdateMouseWatcher(); | 530 UpdateMouseWatcher(); |
527 } | 531 } |
OLD | NEW |