Roll src/third_party/skia 47326ab:17bfe0d
[chromium-blink-merge.git] / ui / keyboard / webui / vk_webui_controller.h
blobd701c6395e90d086ea0ab72d550e0416c9d2783a
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
3 // found in the LICENSE file.
5 #ifndef UI_KEYBOARD_WEBUI_VK_WEBUI_CONTROLLER_H_
6 #define UI_KEYBOARD_WEBUI_VK_WEBUI_CONTROLLER_H_
8 #include "base/macros.h"
9 #include "base/memory/singleton.h"
10 #include "base/memory/weak_ptr.h"
11 #include "content/public/browser/web_ui_controller.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"
18 namespace content {
19 class WebUIDataSource;
22 namespace keyboard {
24 class VKMojoHandler;
26 class VKWebUIController : public content::WebUIController {
27 public:
28 explicit VKWebUIController(content::WebUI* web_ui);
29 virtual ~VKWebUIController();
31 private:
32 void CreateAndStoreUIHandler(
33 mojo::InterfaceRequest<KeyboardUIHandlerMojo> request);
35 // content::WebUIController:
36 virtual void RenderViewCreated(content::RenderViewHost* host) OVERRIDE;
38 scoped_ptr<VKMojoHandler> ui_handler_;
39 base::WeakPtrFactory<VKWebUIController> weak_factory_;
41 DISALLOW_COPY_AND_ASSIGN(VKWebUIController);
44 class KEYBOARD_EXPORT VKWebUIControllerFactory
45 : public content::WebUIControllerFactory {
46 public:
47 // WebUIControllerFactory:
48 virtual content::WebUI::TypeID GetWebUIType(
49 content::BrowserContext* browser_context,
50 const GURL& url) const OVERRIDE;
51 virtual bool UseWebUIForURL(content::BrowserContext* browser_context,
52 const GURL& url) const OVERRIDE;
53 virtual bool UseWebUIBindingsForURL(content::BrowserContext* browser_context,
54 const GURL& url) const OVERRIDE;
55 virtual content::WebUIController* CreateWebUIControllerForURL(
56 content::WebUI* web_ui,
57 const GURL& url) const OVERRIDE;
59 static VKWebUIControllerFactory* GetInstance();
61 protected:
62 VKWebUIControllerFactory();
63 virtual ~VKWebUIControllerFactory();
65 private:
66 friend struct DefaultSingletonTraits<VKWebUIControllerFactory>;
68 DISALLOW_COPY_AND_ASSIGN(VKWebUIControllerFactory);
71 } // namespace keyboard
73 #endif // UI_KEYBOARD_WEBUI_VK_WEBUI_CONTROLLER_H_