Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(232)

Unified Diff: ui/keyboard/webui/vk_webui_controller.cc

Issue 946623002: [Code cleanup]Remove webui keyboard mojo binding (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/keyboard/webui/vk_webui_controller.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/keyboard/webui/vk_webui_controller.cc
diff --git a/ui/keyboard/webui/vk_webui_controller.cc b/ui/keyboard/webui/vk_webui_controller.cc
deleted file mode 100644
index 9a4688d4cf642fad28d3bffc868656024080b4be..0000000000000000000000000000000000000000
--- a/ui/keyboard/webui/vk_webui_controller.cc
+++ /dev/null
@@ -1,118 +0,0 @@
-// 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.
-
-#include "ui/keyboard/webui/vk_webui_controller.h"
-
-#include "base/strings/string_util.h"
-#include "base/strings/stringprintf.h"
-#include "content/public/browser/render_frame_host.h"
-#include "content/public/browser/render_view_host.h"
-#include "content/public/browser/web_contents.h"
-#include "content/public/browser/web_ui_data_source.h"
-#include "content/public/common/service_registry.h"
-#include "grit/keyboard_resources.h"
-#include "grit/keyboard_resources_map.h"
-#include "third_party/mojo/src/mojo/public/cpp/bindings/interface_impl.h"
-#include "third_party/mojo/src/mojo/public/cpp/system/core.h"
-#include "ui/keyboard/keyboard_constants.h"
-#include "ui/keyboard/keyboard_util.h"
-#include "ui/keyboard/webui/vk_mojo_handler.h"
-
-namespace keyboard {
-
-namespace {
-
-content::WebUIDataSource* CreateKeyboardUIDataSource() {
- content::WebUIDataSource* source =
- content::WebUIDataSource::Create(kKeyboardHost);
-
- size_t count = 0;
- const GritResourceMap* resources = GetKeyboardExtensionResources(&count);
- source->SetDefaultResource(IDR_KEYBOARD_INDEX);
-
- const std::string keyboard_host = base::StringPrintf("%s/", kKeyboardHost);
- for (size_t i = 0; i < count; ++i) {
- size_t offset = 0;
- // The webui URL needs to skip the 'keyboard/' at the front of the resource
- // names, since it is part of the data-source name.
- if (StartsWithASCII(std::string(resources[i].name), keyboard_host, false))
- offset = keyboard_host.length();
- source->AddResourcePath(resources[i].name + offset, resources[i].value);
- }
- return source;
-}
-
-} // namespace
-
-////////////////////////////////////////////////////////////////////////////////
-// VKWebUIController:
-
-VKWebUIController::VKWebUIController(content::WebUI* web_ui)
- : WebUIController(web_ui), weak_factory_(this) {
- content::BrowserContext* browser_context =
- web_ui->GetWebContents()->GetBrowserContext();
- content::WebUIDataSource::Add(browser_context, CreateKeyboardUIDataSource());
- content::WebUIDataSource::AddMojoDataSource(browser_context)->AddResourcePath(
- "ui/keyboard/webui/keyboard.mojom", IDR_KEYBOARD_MOJO_GEN_JS);
-}
-
-VKWebUIController::~VKWebUIController() {
-}
-
-void VKWebUIController::RenderViewCreated(content::RenderViewHost* host) {
- host->GetMainFrame()->GetServiceRegistry()->AddService<KeyboardUIHandlerMojo>(
- base::Bind(&VKWebUIController::CreateAndStoreUIHandler,
- weak_factory_.GetWeakPtr()));
-}
-
-void VKWebUIController::CreateAndStoreUIHandler(
- mojo::InterfaceRequest<KeyboardUIHandlerMojo> request) {
- ui_handler_ = make_scoped_ptr(new VKMojoHandler(request.Pass()));
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// VKWebUIControllerFactory:
-
-content::WebUI::TypeID VKWebUIControllerFactory::GetWebUIType(
- content::BrowserContext* browser_context,
- const GURL& url) const {
- if (url == GURL(kKeyboardURL))
- return const_cast<VKWebUIControllerFactory*>(this);
-
- return content::WebUI::kNoWebUI;
-}
-
-bool VKWebUIControllerFactory::UseWebUIForURL(
- content::BrowserContext* browser_context,
- const GURL& url) const {
- return GetWebUIType(browser_context, url) != content::WebUI::kNoWebUI;
-}
-
-bool VKWebUIControllerFactory::UseWebUIBindingsForURL(
- content::BrowserContext* browser_context,
- const GURL& url) const {
- return UseWebUIForURL(browser_context, url);
-}
-
-content::WebUIController* VKWebUIControllerFactory::CreateWebUIControllerForURL(
- content::WebUI* web_ui,
- const GURL& url) const {
- if (url == GURL(kKeyboardURL))
- return new VKWebUIController(web_ui);
- return NULL;
-}
-
-// static
-VKWebUIControllerFactory* VKWebUIControllerFactory::GetInstance() {
- return Singleton<VKWebUIControllerFactory>::get();
-}
-
-// protected
-VKWebUIControllerFactory::VKWebUIControllerFactory() {
-}
-
-VKWebUIControllerFactory::~VKWebUIControllerFactory() {
-}
-
-} // namespace keyboard
« no previous file with comments | « ui/keyboard/webui/vk_webui_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698