| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/ui/webui/bookmarks_ui.h" | 5 #include "chrome/browser/ui/webui/virtual_keyboard_ui.h" |
| 6 | 6 |
| 7 #include "base/memory/ref_counted_memory.h" | 7 #include "base/memory/ref_counted_memory.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/common/url_constants.h" | 10 #include "chrome/common/url_constants.h" |
| 11 #include "content/public/browser/url_data_source.h" | 11 #include "content/public/browser/url_data_source.h" |
| 12 #include "content/public/browser/web_ui.h" | 12 #include "content/public/browser/web_ui.h" |
| 13 #include "grit/theme_resources.h" | 13 #include "grit/theme_resources.h" |
| 14 #include "ui/base/resource/resource_bundle.h" | 14 #include "ui/base/resource/resource_bundle.h" |
| 15 | 15 |
| 16 //////////////////////////////////////////////////////////////////////////////// | 16 //////////////////////////////////////////////////////////////////////////////// |
| 17 // | 17 // |
| 18 // BookmarksUIHTMLSource | 18 // VirtualKeyboardUIHTMLSource |
| 19 // | 19 // |
| 20 //////////////////////////////////////////////////////////////////////////////// | 20 //////////////////////////////////////////////////////////////////////////////// |
| 21 | 21 |
| 22 BookmarksUIHTMLSource::BookmarksUIHTMLSource() { | 22 VirtualKeyboardUIHTMLSource::VirtualKeyboardUIHTMLSource() { |
| 23 } | 23 } |
| 24 | 24 |
| 25 std::string BookmarksUIHTMLSource::GetSource() { | 25 std::string VirtualKeyboardUIHTMLSource::GetSource() { |
| 26 return chrome::kChromeUIBookmarksHost; | 26 return chrome::kChromeUIBookmarksHost; |
| 27 } | 27 } |
| 28 | 28 |
| 29 void BookmarksUIHTMLSource::StartDataRequest( | 29 void VirtualKeyboardUIHTMLSource::StartDataRequest( |
| 30 const std::string& path, | 30 const std::string& path, |
| 31 bool is_incognito, | 31 bool is_incognito, |
| 32 const content::URLDataSource::GotDataCallback& callback) { | 32 const content::URLDataSource::GotDataCallback& callback) { |
| 33 NOTREACHED() << "We should never get here since the extension should have" | 33 NOTREACHED() << "We should never get here since the extension should have" |
| 34 << "been triggered"; | 34 << "been triggered"; |
| 35 | |
| 36 callback.Run(NULL); | 35 callback.Run(NULL); |
| 37 } | 36 } |
| 38 | 37 |
| 39 std::string BookmarksUIHTMLSource::GetMimeType(const std::string& path) const { | 38 std::string VirtualKeyboardUIHTMLSource::GetMimeType( |
| 39 const std::string& path) const { |
| 40 NOTREACHED() << "We should never get here since the extension should have" | 40 NOTREACHED() << "We should never get here since the extension should have" |
| 41 << "been triggered"; | 41 << "been triggered"; |
| 42 return "text/html"; | 42 return "text/html"; |
| 43 } | 43 } |
| 44 | 44 |
| 45 BookmarksUIHTMLSource::~BookmarksUIHTMLSource() {} | 45 VirtualKeyboardUIHTMLSource::~VirtualKeyboardUIHTMLSource() {} |
| 46 | 46 |
| 47 //////////////////////////////////////////////////////////////////////////////// | 47 //////////////////////////////////////////////////////////////////////////////// |
| 48 // | 48 // |
| 49 // BookmarksUI | 49 // VirtualKeyboardUI |
| 50 // | 50 // |
| 51 //////////////////////////////////////////////////////////////////////////////// | 51 //////////////////////////////////////////////////////////////////////////////// |
| 52 | 52 |
| 53 BookmarksUI::BookmarksUI(content::WebUI* web_ui) : WebUIController(web_ui) { | 53 VirtualKeyboardUI::VirtualKeyboardUI(content::WebUI* web_ui) |
| 54 BookmarksUIHTMLSource* html_source = new BookmarksUIHTMLSource(); | 54 : WebUIController(web_ui) { |
| 55 | 55 VirtualKeyboardUIHTMLSource* html_source = new VirtualKeyboardUIHTMLSource(); |
| 56 // Set up the chrome://bookmarks/ source. | 56 // Set up the chrome://keyboard/ source. |
| 57 Profile* profile = Profile::FromWebUI(web_ui); | 57 Profile* profile = Profile::FromWebUI(web_ui); |
| 58 content::URLDataSource::Add(profile, html_source); | 58 content::URLDataSource::Add(profile, html_source); |
| 59 } | 59 } |
| 60 | |
| 61 // static | |
| 62 base::RefCountedMemory* BookmarksUI::GetFaviconResourceBytes( | |
| 63 ui::ScaleFactor scale_factor) { | |
| 64 return ui::ResourceBundle::GetSharedInstance(). | |
| 65 LoadDataResourceBytesForScale(IDR_BOOKMARKS_FAVICON, scale_factor); | |
| 66 } | |
| OLD | NEW |