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

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

Issue 10824023: Revert "Revert 148383 - Move the keyboard overlay view to ash." (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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 | « chrome/browser/ui/views/keyboard_overlay_dialog_view.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/ui/views/keyboard_overlay_dialog_view.h"
6
7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/ui/views/keyboard_overlay_delegate.h"
9 #include "content/public/browser/browser_context.h"
10 #include "grit/generated_resources.h"
11 #include "ui/base/l10n/l10n_util.h"
12 #include "ui/gfx/screen.h"
13 #include "ui/views/widget/widget.h"
14 #include "ui/web_dialogs/web_dialog_delegate.h"
15
16 #if defined(OS_CHROMEOS)
17 #include "chrome/browser/chromeos/input_method/input_method_manager.h"
18 #endif
19
20 using ui::WebDialogDelegate;
21
22 namespace {
23 // Store the pointer to the view currently shown.
24 KeyboardOverlayDialogView* g_instance = NULL;
25 }
26
27 KeyboardOverlayDialogView::KeyboardOverlayDialogView(
28 content::BrowserContext* context,
29 WebDialogDelegate* delegate,
30 WebContentsHandler* handler)
31 : views::WebDialogView(context, delegate, handler) {
32 }
33
34 KeyboardOverlayDialogView::~KeyboardOverlayDialogView() {
35 }
36
37 void KeyboardOverlayDialogView::ShowDialog(
38 content::BrowserContext* context,
39 WebContentsHandler* handler) {
40 // Ignore the call if another view is already shown.
41 if (g_instance)
42 return;
43
44 #if defined(OS_CHROMEOS)
45 // Temporarily disable all accelerators for IME switching including Shift+Alt
46 // since the user might press Shift+Alt to remember an accelerator that starts
47 // with Shift+Alt (e.g. Shift+Alt+Tab for moving focus backwards).
48 chromeos::input_method::InputMethodManager::GetInstance()->DisableHotkeys();
49 #endif
50 KeyboardOverlayDelegate* delegate = new KeyboardOverlayDelegate(
51 l10n_util::GetStringUTF16(IDS_KEYBOARD_OVERLAY_TITLE));
52 KeyboardOverlayDialogView* view =
53 new KeyboardOverlayDialogView(context, delegate, handler);
54 delegate->Show(view);
55
56 g_instance = view;
57 }
58
59 void KeyboardOverlayDialogView::WindowClosing() {
60 #if defined(OS_CHROMEOS)
61 // Re-enable the IME accelerators. See the comment in ShowDialog() above.
62 chromeos::input_method::InputMethodManager::GetInstance()->EnableHotkeys();
63 #endif
64 g_instance = NULL;
65 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/keyboard_overlay_dialog_view.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698