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_ = make_scoped_ptr(new VKMojoHandler(request.Pass())); | 71 ui_handler_ = scoped_ptr<VKMojoHandler>( |
| 72 mojo::WeakBindToRequest(new VKMojoHandler(), &request)); |
72 } | 73 } |
73 | 74 |
74 //////////////////////////////////////////////////////////////////////////////// | 75 //////////////////////////////////////////////////////////////////////////////// |
75 // VKWebUIControllerFactory: | 76 // VKWebUIControllerFactory: |
76 | 77 |
77 content::WebUI::TypeID VKWebUIControllerFactory::GetWebUIType( | 78 content::WebUI::TypeID VKWebUIControllerFactory::GetWebUIType( |
78 content::BrowserContext* browser_context, | 79 content::BrowserContext* browser_context, |
79 const GURL& url) const { | 80 const GURL& url) const { |
80 if (url == GURL(kKeyboardURL)) | 81 if (url == GURL(kKeyboardURL)) |
81 return const_cast<VKWebUIControllerFactory*>(this); | 82 return const_cast<VKWebUIControllerFactory*>(this); |
(...skipping 27 matching lines...) Expand all Loading... |
109 } | 110 } |
110 | 111 |
111 // protected | 112 // protected |
112 VKWebUIControllerFactory::VKWebUIControllerFactory() { | 113 VKWebUIControllerFactory::VKWebUIControllerFactory() { |
113 } | 114 } |
114 | 115 |
115 VKWebUIControllerFactory::~VKWebUIControllerFactory() { | 116 VKWebUIControllerFactory::~VKWebUIControllerFactory() { |
116 } | 117 } |
117 | 118 |
118 } // namespace keyboard | 119 } // namespace keyboard |
OLD | NEW |