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