| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/fullscreen_exit_bubble.h" | 5 #include "chrome/browser/ui/views/fullscreen_exit_bubble.h" |
| 6 | 6 |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "chrome/app/chrome_command_ids.h" | 8 #include "chrome/app/chrome_command_ids.h" |
| 9 #include "grit/generated_resources.h" | 9 #include "grit/generated_resources.h" |
| 10 #include "ui/base/animation/slide_animation.h" | 10 #include "ui/base/animation/slide_animation.h" |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 size_animation_->Reset(1); | 125 size_animation_->Reset(1); |
| 126 | 126 |
| 127 // Create the contents view. | 127 // Create the contents view. |
| 128 views::Accelerator accelerator(ui::VKEY_UNKNOWN, false, false, false); | 128 views::Accelerator accelerator(ui::VKEY_UNKNOWN, false, false, false); |
| 129 bool got_accelerator = frame->GetAccelerator(IDC_FULLSCREEN, &accelerator); | 129 bool got_accelerator = frame->GetAccelerator(IDC_FULLSCREEN, &accelerator); |
| 130 DCHECK(got_accelerator); | 130 DCHECK(got_accelerator); |
| 131 view_ = new FullscreenExitView( | 131 view_ = new FullscreenExitView( |
| 132 this, UTF16ToWideHack(accelerator.GetShortcutText())); | 132 this, UTF16ToWideHack(accelerator.GetShortcutText())); |
| 133 | 133 |
| 134 // Initialize the popup. | 134 // Initialize the popup. |
| 135 popup_ = views::Widget::CreateWidget(); |
| 136 popup_->SetOpacity(static_cast<unsigned char>(0xff * kOpacity)); |
| 135 views::Widget::CreateParams params(views::Widget::CreateParams::TYPE_POPUP); | 137 views::Widget::CreateParams params(views::Widget::CreateParams::TYPE_POPUP); |
| 136 params.transparent = true; | 138 params.transparent = true; |
| 137 params.can_activate = false; | 139 params.can_activate = false; |
| 138 params.delete_on_destroy = false; | 140 params.delete_on_destroy = false; |
| 139 popup_ = views::Widget::CreateWidget(params); | 141 params.parent = frame->GetNativeView(); |
| 140 popup_->SetOpacity(static_cast<unsigned char>(0xff * kOpacity)); | 142 params.bounds = GetPopupRect(false); |
| 141 popup_->Init(frame->GetNativeView(), GetPopupRect(false)); | 143 popup_->Init(params); |
| 142 popup_->SetContentsView(view_); | 144 popup_->SetContentsView(view_); |
| 143 popup_->Show(); // This does not activate the popup. | 145 popup_->Show(); // This does not activate the popup. |
| 144 | 146 |
| 145 // Start the initial delay timer and begin watching the mouse. | 147 // Start the initial delay timer and begin watching the mouse. |
| 146 initial_delay_.Start(base::TimeDelta::FromMilliseconds(kInitialDelayMs), this, | 148 initial_delay_.Start(base::TimeDelta::FromMilliseconds(kInitialDelayMs), this, |
| 147 &FullscreenExitBubble::CheckMousePosition); | 149 &FullscreenExitBubble::CheckMousePosition); |
| 148 gfx::Point cursor_pos = views::Screen::GetCursorScreenPoint(); | 150 gfx::Point cursor_pos = views::Screen::GetCursorScreenPoint(); |
| 149 last_mouse_pos_ = cursor_pos; | 151 last_mouse_pos_ = cursor_pos; |
| 150 views::View::ConvertPointToView(NULL, root_view_, &last_mouse_pos_); | 152 views::View::ConvertPointToView(NULL, root_view_, &last_mouse_pos_); |
| 151 mouse_position_checker_.Start( | 153 mouse_position_checker_.Start( |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 } | 255 } |
| 254 // NOTE: don't use the bounds of the root_view_. On linux changing window | 256 // NOTE: don't use the bounds of the root_view_. On linux changing window |
| 255 // size is async. Instead we use the size of the screen. | 257 // size is async. Instead we use the size of the screen. |
| 256 gfx::Rect screen_bounds = views::Screen::GetMonitorAreaNearestWindow( | 258 gfx::Rect screen_bounds = views::Screen::GetMonitorAreaNearestWindow( |
| 257 root_view_->GetWidget()->GetNativeView()); | 259 root_view_->GetWidget()->GetNativeView()); |
| 258 gfx::Point origin(screen_bounds.x() + | 260 gfx::Point origin(screen_bounds.x() + |
| 259 (screen_bounds.width() - size.width()) / 2, | 261 (screen_bounds.width() - size.width()) / 2, |
| 260 screen_bounds.y()); | 262 screen_bounds.y()); |
| 261 return gfx::Rect(origin, size); | 263 return gfx::Rect(origin, size); |
| 262 } | 264 } |
| OLD | NEW |