Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / browser / ui / webui / quota_internals / quota_internals_ui.cc
blob44e77071b41f5b39ccf03607f9fa3074b32ceba9
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
3 // found in the LICENSE file.
5 #include "chrome/browser/ui/webui/quota_internals/quota_internals_ui.h"
7 #include <string>
9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/ui/webui/quota_internals/quota_internals_handler.h"
11 #include "chrome/common/url_constants.h"
12 #include "content/public/browser/web_contents.h"
13 #include "content/public/browser/web_ui.h"
14 #include "content/public/browser/web_ui_data_source.h"
15 #include "grit/quota_internals_resources.h"
17 using content::WebContents;
19 namespace {
21 content::WebUIDataSource* CreateQuotaInternalsHTMLSource() {
22 content::WebUIDataSource* source =
23 content::WebUIDataSource::Create(chrome::kChromeUIQuotaInternalsHost);
25 source->SetJsonPath("strings.js");
26 source->AddResourcePath(
27 "event_handler.js", IDR_QUOTA_INTERNALS_EVENT_HANDLER_JS);
28 source->AddResourcePath(
29 "message_dispatcher.js", IDR_QUOTA_INTERNALS_MESSAGE_DISPATCHER_JS);
30 source->SetDefaultResource(IDR_QUOTA_INTERNALS_MAIN_HTML);
31 return source;
34 } // namespace
36 QuotaInternalsUI::QuotaInternalsUI(content::WebUI* web_ui)
37 : WebUIController(web_ui) {
38 web_ui->AddMessageHandler(new quota_internals::QuotaInternalsHandler);
39 Profile* profile = Profile::FromWebUI(web_ui);
40 content::WebUIDataSource::Add(profile, CreateQuotaInternalsHTMLSource());