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_dialog_view.h" | 5 #include "chrome/browser/ui/views/keyboard_overlay_dialog_view.h" |
6 | 6 |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "chrome/browser/chromeos/input_method/input_method_manager.h" | 8 #include "chrome/browser/chromeos/input_method/input_method_manager.h" |
9 #include "chrome/browser/ui/browser_dialogs.h" | 9 #include "chrome/browser/ui/browser_dialogs.h" |
10 #include "chrome/browser/ui/views/accelerator_table.h" | 10 #include "chrome/browser/ui/views/accelerator_table.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 // Temporarily disable Shift+Alt. crosbug.com/17208. | 85 // Temporarily disable Shift+Alt. crosbug.com/17208. |
86 chromeos::input_method::InputMethodManager::GetInstance()->DisableHotkeys(); | 86 chromeos::input_method::InputMethodManager::GetInstance()->DisableHotkeys(); |
87 | 87 |
88 KeyboardOverlayDelegate* delegate = new KeyboardOverlayDelegate( | 88 KeyboardOverlayDelegate* delegate = new KeyboardOverlayDelegate( |
89 l10n_util::GetStringUTF16(IDS_KEYBOARD_OVERLAY_TITLE)); | 89 l10n_util::GetStringUTF16(IDS_KEYBOARD_OVERLAY_TITLE)); |
90 KeyboardOverlayDialogView* html_view = | 90 KeyboardOverlayDialogView* html_view = |
91 new KeyboardOverlayDialogView(parent_view->browser()->profile(), | 91 new KeyboardOverlayDialogView(parent_view->browser()->profile(), |
92 delegate, | 92 delegate, |
93 parent_view); | 93 parent_view); |
94 delegate->set_view(html_view); | 94 delegate->set_view(html_view); |
| 95 html_view->InitDialog(); |
95 browser::CreateFramelessViewsWindow(owning_window, html_view); | 96 browser::CreateFramelessViewsWindow(owning_window, html_view); |
96 // Show the widget at the bottom of the work area. | 97 // Show the widget at the bottom of the work area. |
97 gfx::Size size; | 98 gfx::Size size; |
98 delegate->GetDialogSize(&size); | 99 delegate->GetDialogSize(&size); |
99 gfx::Rect rect = gfx::Screen::GetMonitorWorkAreaNearestWindow( | 100 gfx::Rect rect = gfx::Screen::GetMonitorWorkAreaNearestWindow( |
100 html_view->GetWidget()->GetNativeView()); | 101 html_view->native_view()); |
101 gfx::Rect bounds((rect.width() - size.width()) / 2, | 102 gfx::Rect bounds((rect.width() - size.width()) / 2, |
102 rect.height() - size.height(), | 103 rect.height() - size.height(), |
103 size.width(), | 104 size.width(), |
104 size.height()); | 105 size.height()); |
105 html_view->GetWidget()->SetBounds(bounds); | 106 html_view->GetWidget()->SetBounds(bounds); |
106 html_view->GetWidget()->Show(); | 107 html_view->GetWidget()->Show(); |
107 } | 108 } |
108 | 109 |
109 bool KeyboardOverlayDialogView::IsCloseAccelerator( | 110 bool KeyboardOverlayDialogView::IsCloseAccelerator( |
110 const ui::Accelerator& accelerator) { | 111 const ui::Accelerator& accelerator) { |
111 return close_accelerators_.find(accelerator) != close_accelerators_.end(); | 112 return close_accelerators_.find(accelerator) != close_accelerators_.end(); |
112 } | 113 } |
OLD | NEW |