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

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

Issue 2461053002: Center Keyboard Overlay in the work area (Closed)
Patch Set: Fix tests Created 4 years, 1 month 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/content/keyboard_overlay/keyboard_overlay_delegate_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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 =
82 display::Screen::GetScreen() 82 display::Screen::GetScreen()
83 ->GetDisplayNearestWindow(widget_->GetNativeView()) 83 ->GetDisplayNearestWindow(widget_->GetNativeView())
84 .work_area(); 84 .work_area();
85 gfx::Rect bounds(rect.x() + (rect.width() - size.width()) / 2, 85 gfx::Rect bounds(rect.x() + (rect.width() - size.width()) / 2,
86 rect.bottom() - size.height(), size.width(), size.height()); 86 rect.y() + (rect.height() - size.height()) / 2, size.width(),
87 size.height());
87 widget_->SetBounds(bounds); 88 widget_->SetBounds(bounds);
88 89
89 // The widget will be shown when the web contents gets ready to display. 90 // The widget will be shown when the web contents gets ready to display.
90 return widget_; 91 return widget_;
91 } 92 }
92 93
93 ui::ModalType KeyboardOverlayDelegate::GetDialogModalType() const { 94 ui::ModalType KeyboardOverlayDelegate::GetDialogModalType() const {
94 return ui::MODAL_TYPE_SYSTEM; 95 return ui::MODAL_TYPE_SYSTEM;
95 } 96 }
96 97
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 bool KeyboardOverlayDelegate::ShouldShowDialogTitle() const { 134 bool KeyboardOverlayDelegate::ShouldShowDialogTitle() const {
134 return false; 135 return false;
135 } 136 }
136 137
137 bool KeyboardOverlayDelegate::HandleContextMenu( 138 bool KeyboardOverlayDelegate::HandleContextMenu(
138 const content::ContextMenuParams& params) { 139 const content::ContextMenuParams& params) {
139 return true; 140 return true;
140 } 141 }
141 142
142 } // namespace ash 143 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/content/keyboard_overlay/keyboard_overlay_delegate_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698