| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/single_thread_task_runner.h" | 11 #include "base/single_thread_task_runner.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 13 #include "base/threading/thread_task_runner_handle.h" | 13 #include "base/threading/thread_task_runner_handle.h" |
| 14 #include "build/build_config.h" | 14 #include "build/build_config.h" |
| 15 #include "chrome/app/chrome_command_ids.h" | 15 #include "chrome/app/chrome_command_ids.h" |
| 16 #include "chrome/browser/chrome_notification_types.h" | 16 #include "chrome/browser/chrome_notification_types.h" |
| 17 #include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h" | 17 #include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h" |
| 18 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" | 18 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" |
| 19 #include "chrome/browser/ui/views/exclusive_access_bubble_views_context.h" | 19 #include "chrome/browser/ui/views/exclusive_access_bubble_views_context.h" |
| 20 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h" | 20 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h" |
| 21 #include "chrome/browser/ui/views/frame/top_container_view.h" | 21 #include "chrome/browser/ui/views/frame/top_container_view.h" |
| 22 #include "chrome/browser/ui/views/subtle_notification_view.h" | 22 #include "chrome/browser/ui/views/subtle_notification_view.h" |
| 23 #include "chrome/grit/generated_resources.h" | 23 #include "chrome/grit/generated_resources.h" |
| 24 #include "content/public/browser/notification_service.h" | 24 #include "content/public/browser/notification_service.h" |
| 25 #include "ui/accessibility/ax_view_state.h" |
| 25 #include "ui/base/l10n/l10n_util.h" | 26 #include "ui/base/l10n/l10n_util.h" |
| 26 #include "ui/events/keycodes/keyboard_codes.h" | 27 #include "ui/events/keycodes/keyboard_codes.h" |
| 27 #include "ui/gfx/animation/slide_animation.h" | 28 #include "ui/gfx/animation/slide_animation.h" |
| 28 #include "ui/gfx/canvas.h" | 29 #include "ui/gfx/canvas.h" |
| 29 #include "ui/strings/grit/ui_strings.h" | 30 #include "ui/strings/grit/ui_strings.h" |
| 30 #include "ui/views/bubble/bubble_border.h" | 31 #include "ui/views/bubble/bubble_border.h" |
| 31 #include "ui/views/controls/link.h" | 32 #include "ui/views/controls/link.h" |
| 32 #include "ui/views/view.h" | 33 #include "ui/views/view.h" |
| 33 #include "ui/views/widget/widget.h" | 34 #include "ui/views/widget/widget.h" |
| 34 #include "url/gurl.h" | 35 #include "url/gurl.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 if (!ExclusiveAccessManager::IsSimplifiedFullscreenUIEnabled()) | 78 if (!ExclusiveAccessManager::IsSimplifiedFullscreenUIEnabled()) |
| 78 popup_->ShowInactive(); // This does not activate the popup. | 79 popup_->ShowInactive(); // This does not activate the popup. |
| 79 | 80 |
| 80 popup_->AddObserver(this); | 81 popup_->AddObserver(this); |
| 81 | 82 |
| 82 registrar_.Add(this, chrome::NOTIFICATION_FULLSCREEN_CHANGED, | 83 registrar_.Add(this, chrome::NOTIFICATION_FULLSCREEN_CHANGED, |
| 83 content::Source<FullscreenController>( | 84 content::Source<FullscreenController>( |
| 84 bubble_view_context_->GetExclusiveAccessManager() | 85 bubble_view_context_->GetExclusiveAccessManager() |
| 85 ->fullscreen_controller())); | 86 ->fullscreen_controller())); |
| 86 | 87 |
| 88 UpdateForImmersiveState(); |
| 87 UpdateMouseWatcher(); | 89 UpdateMouseWatcher(); |
| 90 |
| 91 LOG(ERROR) << "ExclusiveAccessBubbleViews: NotifyAccessibilityEvent"; |
| 92 view_->NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, false); |
| 88 } | 93 } |
| 89 | 94 |
| 90 ExclusiveAccessBubbleViews::~ExclusiveAccessBubbleViews() { | 95 ExclusiveAccessBubbleViews::~ExclusiveAccessBubbleViews() { |
| 91 popup_->RemoveObserver(this); | 96 popup_->RemoveObserver(this); |
| 92 | 97 |
| 93 // This is tricky. We may be in an ATL message handler stack, in which case | 98 // This is tricky. We may be in an ATL message handler stack, in which case |
| 94 // the popup cannot be deleted yet. We also can't set the popup's ownership | 99 // the popup cannot be deleted yet. We also can't set the popup's ownership |
| 95 // model to NATIVE_WIDGET_OWNS_WIDGET because if the user closed the last tab | 100 // model to NATIVE_WIDGET_OWNS_WIDGET because if the user closed the last tab |
| 96 // while in fullscreen mode, Windows has already destroyed the popup HWND by | 101 // while in fullscreen mode, Windows has already destroyed the popup HWND by |
| 97 // the time we get here, and thus either the popup will already have been | 102 // the time we get here, and thus either the popup will already have been |
| (...skipping 20 matching lines...) Expand all Loading... |
| 118 view_->SetSize(size); | 123 view_->SetSize(size); |
| 119 popup_->SetBounds(GetPopupRect(false)); | 124 popup_->SetBounds(GetPopupRect(false)); |
| 120 Show(); | 125 Show(); |
| 121 | 126 |
| 122 // Stop watching the mouse even if UpdateMouseWatcher() will start watching | 127 // Stop watching the mouse even if UpdateMouseWatcher() will start watching |
| 123 // it again so that the popup with the new content is visible for at least | 128 // it again so that the popup with the new content is visible for at least |
| 124 // |kInitialDelayMs|. | 129 // |kInitialDelayMs|. |
| 125 StopWatchingMouse(); | 130 StopWatchingMouse(); |
| 126 | 131 |
| 127 UpdateMouseWatcher(); | 132 UpdateMouseWatcher(); |
| 133 |
| 134 LOG(ERROR) |
| 135 << "ExclusiveAccessBubbleViews::UpdateContent: NotifyAccessibilityEvent"; |
| 136 view_->NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, false); |
| 128 } | 137 } |
| 129 | 138 |
| 130 void ExclusiveAccessBubbleViews::RepositionIfVisible() { | 139 void ExclusiveAccessBubbleViews::RepositionIfVisible() { |
| 131 if (popup_->IsVisible()) | 140 if (popup_->IsVisible()) |
| 132 UpdateBounds(); | 141 UpdateBounds(); |
| 133 } | 142 } |
| 134 | 143 |
| 135 views::View* ExclusiveAccessBubbleViews::GetView() { | 144 views::View* ExclusiveAccessBubbleViews::GetView() { |
| 136 return view_; | 145 return view_; |
| 137 } | 146 } |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 void ExclusiveAccessBubbleViews::OnWidgetVisibilityChanged( | 287 void ExclusiveAccessBubbleViews::OnWidgetVisibilityChanged( |
| 279 views::Widget* widget, | 288 views::Widget* widget, |
| 280 bool visible) { | 289 bool visible) { |
| 281 UpdateMouseWatcher(); | 290 UpdateMouseWatcher(); |
| 282 } | 291 } |
| 283 | 292 |
| 284 void ExclusiveAccessBubbleViews::LinkClicked(views::Link* link, | 293 void ExclusiveAccessBubbleViews::LinkClicked(views::Link* link, |
| 285 int event_flags) { | 294 int event_flags) { |
| 286 ExitExclusiveAccess(); | 295 ExitExclusiveAccess(); |
| 287 } | 296 } |
| OLD | NEW |