| OLD | NEW |
| (Empty) |
| 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. | |
| 4 | |
| 5 #include "chrome/browser/ui/webui/memory_internals/memory_internals_ui.h" | |
| 6 | |
| 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" | |
| 13 | |
| 14 namespace { | |
| 15 | |
| 16 content::WebUIDataSource* CreateMemoryInternalsHTMLSource() { | |
| 17 content::WebUIDataSource* source = | |
| 18 content::WebUIDataSource::Create(chrome::kChromeUIMemoryInternalsHost); | |
| 19 | |
| 20 source->AddResourcePath("memory_internals.js", | |
| 21 IDR_MEMORY_INTERNALS_MEMORY_INTERNALS_JS); | |
| 22 source->SetDefaultResource(IDR_MEMORY_INTERNALS_MEMORY_INTERNALS_HTML); | |
| 23 return source; | |
| 24 } | |
| 25 | |
| 26 } // namespace | |
| 27 | |
| 28 MemoryInternalsUI::MemoryInternalsUI(content::WebUI* web_ui) | |
| 29 : WebUIController(web_ui) { | |
| 30 web_ui->AddMessageHandler(new MemoryInternalsHandler()); | |
| 31 | |
| 32 // Set up the chrome://memory-internals/ source. | |
| 33 Profile* profile = Profile::FromWebUI(web_ui); | |
| 34 content::WebUIDataSource::Add(profile, CreateMemoryInternalsHTMLSource()); | |
| 35 } | |
| OLD | NEW |