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

Side by Side Diff: ash/content/keyboard_overlay/keyboard_overlay_delegate.cc

Issue 2643853003: ash: fix multiple stack-use-after-scope issues with GetPrimaryDisplay use. (Closed)
Patch Set: one more test case fixed Created 3 years, 11 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
« no previous file with comments | « no previous file | ash/frame/caption_buttons/frame_size_button_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "ash/content/keyboard_overlay/keyboard_overlay_delegate.h" 5 #include "ash/content/keyboard_overlay/keyboard_overlay_delegate.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 widget_ = new views::Widget; 71 widget_ = new views::Widget;
72 views::Widget::InitParams params( 72 views::Widget::InitParams params(
73 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); 73 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS);
74 params.context = Shell::GetPrimaryRootWindow(); 74 params.context = Shell::GetPrimaryRootWindow();
75 params.delegate = view; 75 params.delegate = view;
76 widget_->Init(params); 76 widget_->Init(params);
77 77
78 // Show the widget at the bottom of the work area. 78 // Show the widget at the bottom of the work area.
79 gfx::Size size; 79 gfx::Size size;
80 GetDialogSize(&size); 80 GetDialogSize(&size);
81 const gfx::Rect& rect = 81 const gfx::Rect rect = display::Screen::GetScreen()
82 display::Screen::GetScreen() 82 ->GetDisplayNearestWindow(widget_->GetNativeView())
83 ->GetDisplayNearestWindow(widget_->GetNativeView()) 83 .work_area();
84 .work_area();
85 gfx::Rect bounds(rect.x() + (rect.width() - size.width()) / 2, 84 gfx::Rect bounds(rect.x() + (rect.width() - size.width()) / 2,
86 rect.y() + (rect.height() - size.height()) / 2, size.width(), 85 rect.y() + (rect.height() - size.height()) / 2, size.width(),
87 size.height()); 86 size.height());
88 widget_->SetBounds(bounds); 87 widget_->SetBounds(bounds);
89 88
90 // The widget will be shown when the web contents gets ready to display. 89 // The widget will be shown when the web contents gets ready to display.
91 return widget_; 90 return widget_;
92 } 91 }
93 92
94 ui::ModalType KeyboardOverlayDelegate::GetDialogModalType() const { 93 ui::ModalType KeyboardOverlayDelegate::GetDialogModalType() const {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 bool KeyboardOverlayDelegate::ShouldShowDialogTitle() const { 133 bool KeyboardOverlayDelegate::ShouldShowDialogTitle() const {
135 return false; 134 return false;
136 } 135 }
137 136
138 bool KeyboardOverlayDelegate::HandleContextMenu( 137 bool KeyboardOverlayDelegate::HandleContextMenu(
139 const content::ContextMenuParams& params) { 138 const content::ContextMenuParams& params) {
140 return true; 139 return true;
141 } 140 }
142 141
143 } // namespace ash 142 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/frame/caption_buttons/frame_size_button_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698