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

Unified Diff: ui/keyboard/keyboard_ui.h

Issue 1392713002: Extract content dependency from keyboard code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 2 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: ui/keyboard/keyboard_ui.h
diff --git a/ui/keyboard/keyboard_controller_proxy.h b/ui/keyboard/keyboard_ui.h
similarity index 51%
rename from ui/keyboard/keyboard_controller_proxy.h
rename to ui/keyboard/keyboard_ui.h
index 98051fa248c74b8703ae3c1b53c15e94e48563c7..69cf8201bd99d701d79f65ba68644f860e747ce8 100644
--- a/ui/keyboard/keyboard_controller_proxy.h
+++ b/ui/keyboard/keyboard_ui.h
@@ -1,58 +1,35 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Copyright 2015 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.
-#ifndef UI_KEYBOARD_KEYBOARD_CONTROLLER_PROXY_H_
-#define UI_KEYBOARD_KEYBOARD_CONTROLLER_PROXY_H_
+#ifndef UI_KEYBOARD_KEYBOARD_UI_H_
+#define UI_KEYBOARD_KEYBOARD_UI_H_
-#include "base/memory/scoped_ptr.h"
-#include "content/public/common/media_stream_request.h"
-#include "ui/aura/window_observer.h"
+#include <vector>
sky 2015/10/09 18:23:29 nit: you shouldn't need this include.
+
+#include "base/macros.h"
#include "ui/base/ime/text_input_type.h"
#include "ui/keyboard/keyboard_export.h"
namespace aura {
class Window;
}
-namespace content {
-class BrowserContext;
-class SiteInstance;
-class WebContents;
-}
namespace gfx {
class Rect;
}
namespace ui {
class InputMethod;
}
-namespace wm {
-class Shadow;
-}
namespace keyboard {
class KeyboardController;
-// A proxy used by the KeyboardController to get access to the virtual
-// keyboard window.
-class KEYBOARD_EXPORT KeyboardControllerProxy : public aura::WindowObserver {
+// An interface implemented by an object that implements a keyboard UI.
+class KEYBOARD_EXPORT KeyboardUI {
public:
- class TestApi {
- public:
- explicit TestApi(KeyboardControllerProxy* proxy) : proxy_(proxy) {}
-
- const content::WebContents* keyboard_contents() {
- return proxy_->keyboard_contents_.get();
- }
-
- private:
- KeyboardControllerProxy* proxy_;
-
- DISALLOW_COPY_AND_ASSIGN(TestApi);
- };
-
- explicit KeyboardControllerProxy(content::BrowserContext* context);
- ~KeyboardControllerProxy() override;
+ KeyboardUI();
+ virtual ~KeyboardUI();
// Gets the virtual keyboard window. Ownership of the returned Window remains
// with the proxy.
sky 2015/10/09 18:23:30 proxy->'ui' or maybe 'this class'.
@@ -66,11 +43,6 @@ class KEYBOARD_EXPORT KeyboardControllerProxy : public aura::WindowObserver {
// text input context.
virtual ui::InputMethod* GetInputMethod() = 0;
- // Requests the audio input from microphone for speech input.
- virtual void RequestAudioInput(content::WebContents* web_contents,
- const content::MediaStreamRequest& request,
- const content::MediaResponseCallback& callback) = 0;
-
// Shows the container window of the keyboard. The default implementation
// simply shows the container. An overridden implementation can set up
// necessary animation, or delay the visibility change as it desires.
@@ -88,9 +60,10 @@ class KEYBOARD_EXPORT KeyboardControllerProxy : public aura::WindowObserver {
// window).
virtual void EnsureCaretInWorkArea();
- // Loads system virtual keyboard. Noop if the current virtual keyboard is
- // system virtual keyboard.
- virtual void LoadSystemKeyboard();
+ // KeyboardController owns KeyboardControllerProxy so KeyboardControllerProxy
sky 2015/10/09 18:23:30 KeyboardControllerProxy->KeyboardUI.
+ // or its subclasses should not take ownership of the |controller|.
+ // |controller| can be null when KeyboardController is destroying.
+ virtual void SetController(KeyboardController* controller);
// Reloads virtual keyboard URL if the current keyboard's web content URL is
// different. The URL can be different if user switch from password field to
@@ -103,49 +76,22 @@ class KEYBOARD_EXPORT KeyboardControllerProxy : public aura::WindowObserver {
// provide one.
virtual void ReloadKeyboardIfNeeded();
- // KeyboardController owns KeyboardControllerProxy so KeyboardControllerProxy
- // or its subclasses should not take ownership of the |controller|.
- // |controller| can be null when KeyboardController is destroying.
- virtual void SetController(KeyboardController* controller);
+ // When the embedder changes the keyboard bounds, asks the keyboard to adjust
+ // insets for windows affected by this.
+ virtual void InitInsets(const gfx::Rect& keyboard_bounds);
+
+ // Resets insets for affected windows.
+ virtual void ResetInsets();
protected:
- // The implementation can choose to setup the WebContents before the virtual
- // keyboard page is loaded (e.g. install a WebContentsObserver).
- // SetupWebContents() is called right after creating the WebContents, before
- // loading the keyboard page.
- virtual void SetupWebContents(content::WebContents* contents);
-
- // aura::WindowObserver overrides:
- void OnWindowBoundsChanged(aura::Window* window,
- const gfx::Rect& old_bounds,
- const gfx::Rect& new_bounds) override;
- void OnWindowDestroyed(aura::Window* window) override;
-
- content::BrowserContext* browser_context() { return browser_context_; }
KeyboardController* keyboard_controller() { return keyboard_controller_; }
private:
- friend class TestApi;
-
- // Loads the web contents for the given |url|.
- void LoadContents(const GURL& url);
-
- // Gets the virtual keyboard URL (either the default URL or IME override URL).
- const GURL& GetVirtualKeyboardUrl();
-
- // The BrowserContext to use for creating the WebContents hosting the
- // keyboard.
- content::BrowserContext* browser_context_;
-
- const GURL default_url_;
keyboard::KeyboardController* keyboard_controller_;
- scoped_ptr<content::WebContents> keyboard_contents_;
- scoped_ptr<wm::Shadow> shadow_;
-
- DISALLOW_COPY_AND_ASSIGN(KeyboardControllerProxy);
+ DISALLOW_COPY_AND_ASSIGN(KeyboardUI);
};
} // namespace keyboard
-#endif // UI_KEYBOARD_KEYBOARD_CONTROLLER_PROXY_H_
+#endif // UI_KEYBOARD_KEYBOARD_UI_H_

Powered by Google App Engine
This is Rietveld 408576698