| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 ATHENA_VIRTUAL_KEYBOARD_VK_WEBUI_CONTROLLER_H_ | 5 #ifndef UI_KEYBOARD_WEBUI_VK_WEBUI_CONTROLLER_H_ |
| 6 #define ATHENA_VIRTUAL_KEYBOARD_VK_WEBUI_CONTROLLER_H_ | 6 #define UI_KEYBOARD_WEBUI_VK_WEBUI_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/singleton.h" | 9 #include "base/memory/singleton.h" |
| 10 #include "base/memory/weak_ptr.h" |
| 10 #include "content/public/browser/web_ui_controller.h" | 11 #include "content/public/browser/web_ui_controller.h" |
| 11 #include "content/public/browser/web_ui_controller_factory.h" | 12 #include "content/public/browser/web_ui_controller_factory.h" |
| 13 #include "mojo/public/cpp/bindings/interface_request.h" |
| 14 #include "mojo/public/cpp/system/core.h" |
| 15 #include "ui/keyboard/keyboard_export.h" |
| 16 #include "ui/keyboard/webui/keyboard.mojom.h" |
| 12 | 17 |
| 13 namespace athena { | 18 namespace content { |
| 19 class WebUIDataSource; |
| 20 } |
| 21 |
| 22 namespace keyboard { |
| 23 |
| 24 class VKMojoHandler; |
| 14 | 25 |
| 15 class VKWebUIController : public content::WebUIController { | 26 class VKWebUIController : public content::WebUIController { |
| 16 public: | 27 public: |
| 17 explicit VKWebUIController(content::WebUI* web_ui); | 28 explicit VKWebUIController(content::WebUI* web_ui); |
| 18 virtual ~VKWebUIController(); | 29 virtual ~VKWebUIController(); |
| 19 | 30 |
| 20 private: | 31 private: |
| 32 void CreateAndStoreUIHandler( |
| 33 mojo::InterfaceRequest<KeyboardUIHandlerMojo> request); |
| 34 |
| 35 // content::WebUIController: |
| 36 virtual void RenderViewCreated(content::RenderViewHost* host) OVERRIDE; |
| 37 |
| 38 scoped_ptr<VKMojoHandler> ui_handler_; |
| 39 base::WeakPtrFactory<VKWebUIController> weak_factory_; |
| 40 |
| 21 DISALLOW_COPY_AND_ASSIGN(VKWebUIController); | 41 DISALLOW_COPY_AND_ASSIGN(VKWebUIController); |
| 22 }; | 42 }; |
| 23 | 43 |
| 24 class VKWebUIControllerFactory : public content::WebUIControllerFactory { | 44 class KEYBOARD_EXPORT VKWebUIControllerFactory |
| 45 : public content::WebUIControllerFactory { |
| 25 public: | 46 public: |
| 26 // WebUIControllerFactory: | 47 // WebUIControllerFactory: |
| 27 virtual content::WebUI::TypeID GetWebUIType( | 48 virtual content::WebUI::TypeID GetWebUIType( |
| 28 content::BrowserContext* browser_context, | 49 content::BrowserContext* browser_context, |
| 29 const GURL& url) const OVERRIDE; | 50 const GURL& url) const OVERRIDE; |
| 30 virtual bool UseWebUIForURL(content::BrowserContext* browser_context, | 51 virtual bool UseWebUIForURL(content::BrowserContext* browser_context, |
| 31 const GURL& url) const OVERRIDE; | 52 const GURL& url) const OVERRIDE; |
| 32 virtual bool UseWebUIBindingsForURL(content::BrowserContext* browser_context, | 53 virtual bool UseWebUIBindingsForURL(content::BrowserContext* browser_context, |
| 33 const GURL& url) const OVERRIDE; | 54 const GURL& url) const OVERRIDE; |
| 34 virtual content::WebUIController* CreateWebUIControllerForURL( | 55 virtual content::WebUIController* CreateWebUIControllerForURL( |
| 35 content::WebUI* web_ui, | 56 content::WebUI* web_ui, |
| 36 const GURL& url) const OVERRIDE; | 57 const GURL& url) const OVERRIDE; |
| 37 | 58 |
| 38 static VKWebUIControllerFactory* GetInstance(); | 59 static VKWebUIControllerFactory* GetInstance(); |
| 39 | 60 |
| 40 protected: | 61 protected: |
| 41 VKWebUIControllerFactory(); | 62 VKWebUIControllerFactory(); |
| 42 virtual ~VKWebUIControllerFactory(); | 63 virtual ~VKWebUIControllerFactory(); |
| 43 | 64 |
| 44 private: | 65 private: |
| 45 friend struct DefaultSingletonTraits<VKWebUIControllerFactory>; | 66 friend struct DefaultSingletonTraits<VKWebUIControllerFactory>; |
| 46 | 67 |
| 47 DISALLOW_COPY_AND_ASSIGN(VKWebUIControllerFactory); | 68 DISALLOW_COPY_AND_ASSIGN(VKWebUIControllerFactory); |
| 48 }; | 69 }; |
| 49 | 70 |
| 50 } // namespace athena | 71 } // namespace keyboard |
| 51 | 72 |
| 52 #endif // ATHENA_VIRTUAL_KEYBOARD_VK_WEBUI_CONTROLLER_H_ | 73 #endif // UI_KEYBOARD_WEBUI_VK_WEBUI_CONTROLLER_H_ |
| OLD | NEW |