Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(113)

Side by Side Diff: chrome/browser/ui/views/fullscreen_exit_bubble.cc

Issue 6881107: Rework the way Widget::Init works: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 size_animation_->Reset(1); 124 size_animation_->Reset(1);
125 125
126 // Create the contents view. 126 // Create the contents view.
127 views::Accelerator accelerator(ui::VKEY_UNKNOWN, false, false, false); 127 views::Accelerator accelerator(ui::VKEY_UNKNOWN, false, false, false);
128 bool got_accelerator = frame->GetAccelerator(IDC_FULLSCREEN, &accelerator); 128 bool got_accelerator = frame->GetAccelerator(IDC_FULLSCREEN, &accelerator);
129 DCHECK(got_accelerator); 129 DCHECK(got_accelerator);
130 view_ = new FullscreenExitView( 130 view_ = new FullscreenExitView(
131 this, UTF16ToWideHack(accelerator.GetShortcutText())); 131 this, UTF16ToWideHack(accelerator.GetShortcutText()));
132 132
133 // Initialize the popup. 133 // Initialize the popup.
134 popup_ = views::Widget::CreateWidget();
135 popup_->SetOpacity(static_cast<unsigned char>(0xff * kOpacity));
134 views::Widget::CreateParams params(views::Widget::CreateParams::TYPE_POPUP); 136 views::Widget::CreateParams params(views::Widget::CreateParams::TYPE_POPUP);
135 params.transparent = true; 137 params.transparent = true;
136 params.can_activate = false; 138 params.can_activate = false;
137 params.delete_on_destroy = false; 139 params.delete_on_destroy = false;
138 popup_ = views::Widget::CreateWidget(params); 140 params.parent = frame->GetNativeView();
139 popup_->SetOpacity(static_cast<unsigned char>(0xff * kOpacity)); 141 params.bounds = GetPopupRect(false);
140 popup_->Init(frame->GetNativeView(), GetPopupRect(false)); 142 popup_->Init(params);
141 popup_->SetContentsView(view_); 143 popup_->SetContentsView(view_);
142 popup_->Show(); // This does not activate the popup. 144 popup_->Show(); // This does not activate the popup.
143 145
144 // Start the initial delay timer and begin watching the mouse. 146 // Start the initial delay timer and begin watching the mouse.
145 initial_delay_.Start(base::TimeDelta::FromMilliseconds(kInitialDelayMs), this, 147 initial_delay_.Start(base::TimeDelta::FromMilliseconds(kInitialDelayMs), this,
146 &FullscreenExitBubble::CheckMousePosition); 148 &FullscreenExitBubble::CheckMousePosition);
147 gfx::Point cursor_pos = views::Screen::GetCursorScreenPoint(); 149 gfx::Point cursor_pos = views::Screen::GetCursorScreenPoint();
148 last_mouse_pos_ = cursor_pos; 150 last_mouse_pos_ = cursor_pos;
149 views::View::ConvertPointToView(NULL, root_view_, &last_mouse_pos_); 151 views::View::ConvertPointToView(NULL, root_view_, &last_mouse_pos_);
150 mouse_position_checker_.Start( 152 mouse_position_checker_.Start(
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 } 254 }
253 // NOTE: don't use the bounds of the root_view_. On linux changing window 255 // NOTE: don't use the bounds of the root_view_. On linux changing window
254 // size is async. Instead we use the size of the screen. 256 // size is async. Instead we use the size of the screen.
255 gfx::Rect screen_bounds = views::Screen::GetMonitorAreaNearestWindow( 257 gfx::Rect screen_bounds = views::Screen::GetMonitorAreaNearestWindow(
256 root_view_->GetWidget()->GetNativeView()); 258 root_view_->GetWidget()->GetNativeView());
257 gfx::Point origin(screen_bounds.x() + 259 gfx::Point origin(screen_bounds.x() +
258 (screen_bounds.width() - size.width()) / 2, 260 (screen_bounds.width() - size.width()) / 2,
259 screen_bounds.y()); 261 screen_bounds.y());
260 return gfx::Rect(origin, size); 262 return gfx::Rect(origin, size);
261 } 263 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698