| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |