1 // Copyright (c) 2011 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. 4 5 #include "chrome/browser/ui/webui/keyboard_ui.h" 6 7 #include "base/memory/ref_counted_memory.h" 8 #include "base/memory/singleton.h" 9 #include "base/string_piece.h" 10 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" 12 #include "chrome/common/url_constants.h" 13 #include "content/browser/browser_thread.h" 14 #include "content/browser/tab_contents/tab_contents.h" 15 #include "ui/base/resource/resource_bundle.h" 16 17 /////////////////////////////////////////////////////////////////////////////// 18 // KeyboardUI 19 KeyboardUI(TabContents * contents)20KeyboardUI::KeyboardUI(TabContents* contents) 21 : WebUI(contents) { 22 KeyboardHTMLSource* html_source = new KeyboardHTMLSource(); 23 contents->profile()->GetChromeURLDataManager()->AddDataSource(html_source); 24 } 25 ~KeyboardUI()26KeyboardUI::~KeyboardUI() { 27 } 28 29 /////////////////////////////////////////////////////////////////////////////// 30 // KeyboardHTMLSource 31 KeyboardHTMLSource()32KeyboardUI::KeyboardHTMLSource::KeyboardHTMLSource() 33 : DataSource(chrome::kChromeUIKeyboardHost, MessageLoop::current()) { 34 } 35 StartDataRequest(const std::string & path,bool is_incognito,int request_id)36void KeyboardUI::KeyboardHTMLSource::StartDataRequest(const std::string& path, 37 bool is_incognito, 38 int request_id) { 39 NOTREACHED() << "We should never get here since the extension should have" 40 << "been triggered"; 41 SendResponse(request_id, NULL); 42 } 43 GetMimeType(const std::string &) const44std::string KeyboardUI::KeyboardHTMLSource::GetMimeType( 45 const std::string&) const { 46 NOTREACHED() << "We should never get here since the extension should have" 47 << "been triggered"; 48 return "text/html"; 49 } 50