1 // Copyright (c) 2013 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/memory_internals/memory_internals_ui.h"
7 #include "chrome/browser/profiles/profile.h"
8 #include "chrome/browser/ui/webui/memory_internals/memory_internals_handler.h"
9 #include "chrome/common/url_constants.h"
10 #include "content/public/browser/web_ui.h"
11 #include "content/public/browser/web_ui_data_source.h"
12 #include "grit/memory_internals_resources.h"
16 content::WebUIDataSource
* CreateMemoryInternalsHTMLSource() {
17 content::WebUIDataSource
* source
=
18 content::WebUIDataSource::Create(chrome::kChromeUIMemoryInternalsHost
);
20 source
->AddResourcePath("memory_internals.js",
21 IDR_MEMORY_INTERNALS_MEMORY_INTERNALS_JS
);
22 source
->SetDefaultResource(IDR_MEMORY_INTERNALS_MEMORY_INTERNALS_HTML
);
28 MemoryInternalsUI::MemoryInternalsUI(content::WebUI
* web_ui
)
29 : WebUIController(web_ui
) {
30 web_ui
->AddMessageHandler(new MemoryInternalsHandler());
32 // Set up the chrome://memory-internals/ source.
33 Profile
* profile
= Profile::FromWebUI(web_ui
);
34 content::WebUIDataSource::Add(profile
, CreateMemoryInternalsHTMLSource());