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

Unified Diff: ash/wm/keyboard_overlay_view.cc

Issue 10829003: 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
Index: ash/wm/keyboard_overlay_view.cc
diff --git a/ash/wm/keyboard_overlay_view.cc b/ash/wm/keyboard_overlay_view.cc
new file mode 100644
index 0000000000000000000000000000000000000000..9c0a133a941ce908733cd64725321398f0eb252b
--- /dev/null
+++ b/ash/wm/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/wm/keyboard_overlay_view.h"
+
+#include "ash/wm/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;
+}

Powered by Google App Engine
This is Rietveld 408576698