| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_UI_IME_IME_WINDOW_H_ | 5 #ifndef CHROME_BROWSER_UI_IME_IME_WINDOW_H_ |
| 6 #define CHROME_BROWSER_UI_IME_IME_WINDOW_H_ | 6 #define CHROME_BROWSER_UI_IME_IME_WINDOW_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
| 12 #include "content/public/browser/notification_observer.h" | 12 #include "content/public/browser/notification_observer.h" |
| 13 #include "content/public/browser/notification_registrar.h" | 13 #include "content/public/browser/notification_registrar.h" |
| 14 #include "content/public/browser/web_contents_delegate.h" | 14 #include "content/public/browser/web_contents_delegate.h" |
| 15 #include "content/public/browser/web_contents_observer.h" | 15 #include "content/public/browser/web_contents_observer.h" |
| 16 #include "extensions/browser/extension_icon_image.h" | 16 #include "extensions/browser/extension_icon_image.h" |
| 17 #include "ui/gfx/geometry/rect.h" | 17 #include "ui/gfx/geometry/rect.h" |
| 18 #include "ui/gfx/image/image.h" | 18 #include "ui/gfx/image/image.h" |
| 19 #include "ui/views/widget/widget_delegate.h" | 19 #include "ui/views/widget/widget_delegate.h" |
| 20 #include "ui/views/widget/widget_observer.h" | 20 #include "ui/views/widget/widget_observer.h" |
| 21 | 21 |
| 22 class GURL; | 22 class GURL; |
| 23 class Profile; | 23 class Profile; |
| 24 | 24 |
| 25 namespace content { | 25 namespace content { |
| 26 class RenderFrameHost; |
| 26 class WebContents; | 27 class WebContents; |
| 27 } | 28 } |
| 28 | 29 |
| 29 namespace extensions { | 30 namespace extensions { |
| 30 class Extension; | 31 class Extension; |
| 31 } | 32 } |
| 32 | 33 |
| 33 namespace gfx { | 34 namespace gfx { |
| 34 class Image; | 35 class Image; |
| 35 class Rect; | 36 class Rect; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 51 // the instance. And Close() is async. | 52 // the instance. And Close() is async. |
| 52 class ImeWindow : public content::NotificationObserver, | 53 class ImeWindow : public content::NotificationObserver, |
| 53 public extensions::IconImage::Observer, | 54 public extensions::IconImage::Observer, |
| 54 public content::WebContentsDelegate { | 55 public content::WebContentsDelegate { |
| 55 public: | 56 public: |
| 56 enum Mode { NORMAL, FOLLOW_CURSOR }; | 57 enum Mode { NORMAL, FOLLOW_CURSOR }; |
| 57 | 58 |
| 58 // Takes |url| as string instead of GURL because resolving GURL requires | 59 // Takes |url| as string instead of GURL because resolving GURL requires |
| 59 // |extension|. As the client code already passes in |extension|, it'd be | 60 // |extension|. As the client code already passes in |extension|, it'd be |
| 60 // better to simply the client code. | 61 // better to simply the client code. |
| 62 // |opener_render_frame_host| is the RenderFrameHost from where the IME window |
| 63 // is opened so that the security origin can be correctly set. |
| 61 ImeWindow(Profile* profile, | 64 ImeWindow(Profile* profile, |
| 62 const extensions::Extension* extension, | 65 const extensions::Extension* extension, |
| 66 content::RenderFrameHost* opener_render_frame_host, |
| 63 const std::string& url, | 67 const std::string& url, |
| 64 Mode mode, | 68 Mode mode, |
| 65 const gfx::Rect& bounds); | 69 const gfx::Rect& bounds); |
| 66 | 70 |
| 67 // Methods delegate to ImeNativeWindow. | 71 // Methods delegate to ImeNativeWindow. |
| 68 void Show(); | 72 void Show(); |
| 69 void Hide(); | 73 void Hide(); |
| 70 void Close(); | 74 void Close(); |
| 71 void SetBounds(const gfx::Rect& bounds); | 75 void SetBounds(const gfx::Rect& bounds); |
| 72 // Aligns the follow-cursor window to the given cursor bounds. | 76 // Aligns the follow-cursor window to the given cursor bounds. |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 ImeNativeWindow* native_window_; // Weak, it does self-destruction. | 140 ImeNativeWindow* native_window_; // Weak, it does self-destruction. |
| 137 | 141 |
| 138 base::ObserverList<ImeWindowObserver> observers_; | 142 base::ObserverList<ImeWindowObserver> observers_; |
| 139 | 143 |
| 140 DISALLOW_COPY_AND_ASSIGN(ImeWindow); | 144 DISALLOW_COPY_AND_ASSIGN(ImeWindow); |
| 141 }; | 145 }; |
| 142 | 146 |
| 143 } // namespace ui | 147 } // namespace ui |
| 144 | 148 |
| 145 #endif // CHROME_BROWSER_UI_IME_IME_WINDOW_H_ | 149 #endif // CHROME_BROWSER_UI_IME_IME_WINDOW_H_ |
| OLD | NEW |