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(); | 135 popup_ = new views::Widget; |
136 popup_->SetOpacity(static_cast<unsigned char>(0xff * kOpacity)); | |
137 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); | 136 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); |
138 params.transparent = true; | 137 params.transparent = true; |
139 params.can_activate = false; | 138 params.can_activate = false; |
140 params.delete_on_destroy = false; | 139 params.delete_on_destroy = false; |
141 params.parent = frame->GetNativeView(); | 140 params.parent = frame->GetNativeView(); |
142 params.bounds = GetPopupRect(false); | 141 params.bounds = GetPopupRect(false); |
143 popup_->Init(params); | 142 popup_->Init(params); |
144 popup_->SetContentsView(view_); | 143 popup_->SetContentsView(view_); |
| 144 popup_->SetOpacity(static_cast<unsigned char>(0xff * kOpacity)); |
145 popup_->Show(); // This does not activate the popup. | 145 popup_->Show(); // This does not activate the popup. |
146 | 146 |
147 // Start the initial delay timer and begin watching the mouse. | 147 // Start the initial delay timer and begin watching the mouse. |
148 initial_delay_.Start(base::TimeDelta::FromMilliseconds(kInitialDelayMs), this, | 148 initial_delay_.Start(base::TimeDelta::FromMilliseconds(kInitialDelayMs), this, |
149 &FullscreenExitBubble::CheckMousePosition); | 149 &FullscreenExitBubble::CheckMousePosition); |
150 gfx::Point cursor_pos = views::Screen::GetCursorScreenPoint(); | 150 gfx::Point cursor_pos = views::Screen::GetCursorScreenPoint(); |
151 last_mouse_pos_ = cursor_pos; | 151 last_mouse_pos_ = cursor_pos; |
152 views::View::ConvertPointToView(NULL, root_view_, &last_mouse_pos_); | 152 views::View::ConvertPointToView(NULL, root_view_, &last_mouse_pos_); |
153 mouse_position_checker_.Start( | 153 mouse_position_checker_.Start( |
154 base::TimeDelta::FromMilliseconds(1000 / kPositionCheckHz), this, | 154 base::TimeDelta::FromMilliseconds(1000 / kPositionCheckHz), this, |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 } | 255 } |
256 // 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 |
257 // size is async. Instead we use the size of the screen. | 257 // size is async. Instead we use the size of the screen. |
258 gfx::Rect screen_bounds = views::Screen::GetMonitorAreaNearestWindow( | 258 gfx::Rect screen_bounds = views::Screen::GetMonitorAreaNearestWindow( |
259 root_view_->GetWidget()->GetNativeView()); | 259 root_view_->GetWidget()->GetNativeView()); |
260 gfx::Point origin(screen_bounds.x() + | 260 gfx::Point origin(screen_bounds.x() + |
261 (screen_bounds.width() - size.width()) / 2, | 261 (screen_bounds.width() - size.width()) / 2, |
262 screen_bounds.y()); | 262 screen_bounds.y()); |
263 return gfx::Rect(origin, size); | 263 return gfx::Rect(origin, size); |
264 } | 264 } |
OLD | NEW |