| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/webui/task_manager_ui.h" | 5 #include "chrome/browser/ui/webui/task_manager_ui.h" |
| 6 | 6 |
| 7 #include "base/values.h" | 7 #include "base/values.h" |
| 8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
| 9 #include "chrome/browser/task_manager/task_manager.h" | 9 #include "chrome/browser/task_manager/task_manager.h" |
| 10 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" | 10 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" |
| 11 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" | 11 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" |
| 12 #include "chrome/browser/ui/webui/task_manager_handler.h" | 12 #include "chrome/browser/ui/webui/task_manager_handler.h" |
| 13 #include "chrome/common/url_constants.h" | 13 #include "chrome/common/url_constants.h" |
| 14 #include "content/browser/tab_contents/tab_contents.h" | 14 #include "content/public/browser/web_contents.h" |
| 15 #include "grit/browser_resources.h" | 15 #include "grit/browser_resources.h" |
| 16 #include "grit/generated_resources.h" | 16 #include "grit/generated_resources.h" |
| 17 #include "grit/chromium_strings.h" | 17 #include "grit/chromium_strings.h" |
| 18 #include "grit/theme_resources.h" | 18 #include "grit/theme_resources.h" |
| 19 #include "ui/base/l10n/l10n_util.h" | 19 #include "ui/base/l10n/l10n_util.h" |
| 20 #include "ui/base/resource/resource_bundle.h" | 20 #include "ui/base/resource/resource_bundle.h" |
| 21 | 21 |
| 22 using content::WebContents; |
| 23 |
| 22 namespace { | 24 namespace { |
| 23 | 25 |
| 24 ChromeWebUIDataSource* CreateTaskManagerUIHTMLSource() { | 26 ChromeWebUIDataSource* CreateTaskManagerUIHTMLSource() { |
| 25 ChromeWebUIDataSource* source = | 27 ChromeWebUIDataSource* source = |
| 26 new ChromeWebUIDataSource(chrome::kChromeUITaskManagerHost); | 28 new ChromeWebUIDataSource(chrome::kChromeUITaskManagerHost); |
| 27 | 29 |
| 28 source->AddLocalizedString("closeWindow", IDS_CLOSE); | 30 source->AddLocalizedString("closeWindow", IDS_CLOSE); |
| 29 source->AddLocalizedString("title",IDS_TASK_MANAGER_TITLE); | 31 source->AddLocalizedString("title",IDS_TASK_MANAGER_TITLE); |
| 30 source->AddLocalizedString("aboutMemoryLink", | 32 source->AddLocalizedString("aboutMemoryLink", |
| 31 IDS_TASK_MANAGER_ABOUT_MEMORY_LINK); | 33 IDS_TASK_MANAGER_ABOUT_MEMORY_LINK); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 } | 70 } |
| 69 | 71 |
| 70 } // namespace | 72 } // namespace |
| 71 | 73 |
| 72 /////////////////////////////////////////////////////////////////////////////// | 74 /////////////////////////////////////////////////////////////////////////////// |
| 73 // | 75 // |
| 74 // TaskManagerUI | 76 // TaskManagerUI |
| 75 // | 77 // |
| 76 /////////////////////////////////////////////////////////////////////////////// | 78 /////////////////////////////////////////////////////////////////////////////// |
| 77 | 79 |
| 78 TaskManagerUI::TaskManagerUI(TabContents* contents) : ChromeWebUI(contents) { | 80 TaskManagerUI::TaskManagerUI(WebContents* contents) : ChromeWebUI(contents) { |
| 79 AddMessageHandler(new TaskManagerHandler(TaskManager::GetInstance())); | 81 AddMessageHandler(new TaskManagerHandler(TaskManager::GetInstance())); |
| 80 | 82 |
| 81 // Set up the chrome://taskmanager/ source. | 83 // Set up the chrome://taskmanager/ source. |
| 82 ChromeWebUIDataSource* html_source = CreateTaskManagerUIHTMLSource(); | 84 ChromeWebUIDataSource* html_source = CreateTaskManagerUIHTMLSource(); |
| 83 Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); | 85 Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); |
| 84 profile->GetChromeURLDataManager()->AddDataSource(html_source); | 86 profile->GetChromeURLDataManager()->AddDataSource(html_source); |
| 85 } | 87 } |
| OLD | NEW |