| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 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 | 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/dom_ui/bookmarks_ui.h" | 5 #include "chrome/browser/dom_ui/bookmarks_ui.h" |
| 6 | 6 |
| 7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "base/ref_counted_memory.h" | 8 #include "base/ref_counted_memory.h" |
| 9 #include "base/singleton.h" | 9 #include "base/singleton.h" |
| 10 #include "chrome/browser/browser_thread.h" | 10 #include "chrome/browser/browser_thread.h" |
| 11 #include "chrome/browser/profiles/profile.h" | |
| 12 #include "chrome/browser/dom_ui/chrome_url_data_manager.h" | 11 #include "chrome/browser/dom_ui/chrome_url_data_manager.h" |
| 13 #include "chrome/browser/tab_contents/tab_contents.h" | |
| 14 #include "chrome/common/url_constants.h" | 12 #include "chrome/common/url_constants.h" |
| 15 #include "grit/theme_resources.h" | 13 #include "grit/theme_resources.h" |
| 16 #include "ui/base/resource/resource_bundle.h" | 14 #include "ui/base/resource/resource_bundle.h" |
| 17 | 15 |
| 18 //////////////////////////////////////////////////////////////////////////////// | 16 //////////////////////////////////////////////////////////////////////////////// |
| 19 // | 17 // |
| 20 // BookmarksUIHTMLSource | 18 // BookmarksUIHTMLSource |
| 21 // | 19 // |
| 22 //////////////////////////////////////////////////////////////////////////////// | 20 //////////////////////////////////////////////////////////////////////////////// |
| 23 | 21 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 43 //////////////////////////////////////////////////////////////////////////////// | 41 //////////////////////////////////////////////////////////////////////////////// |
| 44 // | 42 // |
| 45 // BookmarksUI | 43 // BookmarksUI |
| 46 // | 44 // |
| 47 //////////////////////////////////////////////////////////////////////////////// | 45 //////////////////////////////////////////////////////////////////////////////// |
| 48 | 46 |
| 49 BookmarksUI::BookmarksUI(TabContents* contents) : DOMUI(contents) { | 47 BookmarksUI::BookmarksUI(TabContents* contents) : DOMUI(contents) { |
| 50 BookmarksUIHTMLSource* html_source = new BookmarksUIHTMLSource(); | 48 BookmarksUIHTMLSource* html_source = new BookmarksUIHTMLSource(); |
| 51 | 49 |
| 52 // Set up the chrome://bookmarks/ source. | 50 // Set up the chrome://bookmarks/ source. |
| 53 contents->profile()->GetChromeURLDataManager()->AddDataSource(html_source); | 51 BrowserThread::PostTask( |
| 52 BrowserThread::IO, FROM_HERE, |
| 53 NewRunnableMethod( |
| 54 ChromeURLDataManager::GetInstance(), |
| 55 &ChromeURLDataManager::AddDataSource, |
| 56 make_scoped_refptr(html_source))); |
| 54 } | 57 } |
| 55 | 58 |
| 56 // static | 59 // static |
| 57 RefCountedMemory* BookmarksUI::GetFaviconResourceBytes() { | 60 RefCountedMemory* BookmarksUI::GetFaviconResourceBytes() { |
| 58 return ResourceBundle::GetSharedInstance(). | 61 return ResourceBundle::GetSharedInstance(). |
| 59 LoadDataResourceBytes(IDR_BOOKMARKS_FAVICON); | 62 LoadDataResourceBytes(IDR_BOOKMARKS_FAVICON); |
| 60 } | 63 } |
| OLD | NEW |