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

Side by Side Diff: chrome/browser/ui/views/keyboard_overlay_dialog_view.cc

Issue 10538098: Disable Shift+Alt while KeyboardOverlayDialogView is shown. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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 "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/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/profiles/profile_manager.h" 9 #include "chrome/browser/profiles/profile_manager.h"
10 #include "chrome/browser/ui/browser_dialogs.h" 10 #include "chrome/browser/ui/browser_dialogs.h"
11 #include "chrome/browser/ui/views/keyboard_overlay_delegate.h" 11 #include "chrome/browser/ui/views/keyboard_overlay_delegate.h"
12 #include "grit/generated_resources.h" 12 #include "grit/generated_resources.h"
13 #include "ui/base/l10n/l10n_util.h" 13 #include "ui/base/l10n/l10n_util.h"
14 #include "ui/gfx/screen.h" 14 #include "ui/gfx/screen.h"
15 #include "ui/views/widget/widget.h" 15 #include "ui/views/widget/widget.h"
16 #include "ui/web_dialogs/web_dialog_delegate.h" 16 #include "ui/web_dialogs/web_dialog_delegate.h"
17 17
18 #if defined(OS_CHROMEOS)
19 #include "chrome/browser/chromeos/input_method/input_method_manager.h"
20 #endif
21
18 using ui::WebDialogDelegate; 22 using ui::WebDialogDelegate;
19 23
20 namespace { 24 namespace {
21 // Store the pointer to the view currently shown. 25 // Store the pointer to the view currently shown.
22 KeyboardOverlayDialogView* g_instance = NULL; 26 KeyboardOverlayDialogView* g_instance = NULL;
23 } 27 }
24 28
25 KeyboardOverlayDialogView::KeyboardOverlayDialogView( 29 KeyboardOverlayDialogView::KeyboardOverlayDialogView(
26 Profile* profile, 30 Profile* profile,
27 WebDialogDelegate* delegate) 31 WebDialogDelegate* delegate)
28 : WebDialogView(profile, NULL, delegate) { 32 : WebDialogView(profile, NULL, delegate) {
29 } 33 }
30 34
31 KeyboardOverlayDialogView::~KeyboardOverlayDialogView() { 35 KeyboardOverlayDialogView::~KeyboardOverlayDialogView() {
32 } 36 }
33 37
34 void KeyboardOverlayDialogView::ShowDialog() { 38 void KeyboardOverlayDialogView::ShowDialog() {
35 // Ignore the call if another view is already shown. 39 // Ignore the call if another view is already shown.
36 if (g_instance) 40 if (g_instance)
37 return; 41 return;
38 42
43 #if defined(OS_CHROMEOS)
sky 2012/06/12 04:23:24 Add a comment here and in WindowClosing as to why
Yusuke Sato 2012/06/12 05:12:03 Done.
44 chromeos::input_method::InputMethodManager::GetInstance()->DisableHotkeys();
45 #endif
39 KeyboardOverlayDelegate* delegate = new KeyboardOverlayDelegate( 46 KeyboardOverlayDelegate* delegate = new KeyboardOverlayDelegate(
40 l10n_util::GetStringUTF16(IDS_KEYBOARD_OVERLAY_TITLE)); 47 l10n_util::GetStringUTF16(IDS_KEYBOARD_OVERLAY_TITLE));
41 KeyboardOverlayDialogView* view = new KeyboardOverlayDialogView( 48 KeyboardOverlayDialogView* view = new KeyboardOverlayDialogView(
42 ProfileManager::GetDefaultProfileOrOffTheRecord(), delegate); 49 ProfileManager::GetDefaultProfileOrOffTheRecord(), delegate);
43 delegate->set_view(view); 50 delegate->set_view(view);
44 51
45 views::Widget* widget = new views::Widget; 52 views::Widget* widget = new views::Widget;
46 views::Widget::InitParams params( 53 views::Widget::InitParams params(
47 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); 54 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS);
48 params.delegate = view; 55 params.delegate = view;
49 widget->Init(params); 56 widget->Init(params);
50 57
51 // Show the widget at the bottom of the work area. 58 // Show the widget at the bottom of the work area.
52 gfx::Size size; 59 gfx::Size size;
53 delegate->GetDialogSize(&size); 60 delegate->GetDialogSize(&size);
54 gfx::Rect rect = gfx::Screen::GetMonitorNearestWindow( 61 gfx::Rect rect = gfx::Screen::GetMonitorNearestWindow(
55 view->GetWidget()->GetNativeView()).work_area(); 62 view->GetWidget()->GetNativeView()).work_area();
56 gfx::Rect bounds((rect.width() - size.width()) / 2, 63 gfx::Rect bounds((rect.width() - size.width()) / 2,
57 rect.height() - size.height(), 64 rect.height() - size.height(),
58 size.width(), 65 size.width(),
59 size.height()); 66 size.height());
60 view->GetWidget()->SetBounds(bounds); 67 view->GetWidget()->SetBounds(bounds);
61 view->GetWidget()->Show(); 68 view->GetWidget()->Show();
62 69
63 g_instance = view; 70 g_instance = view;
64 } 71 }
65 72
66 void KeyboardOverlayDialogView::WindowClosing() { 73 void KeyboardOverlayDialogView::WindowClosing() {
74 #if defined(OS_CHROMEOS)
75 chromeos::input_method::InputMethodManager::GetInstance()->EnableHotkeys();
76 #endif
67 g_instance = NULL; 77 g_instance = NULL;
68 } 78 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698