1 // Copyright 2014 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/gcm_internals_ui.h"
7 #include "chrome/browser/profiles/profile.h"
8 #include "chrome/common/url_constants.h"
9 #include "content/public/browser/web_ui_data_source.h"
10 #include "grit/browser_resources.h"
12 GCMInternalsUI::GCMInternalsUI(content::WebUI
* web_ui
)
13 : content::WebUIController(web_ui
) {
14 // Set up the chrome://gcm-internals source.
15 content::WebUIDataSource
* html_source
=
16 content::WebUIDataSource::Create(chrome::kChromeUIGCMInternalsHost
);
17 html_source
->SetUseJsonJSFormatV2();
19 html_source
->SetJsonPath("strings.js");
21 // Add required resources.
22 html_source
->AddResourcePath("gcm_internals.css", IDR_GCM_INTERNALS_CSS
);
23 html_source
->AddResourcePath("gcm_internals.js", IDR_GCM_INTERNALS_JS
);
24 html_source
->SetDefaultResource(IDR_GCM_INTERNALS_HTML
);
26 Profile
* profile
= Profile::FromWebUI(web_ui
);
27 content::WebUIDataSource::Add(profile
, html_source
);
30 GCMInternalsUI::~GCMInternalsUI() {}