| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2010 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/dom_ui/bookmarks_ui.h" |
| 6 |
| 7 #include "app/resource_bundle.h" |
| 8 #include "base/message_loop.h" |
| 9 #include "base/ref_counted_memory.h" |
| 10 #include "base/singleton.h" |
| 11 #include "base/string_piece.h" |
| 12 #include "base/string_util.h" |
| 13 #include "chrome/browser/chrome_thread.h" |
| 14 #include "chrome/browser/dom_ui/chrome_url_data_manager.h" |
| 15 #include "chrome/common/url_constants.h" |
| 16 #include "grit/browser_resources.h" |
| 17 #include "grit/theme_resources.h" |
| 18 |
| 19 //////////////////////////////////////////////////////////////////////////////// |
| 20 // |
| 21 // BookmarksUIHTMLSource |
| 22 // |
| 23 //////////////////////////////////////////////////////////////////////////////// |
| 24 |
| 25 BookmarksUIHTMLSource::BookmarksUIHTMLSource() |
| 26 : DataSource(chrome::kChromeUIBookmarksHost, MessageLoop::current()) { |
| 27 } |
| 28 |
| 29 void BookmarksUIHTMLSource::StartDataRequest(const std::string& path, |
| 30 bool is_off_the_record, int request_id) { |
| 31 NOTREACHED() << "We should never get here since the extension should have" |
| 32 << "been triggered"; |
| 33 } |
| 34 |
| 35 //////////////////////////////////////////////////////////////////////////////// |
| 36 // |
| 37 // BookmarksUI |
| 38 // |
| 39 //////////////////////////////////////////////////////////////////////////////// |
| 40 |
| 41 BookmarksUI::BookmarksUI(TabContents* contents) : DOMUI(contents) { |
| 42 BookmarksUIHTMLSource* html_source = new BookmarksUIHTMLSource(); |
| 43 |
| 44 // Set up the chrome://bookmarks/ source. |
| 45 ChromeThread::PostTask( |
| 46 ChromeThread::IO, FROM_HERE, |
| 47 NewRunnableMethod( |
| 48 Singleton<ChromeURLDataManager>::get(), |
| 49 &ChromeURLDataManager::AddDataSource, |
| 50 make_scoped_refptr(html_source))); |
| 51 } |
| 52 |
| 53 // static |
| 54 RefCountedMemory* BookmarksUI::GetFaviconResourceBytes() { |
| 55 return ResourceBundle::GetSharedInstance(). |
| 56 LoadDataResourceBytes(IDR_BOOKMARKS_FAVICON); |
| 57 } |
| OLD | NEW |