This source file includes following definitions.
- GetSource
- StartDataRequest
- GetMimeType
- GetFaviconResourceBytes
#include "chrome/browser/ui/webui/bookmarks_ui.h"
#include "base/memory/ref_counted_memory.h"
#include "base/message_loop/message_loop.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/url_constants.h"
#include "content/public/browser/url_data_source.h"
#include "content/public/browser/web_ui.h"
#include "grit/theme_resources.h"
#include "ui/base/resource/resource_bundle.h"
BookmarksUIHTMLSource::BookmarksUIHTMLSource() {
}
std::string BookmarksUIHTMLSource::GetSource() const {
return chrome::kChromeUIBookmarksHost;
}
void BookmarksUIHTMLSource::StartDataRequest(
const std::string& path,
int render_process_id,
int render_frame_id,
const content::URLDataSource::GotDataCallback& callback) {
NOTREACHED() << "We should never get here since the extension should have"
<< "been triggered";
callback.Run(NULL);
}
std::string BookmarksUIHTMLSource::GetMimeType(const std::string& path) const {
NOTREACHED() << "We should never get here since the extension should have"
<< "been triggered";
return "text/html";
}
BookmarksUIHTMLSource::~BookmarksUIHTMLSource() {}
BookmarksUI::BookmarksUI(content::WebUI* web_ui) : WebUIController(web_ui) {
BookmarksUIHTMLSource* html_source = new BookmarksUIHTMLSource();
Profile* profile = Profile::FromWebUI(web_ui);
content::URLDataSource::Add(profile, html_source);
}
base::RefCountedMemory* BookmarksUI::GetFaviconResourceBytes(
ui::ScaleFactor scale_factor) {
return ui::ResourceBundle::GetSharedInstance().
LoadDataResourceBytesForScale(IDR_BOOKMARKS_FAVICON, scale_factor);
}