| 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/tracing_ui.h" | 5 #include "chrome/browser/ui/webui/tracing_ui.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/file_util.h" | 12 #include "base/file_util.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/string_number_conversions.h" | 14 #include "base/string_number_conversions.h" |
| 15 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
| 16 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
| 17 #include "chrome/browser/ui/select_file_dialog.h" | 17 #include "chrome/browser/ui/select_file_dialog.h" |
| 18 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" | 18 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" |
| 19 #include "chrome/common/chrome_version_info.h" | 19 #include "chrome/common/chrome_version_info.h" |
| 20 #include "chrome/common/url_constants.h" | 20 #include "chrome/common/url_constants.h" |
| 21 #include "content/browser/gpu/gpu_data_manager.h" | 21 #include "content/browser/gpu/gpu_data_manager.h" |
| 22 #include "content/browser/renderer_host/render_view_host.h" | 22 #include "content/browser/renderer_host/render_view_host.h" |
| 23 #include "content/browser/tab_contents/tab_contents_view.h" | 23 #include "content/browser/tab_contents/tab_contents_view.h" |
| 24 #include "content/browser/trace_controller.h" | 24 #include "content/browser/trace_controller.h" |
| 25 #include "content/public/browser/browser_thread.h" | 25 #include "content/public/browser/browser_thread.h" |
| 26 #include "content/public/browser/web_contents.h" | 26 #include "content/public/browser/web_contents.h" |
| 27 #include "content/public/browser/web_ui_message_handler.h" |
| 27 #include "grit/browser_resources.h" | 28 #include "grit/browser_resources.h" |
| 28 #include "grit/generated_resources.h" | 29 #include "grit/generated_resources.h" |
| 29 #include "ui/base/l10n/l10n_util.h" | 30 #include "ui/base/l10n/l10n_util.h" |
| 30 | 31 |
| 31 using content::BrowserThread; | 32 using content::BrowserThread; |
| 32 using content::WebContents; | 33 using content::WebContents; |
| 34 using content::WebUIMessageHandler; |
| 33 | 35 |
| 34 namespace { | 36 namespace { |
| 35 | 37 |
| 36 ChromeWebUIDataSource* CreateTracingHTMLSource() { | 38 ChromeWebUIDataSource* CreateTracingHTMLSource() { |
| 37 ChromeWebUIDataSource* source = | 39 ChromeWebUIDataSource* source = |
| 38 new ChromeWebUIDataSource(chrome::kChromeUITracingHost); | 40 new ChromeWebUIDataSource(chrome::kChromeUITracingHost); |
| 39 | 41 |
| 40 source->set_json_path("strings.js"); | 42 source->set_json_path("strings.js"); |
| 41 source->add_resource_path("tracing.js", IDR_TRACING_JS); | 43 source->add_resource_path("tracing.js", IDR_TRACING_JS); |
| 42 source->set_default_resource(IDR_TRACING_HTML); | 44 source->set_default_resource(IDR_TRACING_HTML); |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 // | 411 // |
| 410 //////////////////////////////////////////////////////////////////////////////// | 412 //////////////////////////////////////////////////////////////////////////////// |
| 411 | 413 |
| 412 TracingUI::TracingUI(WebContents* contents) : ChromeWebUI(contents) { | 414 TracingUI::TracingUI(WebContents* contents) : ChromeWebUI(contents) { |
| 413 AddMessageHandler(new TracingMessageHandler()); | 415 AddMessageHandler(new TracingMessageHandler()); |
| 414 | 416 |
| 415 // Set up the chrome://tracing/ source. | 417 // Set up the chrome://tracing/ source. |
| 416 Profile::FromBrowserContext(contents->GetBrowserContext())-> | 418 Profile::FromBrowserContext(contents->GetBrowserContext())-> |
| 417 GetChromeURLDataManager()->AddDataSource(CreateTracingHTMLSource()); | 419 GetChromeURLDataManager()->AddDataSource(CreateTracingHTMLSource()); |
| 418 } | 420 } |
| OLD | NEW |