| 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 "chrome/browser/ui/views/keyboard_overlay_delegate.h" | 5 #include "chrome/browser/ui/views/keyboard_overlay_delegate.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 } | 50 } |
| 51 | 51 |
| 52 void KeyboardOverlayDelegate::GetWebUIMessageHandlers( | 52 void KeyboardOverlayDelegate::GetWebUIMessageHandlers( |
| 53 std::vector<WebUIMessageHandler*>* handlers) const { | 53 std::vector<WebUIMessageHandler*>* handlers) const { |
| 54 } | 54 } |
| 55 | 55 |
| 56 void KeyboardOverlayDelegate::GetDialogSize( | 56 void KeyboardOverlayDelegate::GetDialogSize( |
| 57 gfx::Size* size) const { | 57 gfx::Size* size) const { |
| 58 using std::min; | 58 using std::min; |
| 59 DCHECK(view_); | 59 DCHECK(view_); |
| 60 gfx::Rect rect = gfx::Screen::GetMonitorAreaNearestWindow( | 60 gfx::Rect rect = gfx::Screen::GetMonitorNearestWindow( |
| 61 view_->GetWidget()->GetNativeView()); | 61 view_->GetWidget()->GetNativeView()).bounds(); |
| 62 const int width = min(kBaseWidth, rect.width() - kHorizontalMargin); | 62 const int width = min(kBaseWidth, rect.width() - kHorizontalMargin); |
| 63 const int height = width * kBaseHeight / kBaseWidth; | 63 const int height = width * kBaseHeight / kBaseWidth; |
| 64 size->SetSize(width, height); | 64 size->SetSize(width, height); |
| 65 } | 65 } |
| 66 | 66 |
| 67 std::string KeyboardOverlayDelegate::GetDialogArgs() const { | 67 std::string KeyboardOverlayDelegate::GetDialogArgs() const { |
| 68 return "[]"; | 68 return "[]"; |
| 69 } | 69 } |
| 70 | 70 |
| 71 void KeyboardOverlayDelegate::OnDialogClosed( | 71 void KeyboardOverlayDelegate::OnDialogClosed( |
| 72 const std::string& json_retval) { | 72 const std::string& json_retval) { |
| 73 // Re-enable Shift+Alt. crosbug.com/17208. | 73 // Re-enable Shift+Alt. crosbug.com/17208. |
| 74 chromeos::input_method::InputMethodManager::GetInstance()->EnableHotkeys(); | 74 chromeos::input_method::InputMethodManager::GetInstance()->EnableHotkeys(); |
| 75 delete this; | 75 delete this; |
| 76 return; | 76 return; |
| 77 } | 77 } |
| 78 | 78 |
| 79 void KeyboardOverlayDelegate::OnCloseContents(WebContents* source, | 79 void KeyboardOverlayDelegate::OnCloseContents(WebContents* source, |
| 80 bool* out_close_dialog) { | 80 bool* out_close_dialog) { |
| 81 } | 81 } |
| 82 | 82 |
| 83 bool KeyboardOverlayDelegate::ShouldShowDialogTitle() const { | 83 bool KeyboardOverlayDelegate::ShouldShowDialogTitle() const { |
| 84 return false; | 84 return false; |
| 85 } | 85 } |
| 86 | 86 |
| 87 bool KeyboardOverlayDelegate::HandleContextMenu( | 87 bool KeyboardOverlayDelegate::HandleContextMenu( |
| 88 const content::ContextMenuParams& params) { | 88 const content::ContextMenuParams& params) { |
| 89 return true; | 89 return true; |
| 90 } | 90 } |
| OLD | NEW |