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/bookmarks_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/browser/ui/webui/chrome_url_data_manager.h" | |
11 #include "chrome/common/url_constants.h" | 10 #include "chrome/common/url_constants.h" |
12 #include "content/public/browser/web_ui.h" | 11 #include "content/public/browser/web_ui.h" |
13 #include "grit/theme_resources.h" | 12 #include "grit/theme_resources.h" |
14 #include "ui/base/resource/resource_bundle.h" | 13 #include "ui/base/resource/resource_bundle.h" |
15 | 14 |
16 //////////////////////////////////////////////////////////////////////////////// | 15 //////////////////////////////////////////////////////////////////////////////// |
17 // | 16 // |
18 // BookmarksUIHTMLSource | 17 // BookmarksUIHTMLSource |
19 // | 18 // |
20 //////////////////////////////////////////////////////////////////////////////// | 19 //////////////////////////////////////////////////////////////////////////////// |
21 | 20 |
22 BookmarksUIHTMLSource::BookmarksUIHTMLSource() { | 21 BookmarksUIHTMLSource::BookmarksUIHTMLSource() { |
23 } | 22 } |
24 | 23 |
25 std::string BookmarksUIHTMLSource::GetSource() { | 24 std::string BookmarksUIHTMLSource::GetSource() { |
26 return chrome::kChromeUIBookmarksHost; | 25 return chrome::kChromeUIBookmarksHost; |
27 } | 26 } |
28 | 27 |
29 void BookmarksUIHTMLSource::StartDataRequest(const std::string& path, | 28 void BookmarksUIHTMLSource::StartDataRequest( |
30 bool is_incognito, | 29 const std::string& path, |
31 int request_id) { | 30 bool is_incognito, |
| 31 const content::URLDataSource::GotDataCallback& callback) { |
32 NOTREACHED() << "We should never get here since the extension should have" | 32 NOTREACHED() << "We should never get here since the extension should have" |
33 << "been triggered"; | 33 << "been triggered"; |
34 | 34 |
35 url_data_source()->SendResponse(request_id, NULL); | 35 callback.Run(NULL); |
36 } | 36 } |
37 | 37 |
38 std::string BookmarksUIHTMLSource::GetMimeType(const std::string& path) const { | 38 std::string BookmarksUIHTMLSource::GetMimeType(const std::string& path) const { |
39 NOTREACHED() << "We should never get here since the extension should have" | 39 NOTREACHED() << "We should never get here since the extension should have" |
40 << "been triggered"; | 40 << "been triggered"; |
41 return "text/html"; | 41 return "text/html"; |
42 } | 42 } |
43 | 43 |
44 BookmarksUIHTMLSource::~BookmarksUIHTMLSource() {} | 44 BookmarksUIHTMLSource::~BookmarksUIHTMLSource() {} |
45 | 45 |
(...skipping 10 matching lines...) Expand all Loading... |
56 Profile* profile = Profile::FromWebUI(web_ui); | 56 Profile* profile = Profile::FromWebUI(web_ui); |
57 ChromeURLDataManager::AddDataSource(profile, html_source); | 57 ChromeURLDataManager::AddDataSource(profile, html_source); |
58 } | 58 } |
59 | 59 |
60 // static | 60 // static |
61 base::RefCountedMemory* BookmarksUI::GetFaviconResourceBytes( | 61 base::RefCountedMemory* BookmarksUI::GetFaviconResourceBytes( |
62 ui::ScaleFactor scale_factor) { | 62 ui::ScaleFactor scale_factor) { |
63 return ui::ResourceBundle::GetSharedInstance(). | 63 return ui::ResourceBundle::GetSharedInstance(). |
64 LoadDataResourceBytesForScale(IDR_BOOKMARKS_FAVICON, scale_factor); | 64 LoadDataResourceBytesForScale(IDR_BOOKMARKS_FAVICON, scale_factor); |
65 } | 65 } |
OLD | NEW |