Commit b36e6617 authored by rch@chromium.org's avatar rch@chromium.org

Revert 148383 - Move the keyboard overlay view to ash.

This change introduces an issue when Shift+Alt  is pressed (http://code.google.com/p/chromium/issues/detail?id=131159).
I'll fix it shortly together with the more general issue (http://code.google.com/p/chromium/issues/detail?id=129834).

BUG=124222
TEST=None

Review URL: https://chromiumcodereview.appspot.com/10829003

TBR=mazda@chromium.org
Review URL: https://chromiumcodereview.appspot.com/10823017

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@148385 0039d316-1c4b-4281-b951-d872f2087c98
parent 4d230e3b
include_rules = [ include_rules = [
"+chromeos", "+chromeos",
"+content/public",
"+grit/ash_strings.h", "+grit/ash_strings.h",
"+grit/ui_resources.h", "+grit/ui_resources.h",
"+grit/ui_strings.h", "+grit/ui_strings.h",
......
...@@ -110,10 +110,6 @@ ...@@ -110,10 +110,6 @@
'display/screen_position_controller.h', 'display/screen_position_controller.h',
'display/secondary_display_view.cc', 'display/secondary_display_view.cc',
'display/secondary_display_view.h', 'display/secondary_display_view.h',
'keyboard_overlay/keyboard_overlay_delegate.cc',
'keyboard_overlay/keyboard_overlay_delegate.h',
'keyboard_overlay/keyboard_overlay_view.cc',
'keyboard_overlay/keyboard_overlay_view.h',
'root_window_controller.cc', 'root_window_controller.cc',
'root_window_controller.h', 'root_window_controller.h',
'rotator/screen_rotation.cc', 'rotator/screen_rotation.cc',
......
...@@ -200,10 +200,6 @@ This file contains the strings for ash. ...@@ -200,10 +200,6 @@ This file contains the strings for ash.
Pull down to minimize, left or right to tile Pull down to minimize, left or right to tile
</message> </message>
<message name="IDS_ASH_KEYBOARD_OVERLAY_TITLE" desc="The title of the keyboard overlay.">
Keyboard Overlay
</message>
<!-- Status tray items --> <!-- Status tray items -->
<message name="IDS_ASH_STATUS_TRAY_ACCESSIBLE_NAME" desc="The accessible name of the status tray."> <message name="IDS_ASH_STATUS_TRAY_ACCESSIBLE_NAME" desc="The accessible name of the status tray.">
Status tray Status tray
......
...@@ -34,7 +34,6 @@ ...@@ -34,7 +34,6 @@
#include "ui/aura/window.h" #include "ui/aura/window.h"
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
#include "ash/keyboard_overlay/keyboard_overlay_view.h"
#include "base/chromeos/chromeos_version.h" #include "base/chromeos/chromeos_version.h"
#include "chrome/browser/chromeos/accessibility/accessibility_util.h" #include "chrome/browser/chromeos/accessibility/accessibility_util.h"
#include "chrome/browser/chromeos/background/ash_user_wallpaper_delegate.h" #include "chrome/browser/chromeos/background/ash_user_wallpaper_delegate.h"
...@@ -43,6 +42,7 @@ ...@@ -43,6 +42,7 @@
#include "chrome/browser/chromeos/login/user_manager.h" #include "chrome/browser/chromeos/login/user_manager.h"
#include "chrome/browser/chromeos/login/webui_login_display_host.h" #include "chrome/browser/chromeos/login/webui_login_display_host.h"
#include "chrome/browser/chromeos/system/ash_system_tray_delegate.h" #include "chrome/browser/chromeos/system/ash_system_tray_delegate.h"
#include "chrome/browser/ui/views/keyboard_overlay_dialog_view.h"
#include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h"
#include "chrome/browser/ui/webui/chromeos/mobile_setup_dialog.h" #include "chrome/browser/ui/webui/chromeos/mobile_setup_dialog.h"
#include "chromeos/dbus/dbus_thread_manager.h" #include "chromeos/dbus/dbus_thread_manager.h"
...@@ -262,12 +262,8 @@ bool ChromeShellDelegate::RotatePaneFocus(ash::Shell::Direction direction) { ...@@ -262,12 +262,8 @@ bool ChromeShellDelegate::RotatePaneFocus(ash::Shell::Direction direction) {
void ChromeShellDelegate::ShowKeyboardOverlay() { void ChromeShellDelegate::ShowKeyboardOverlay() {
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
// TODO(mazda): Move the show logic to ash (http://crbug.com/124222).
Profile* profile = ProfileManager::GetDefaultProfileOrOffTheRecord(); Profile* profile = ProfileManager::GetDefaultProfileOrOffTheRecord();
std::string url(chrome::kChromeUIKeyboardOverlayURL); KeyboardOverlayDialogView::ShowDialog(profile, new ChromeWebContentsHandler);
KeyboardOverlayView::ShowDialog(profile,
new ChromeWebContentsHandler,
GURL(url));
#endif #endif
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "ash/keyboard_overlay/keyboard_overlay_delegate.h" #include "chrome/browser/ui/views/keyboard_overlay_delegate.h"
#include <algorithm> #include <algorithm>
...@@ -10,8 +10,11 @@ ...@@ -10,8 +10,11 @@
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "base/utf_string_conversions.h" #include "base/utf_string_conversions.h"
#include "base/values.h" #include "base/values.h"
#include "chrome/common/url_constants.h"
#include "content/public/browser/web_ui.h" #include "content/public/browser/web_ui.h"
#include "content/public/browser/web_ui_message_handler.h" #include "content/public/browser/web_ui_message_handler.h"
#include "googleurl/src/gurl.h"
#include "grit/generated_resources.h"
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
#include "ui/gfx/screen.h" #include "ui/gfx/screen.h"
#include "ui/views/controls/webview/web_dialog_view.h" #include "ui/views/controls/webview/web_dialog_view.h"
...@@ -58,10 +61,8 @@ void PaintMessageHandler::DidPaint(const ListValue* args) { ...@@ -58,10 +61,8 @@ void PaintMessageHandler::DidPaint(const ListValue* args) {
} // namespace } // namespace
KeyboardOverlayDelegate::KeyboardOverlayDelegate(const string16& title, KeyboardOverlayDelegate::KeyboardOverlayDelegate(const string16& title)
const GURL& url)
: title_(title), : title_(title),
url_(url),
view_(NULL) { view_(NULL) {
} }
...@@ -100,7 +101,8 @@ string16 KeyboardOverlayDelegate::GetDialogTitle() const { ...@@ -100,7 +101,8 @@ string16 KeyboardOverlayDelegate::GetDialogTitle() const {
} }
GURL KeyboardOverlayDelegate::GetDialogContentURL() const { GURL KeyboardOverlayDelegate::GetDialogContentURL() const {
return url_; std::string url_string(chrome::kChromeUIKeyboardOverlayURL);
return GURL(url_string);
} }
void KeyboardOverlayDelegate::GetWebUIMessageHandlers( void KeyboardOverlayDelegate::GetWebUIMessageHandlers(
......
...@@ -2,12 +2,11 @@ ...@@ -2,12 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef ASH_KEYBOARD_OVERLAY_KEYBOARD_OVERLAY_DELEGATE_H_ #ifndef CHROME_BROWSER_UI_VIEWS_KEYBOARD_OVERLAY_DELEGATE_H_
#define ASH_KEYBOARD_OVERLAY_KEYBOARD_OVERLAY_DELEGATE_H_ #define CHROME_BROWSER_UI_VIEWS_KEYBOARD_OVERLAY_DELEGATE_H_
#include "base/basictypes.h" #include "base/basictypes.h"
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
#include "googleurl/src/gurl.h"
#include "ui/web_dialogs/web_dialog_delegate.h" #include "ui/web_dialogs/web_dialog_delegate.h"
namespace views { namespace views {
...@@ -16,7 +15,7 @@ class WebDialogView; ...@@ -16,7 +15,7 @@ class WebDialogView;
class KeyboardOverlayDelegate : public ui::WebDialogDelegate { class KeyboardOverlayDelegate : public ui::WebDialogDelegate {
public: public:
KeyboardOverlayDelegate(const string16& title, const GURL& url); explicit KeyboardOverlayDelegate(const string16& title);
void Show(views::WebDialogView* view); void Show(views::WebDialogView* view);
...@@ -43,9 +42,6 @@ class KeyboardOverlayDelegate : public ui::WebDialogDelegate { ...@@ -43,9 +42,6 @@ class KeyboardOverlayDelegate : public ui::WebDialogDelegate {
// The dialog title. // The dialog title.
string16 title_; string16 title_;
// The URL of the keyboard overlay.
GURL url_;
// The view associated with this delegate. // The view associated with this delegate.
// This class does not own the pointer. // This class does not own the pointer.
views::WebDialogView* view_; views::WebDialogView* view_;
...@@ -53,4 +49,4 @@ class KeyboardOverlayDelegate : public ui::WebDialogDelegate { ...@@ -53,4 +49,4 @@ class KeyboardOverlayDelegate : public ui::WebDialogDelegate {
DISALLOW_COPY_AND_ASSIGN(KeyboardOverlayDelegate); DISALLOW_COPY_AND_ASSIGN(KeyboardOverlayDelegate);
}; };
#endif // ASH_KEYBOARD_OVERLAY_KEYBOARD_OVERLAY_DELEGATE_H_ #endif // CHROME_BROWSER_UI_VIEWS_KEYBOARD_OVERLAY_DELEGATE_H_
...@@ -2,51 +2,64 @@ ...@@ -2,51 +2,64 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "ash/keyboard_overlay/keyboard_overlay_view.h" #include "chrome/browser/ui/views/keyboard_overlay_dialog_view.h"
#include "ash/keyboard_overlay/keyboard_overlay_delegate.h"
#include "base/utf_string_conversions.h" #include "base/utf_string_conversions.h"
#include "chrome/browser/ui/views/keyboard_overlay_delegate.h"
#include "content/public/browser/browser_context.h" #include "content/public/browser/browser_context.h"
#include "grit/ash_strings.h" #include "grit/generated_resources.h"
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
#include "ui/gfx/screen.h" #include "ui/gfx/screen.h"
#include "ui/views/widget/widget.h" #include "ui/views/widget/widget.h"
#include "ui/web_dialogs/web_dialog_delegate.h" #include "ui/web_dialogs/web_dialog_delegate.h"
#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/input_method/input_method_manager.h"
#endif
using ui::WebDialogDelegate; using ui::WebDialogDelegate;
namespace { namespace {
// Store the pointer to the view currently shown. // Store the pointer to the view currently shown.
KeyboardOverlayView* g_instance = NULL; KeyboardOverlayDialogView* g_instance = NULL;
} }
KeyboardOverlayView::KeyboardOverlayView( KeyboardOverlayDialogView::KeyboardOverlayDialogView(
content::BrowserContext* context, content::BrowserContext* context,
WebDialogDelegate* delegate, WebDialogDelegate* delegate,
WebContentsHandler* handler) WebContentsHandler* handler)
: views::WebDialogView(context, delegate, handler) { : views::WebDialogView(context, delegate, handler) {
} }
KeyboardOverlayView::~KeyboardOverlayView() { KeyboardOverlayDialogView::~KeyboardOverlayDialogView() {
} }
void KeyboardOverlayView::ShowDialog( void KeyboardOverlayDialogView::ShowDialog(
content::BrowserContext* context, content::BrowserContext* context,
WebContentsHandler* handler, WebContentsHandler* handler) {
const GURL& url) {
// Ignore the call if another view is already shown. // Ignore the call if another view is already shown.
if (g_instance) if (g_instance)
return; return;
#if defined(OS_CHROMEOS)
// Temporarily disable all accelerators for IME switching including Shift+Alt
// since the user might press Shift+Alt to remember an accelerator that starts
// with Shift+Alt (e.g. Shift+Alt+Tab for moving focus backwards).
chromeos::input_method::InputMethodManager::GetInstance()->DisableHotkeys();
#endif
KeyboardOverlayDelegate* delegate = new KeyboardOverlayDelegate( KeyboardOverlayDelegate* delegate = new KeyboardOverlayDelegate(
l10n_util::GetStringUTF16(IDS_ASH_KEYBOARD_OVERLAY_TITLE), url); l10n_util::GetStringUTF16(IDS_KEYBOARD_OVERLAY_TITLE));
KeyboardOverlayView* view = KeyboardOverlayDialogView* view =
new KeyboardOverlayView(context, delegate, handler); new KeyboardOverlayDialogView(context, delegate, handler);
delegate->Show(view); delegate->Show(view);
g_instance = view; g_instance = view;
} }
void KeyboardOverlayView::WindowClosing() { void KeyboardOverlayDialogView::WindowClosing() {
#if defined(OS_CHROMEOS)
// Re-enable the IME accelerators. See the comment in ShowDialog() above.
chromeos::input_method::InputMethodManager::GetInstance()->EnableHotkeys();
#endif
g_instance = NULL; g_instance = NULL;
} }
...@@ -2,15 +2,12 @@ ...@@ -2,15 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef ASH_KEYBOARD_OVERLAY_KEYBOARD_OVERLAY_VIEW_H_ #ifndef CHROME_BROWSER_UI_VIEWS_KEYBOARD_OVERLAY_DIALOG_VIEW_H_
#define ASH_KEYBOARD_OVERLAY_KEYBOARD_OVERLAY_VIEW_H_ #define CHROME_BROWSER_UI_VIEWS_KEYBOARD_OVERLAY_DIALOG_VIEW_H_
#include "ash/ash_export.h"
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
#include "ui/views/controls/webview/web_dialog_view.h" #include "ui/views/controls/webview/web_dialog_view.h"
class GURL;
namespace content { namespace content {
class BrowserContext; class BrowserContext;
} }
...@@ -20,23 +17,22 @@ class WebDialogDelegate; ...@@ -20,23 +17,22 @@ class WebDialogDelegate;
} }
// A customized dialog view for the keyboard overlay. // A customized dialog view for the keyboard overlay.
class ASH_EXPORT KeyboardOverlayView : public views::WebDialogView { class KeyboardOverlayDialogView : public views::WebDialogView {
public: public:
KeyboardOverlayView(content::BrowserContext* context, KeyboardOverlayDialogView(content::BrowserContext* context,
ui::WebDialogDelegate* delegate, ui::WebDialogDelegate* delegate,
WebContentsHandler* handler); WebContentsHandler* handler);
virtual ~KeyboardOverlayView(); virtual ~KeyboardOverlayDialogView();
// Shows the keyboard overlay. // Shows the keyboard overlay.
static void ShowDialog(content::BrowserContext* context, static void ShowDialog(content::BrowserContext* context,
WebContentsHandler* handler, WebContentsHandler* handler);
const GURL& url);
private: private:
// Overridden from views::WidgetDelegate: // Overridden from views::WidgetDelegate:
virtual void WindowClosing() OVERRIDE; virtual void WindowClosing() OVERRIDE;
DISALLOW_COPY_AND_ASSIGN(KeyboardOverlayView); DISALLOW_COPY_AND_ASSIGN(KeyboardOverlayDialogView);
}; };
#endif // ASH_KEYBOARD_OVERLAY_KEYBOARD_OVERLAY_VIEW_H_ #endif // CHROME_BROWSER_UI_VIEWS_KEYBOARD_OVERLAY_DIALOG_VIEW_H_
...@@ -3712,6 +3712,10 @@ ...@@ -3712,6 +3712,10 @@
'browser/ui/views/infobars/translate_message_infobar.h', 'browser/ui/views/infobars/translate_message_infobar.h',
'browser/ui/views/javascript_app_modal_dialog_views.cc', 'browser/ui/views/javascript_app_modal_dialog_views.cc',
'browser/ui/views/javascript_app_modal_dialog_views.h', 'browser/ui/views/javascript_app_modal_dialog_views.h',
'browser/ui/views/keyboard_overlay_delegate.cc',
'browser/ui/views/keyboard_overlay_delegate.h',
'browser/ui/views/keyboard_overlay_dialog_view.cc',
'browser/ui/views/keyboard_overlay_dialog_view.h',
'browser/ui/views/location_bar/action_box_button_view.cc', 'browser/ui/views/location_bar/action_box_button_view.cc',
'browser/ui/views/location_bar/action_box_button_view.h', 'browser/ui/views/location_bar/action_box_button_view.h',
'browser/ui/views/location_bar/chrome_to_mobile_view.cc', 'browser/ui/views/location_bar/chrome_to_mobile_view.cc',
...@@ -5163,6 +5167,8 @@ ...@@ -5163,6 +5167,8 @@
'browser/ui/crypto_module_password_dialog.cc', 'browser/ui/crypto_module_password_dialog.cc',
'browser/ui/crypto_module_password_dialog_nss.cc', 'browser/ui/crypto_module_password_dialog_nss.cc',
'browser/ui/startup/autolaunch_prompt.cc', 'browser/ui/startup/autolaunch_prompt.cc',
'browser/ui/views/keyboard_overlay_delegate.cc',
'browser/ui/views/keyboard_overlay_dialog_view.cc',
'browser/ui/views/simple_message_box_views.cc', 'browser/ui/views/simple_message_box_views.cc',
'browser/ui/webui/help/version_updater_basic.cc', 'browser/ui/webui/help/version_updater_basic.cc',
'browser/ui/webui/help/version_updater_basic.h', 'browser/ui/webui/help/version_updater_basic.h',
...@@ -5239,6 +5245,10 @@ ...@@ -5239,6 +5245,10 @@
'sources/': [ 'sources/': [
['exclude', '^browser/chromeos/extensions/file_browser_handler_api'], ['exclude', '^browser/chromeos/extensions/file_browser_handler_api'],
['exclude', '^browser/chromeos/extensions/file_browser_private_api'], ['exclude', '^browser/chromeos/extensions/file_browser_private_api'],
['exclude', '^browser/ui/views/keyboard_overlay_delegate.cc'],
['exclude', '^browser/ui/views/keyboard_overlay_delegate.h'],
['exclude', '^browser/ui/views/keyboard_overlay_dialog_view.cc'],
['exclude', '^browser/ui/views/keyboard_overlay_dialog_view.h'],
], ],
}], }],
# GTK build only # GTK build only
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment