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

Unified Diff: ash/keyboard_overlay/keyboard_overlay_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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/keyboard_overlay/keyboard_overlay_view.h ('k') | chrome/browser/ui/views/ash/chrome_shell_delegate.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/keyboard_overlay/keyboard_overlay_view.cc
diff --git a/ash/keyboard_overlay/keyboard_overlay_view.cc b/ash/keyboard_overlay/keyboard_overlay_view.cc
new file mode 100644
index 0000000000000000000000000000000000000000..d9a7b6cf615a9b9b1118fe2fbe073b2bdb9e452d
--- /dev/null
+++ b/ash/keyboard_overlay/keyboard_overlay_view.cc
@@ -0,0 +1,52 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ash/keyboard_overlay/keyboard_overlay_view.h"
+
+#include "ash/keyboard_overlay/keyboard_overlay_delegate.h"
+#include "base/utf_string_conversions.h"
+#include "content/public/browser/browser_context.h"
+#include "grit/ash_strings.h"
+#include "ui/base/l10n/l10n_util.h"
+#include "ui/gfx/screen.h"
+#include "ui/views/widget/widget.h"
+#include "ui/web_dialogs/web_dialog_delegate.h"
+
+using ui::WebDialogDelegate;
+
+namespace {
+// Store the pointer to the view currently shown.
+KeyboardOverlayView* g_instance = NULL;
+}
+
+KeyboardOverlayView::KeyboardOverlayView(
+ content::BrowserContext* context,
+ WebDialogDelegate* delegate,
+ WebContentsHandler* handler)
+ : views::WebDialogView(context, delegate, handler) {
+}
+
+KeyboardOverlayView::~KeyboardOverlayView() {
+}
+
+void KeyboardOverlayView::ShowDialog(
+ content::BrowserContext* context,
+ WebContentsHandler* handler,
+ const GURL& url) {
+ // Ignore the call if another view is already shown.
+ if (g_instance)
+ return;
+
+ KeyboardOverlayDelegate* delegate = new KeyboardOverlayDelegate(
+ l10n_util::GetStringUTF16(IDS_ASH_KEYBOARD_OVERLAY_TITLE), url);
+ KeyboardOverlayView* view =
+ new KeyboardOverlayView(context, delegate, handler);
+ delegate->Show(view);
+
+ g_instance = view;
+}
+
+void KeyboardOverlayView::WindowClosing() {
+ g_instance = NULL;
+}
« no previous file with comments | « ash/keyboard_overlay/keyboard_overlay_view.h ('k') | chrome/browser/ui/views/ash/chrome_shell_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698