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 #include "ui/keyboard/webui/vk_webui_controller.h" | 5 #include "ui/keyboard/webui/vk_webui_controller.h" |
6 | 6 |
7 #include "base/strings/string_util.h" | 7 #include "base/strings/string_util.h" |
8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 #include "content/public/browser/render_frame_host.h" | 9 #include "content/public/browser/render_frame_host.h" |
10 #include "content/public/browser/render_view_host.h" | 10 #include "content/public/browser/render_view_host.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 } | 61 } |
62 | 62 |
63 void VKWebUIController::RenderViewCreated(content::RenderViewHost* host) { | 63 void VKWebUIController::RenderViewCreated(content::RenderViewHost* host) { |
64 host->GetMainFrame()->GetServiceRegistry()->AddService<KeyboardUIHandlerMojo>( | 64 host->GetMainFrame()->GetServiceRegistry()->AddService<KeyboardUIHandlerMojo>( |
65 base::Bind(&VKWebUIController::CreateAndStoreUIHandler, | 65 base::Bind(&VKWebUIController::CreateAndStoreUIHandler, |
66 weak_factory_.GetWeakPtr())); | 66 weak_factory_.GetWeakPtr())); |
67 } | 67 } |
68 | 68 |
69 void VKWebUIController::CreateAndStoreUIHandler( | 69 void VKWebUIController::CreateAndStoreUIHandler( |
70 mojo::InterfaceRequest<KeyboardUIHandlerMojo> request) { | 70 mojo::InterfaceRequest<KeyboardUIHandlerMojo> request) { |
71 ui_handler_ = scoped_ptr<VKMojoHandler>( | 71 ui_handler_ = make_scoped_ptr(new VKMojoHandler(request.Pass())); |
72 mojo::WeakBindToRequest(new VKMojoHandler(), &request)); | |
73 } | 72 } |
74 | 73 |
75 //////////////////////////////////////////////////////////////////////////////// | 74 //////////////////////////////////////////////////////////////////////////////// |
76 // VKWebUIControllerFactory: | 75 // VKWebUIControllerFactory: |
77 | 76 |
78 content::WebUI::TypeID VKWebUIControllerFactory::GetWebUIType( | 77 content::WebUI::TypeID VKWebUIControllerFactory::GetWebUIType( |
79 content::BrowserContext* browser_context, | 78 content::BrowserContext* browser_context, |
80 const GURL& url) const { | 79 const GURL& url) const { |
81 if (url == GURL(kKeyboardURL)) | 80 if (url == GURL(kKeyboardURL)) |
82 return const_cast<VKWebUIControllerFactory*>(this); | 81 return const_cast<VKWebUIControllerFactory*>(this); |
(...skipping 27 matching lines...) Expand all Loading... |
110 } | 109 } |
111 | 110 |
112 // protected | 111 // protected |
113 VKWebUIControllerFactory::VKWebUIControllerFactory() { | 112 VKWebUIControllerFactory::VKWebUIControllerFactory() { |
114 } | 113 } |
115 | 114 |
116 VKWebUIControllerFactory::~VKWebUIControllerFactory() { | 115 VKWebUIControllerFactory::~VKWebUIControllerFactory() { |
117 } | 116 } |
118 | 117 |
119 } // namespace keyboard | 118 } // namespace keyboard |
OLD | NEW |