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" |
| 11 #include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h" |
11 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" | 12 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" |
12 #include "chrome/browser/ui/views/frame/browser_view.h" | 13 #include "chrome/browser/ui/views/frame/browser_view.h" |
13 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h" | 14 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h" |
14 #include "chrome/browser/ui/views/frame/top_container_view.h" | 15 #include "chrome/browser/ui/views/frame/top_container_view.h" |
15 #include "chrome/grit/generated_resources.h" | 16 #include "chrome/grit/generated_resources.h" |
16 #include "content/public/browser/notification_service.h" | 17 #include "content/public/browser/notification_service.h" |
17 #include "ui/base/l10n/l10n_util.h" | 18 #include "ui/base/l10n/l10n_util.h" |
18 #include "ui/base/resource/resource_bundle.h" | 19 #include "ui/base/resource/resource_bundle.h" |
19 #include "ui/events/keycodes/keyboard_codes.h" | 20 #include "ui/events/keycodes/keyboard_codes.h" |
20 #include "ui/gfx/animation/slide_animation.h" | 21 #include "ui/gfx/animation/slide_animation.h" |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 // We set layout manager to NULL to prevent the widget from sizing its | 289 // We set layout manager to NULL to prevent the widget from sizing its |
289 // contents to the same size as itself. This prevents the widget contents from | 290 // contents to the same size as itself. This prevents the widget contents from |
290 // shrinking while we animate the height of the popup to give the impression | 291 // shrinking while we animate the height of the popup to give the impression |
291 // that it is sliding off the top of the screen. | 292 // that it is sliding off the top of the screen. |
292 popup_->GetRootView()->SetLayoutManager(NULL); | 293 popup_->GetRootView()->SetLayoutManager(NULL); |
293 view_->SetBounds(0, 0, size.width(), size.height()); | 294 view_->SetBounds(0, 0, size.width(), size.height()); |
294 popup_->ShowInactive(); // This does not activate the popup. | 295 popup_->ShowInactive(); // This does not activate the popup. |
295 | 296 |
296 popup_->AddObserver(this); | 297 popup_->AddObserver(this); |
297 | 298 |
298 registrar_.Add(this, chrome::NOTIFICATION_FULLSCREEN_CHANGED, | 299 registrar_.Add( |
299 content::Source<FullscreenController>( | 300 this, chrome::NOTIFICATION_FULLSCREEN_CHANGED, |
300 browser_view_->browser()->fullscreen_controller())); | 301 content::Source<FullscreenController>(browser_view_->browser() |
| 302 ->exclusive_access_manager() |
| 303 ->fullscreen_controller())); |
301 | 304 |
302 UpdateForImmersiveState(); | 305 UpdateForImmersiveState(); |
303 } | 306 } |
304 | 307 |
305 ExclusiveAccessBubbleViews::~ExclusiveAccessBubbleViews() { | 308 ExclusiveAccessBubbleViews::~ExclusiveAccessBubbleViews() { |
306 popup_->RemoveObserver(this); | 309 popup_->RemoveObserver(this); |
307 | 310 |
308 // This is tricky. We may be in an ATL message handler stack, in which case | 311 // This is tricky. We may be in an ATL message handler stack, in which case |
309 // the popup cannot be deleted yet. We also can't set the popup's ownership | 312 // the popup cannot be deleted yet. We also can't set the popup's ownership |
310 // model to NATIVE_WIDGET_OWNS_WIDGET because if the user closed the last tab | 313 // model to NATIVE_WIDGET_OWNS_WIDGET because if the user closed the last tab |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 const content::NotificationDetails& details) { | 508 const content::NotificationDetails& details) { |
506 DCHECK_EQ(chrome::NOTIFICATION_FULLSCREEN_CHANGED, type); | 509 DCHECK_EQ(chrome::NOTIFICATION_FULLSCREEN_CHANGED, type); |
507 UpdateForImmersiveState(); | 510 UpdateForImmersiveState(); |
508 } | 511 } |
509 | 512 |
510 void ExclusiveAccessBubbleViews::OnWidgetVisibilityChanged( | 513 void ExclusiveAccessBubbleViews::OnWidgetVisibilityChanged( |
511 views::Widget* widget, | 514 views::Widget* widget, |
512 bool visible) { | 515 bool visible) { |
513 UpdateMouseWatcher(); | 516 UpdateMouseWatcher(); |
514 } | 517 } |
OLD | NEW |