| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/chromeos/system_info_ui.h" | 5 #include "chrome/browser/ui/webui/chromeos/system_info_ui.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/memory/ref_counted_memory.h" | 9 #include "base/memory/ref_counted_memory.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
| 12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
| 13 #include "base/path_service.h" | 13 #include "base/path_service.h" |
| 14 #include "base/strings/string_piece.h" | 14 #include "base/strings/string_piece.h" |
| 15 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
| 16 #include "base/strings/utf_string_conversions.h" | 16 #include "base/strings/utf_string_conversions.h" |
| 17 #include "base/synchronization/waitable_event.h" | 17 #include "base/synchronization/waitable_event.h" |
| 18 #include "base/threading/thread.h" | 18 #include "base/threading/thread.h" |
| 19 #include "base/time/time.h" | 19 #include "base/time/time.h" |
| 20 #include "base/values.h" | 20 #include "base/values.h" |
| 21 #include "chrome/browser/chromeos/system_logs/system_logs_fetcher.h" | 21 #include "chrome/browser/chromeos/system_logs/about_system_logs_fetcher.h" |
| 22 #include "chrome/browser/profiles/profile.h" | 22 #include "chrome/browser/profiles/profile.h" |
| 23 #include "chrome/common/chrome_paths.h" | 23 #include "chrome/common/chrome_paths.h" |
| 24 #include "chrome/common/url_constants.h" | 24 #include "chrome/common/url_constants.h" |
| 25 #include "content/public/browser/url_data_source.h" | 25 #include "content/public/browser/url_data_source.h" |
| 26 #include "content/public/browser/web_contents.h" | 26 #include "content/public/browser/web_contents.h" |
| 27 #include "content/public/browser/web_ui.h" | 27 #include "content/public/browser/web_ui.h" |
| 28 #include "content/public/browser/web_ui_message_handler.h" | 28 #include "content/public/browser/web_ui_message_handler.h" |
| 29 #include "grit/browser_resources.h" | 29 #include "grit/browser_resources.h" |
| 30 #include "grit/chromium_strings.h" | 30 #include "grit/chromium_strings.h" |
| 31 #include "grit/generated_resources.h" | 31 #include "grit/generated_resources.h" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 } | 103 } |
| 104 | 104 |
| 105 void SystemInfoUIHTMLSource::StartDataRequest( | 105 void SystemInfoUIHTMLSource::StartDataRequest( |
| 106 const std::string& path, | 106 const std::string& path, |
| 107 int render_process_id, | 107 int render_process_id, |
| 108 int render_view_id, | 108 int render_view_id, |
| 109 const content::URLDataSource::GotDataCallback& callback) { | 109 const content::URLDataSource::GotDataCallback& callback) { |
| 110 path_ = path; | 110 path_ = path; |
| 111 callback_ = callback; | 111 callback_ = callback; |
| 112 | 112 |
| 113 SystemLogsFetcher* fetcher = new SystemLogsFetcher(); | 113 AboutSystemLogsFetcher* fetcher = new AboutSystemLogsFetcher(); |
| 114 fetcher->Fetch(base::Bind(&SystemInfoUIHTMLSource::SysInfoComplete, | 114 fetcher->Fetch(base::Bind(&SystemInfoUIHTMLSource::SysInfoComplete, |
| 115 weak_ptr_factory_.GetWeakPtr())); | 115 weak_ptr_factory_.GetWeakPtr())); |
| 116 } | 116 } |
| 117 | 117 |
| 118 | 118 |
| 119 void SystemInfoUIHTMLSource::SysInfoComplete( | 119 void SystemInfoUIHTMLSource::SysInfoComplete( |
| 120 scoped_ptr<SystemLogsResponse> sys_info) { | 120 scoped_ptr<SystemLogsResponse> sys_info) { |
| 121 response_ = sys_info.Pass(); | 121 response_ = sys_info.Pass(); |
| 122 RequestComplete(); | 122 RequestComplete(); |
| 123 } | 123 } |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 SystemInfoHandler* handler = new SystemInfoHandler(); | 184 SystemInfoHandler* handler = new SystemInfoHandler(); |
| 185 web_ui->AddMessageHandler(handler); | 185 web_ui->AddMessageHandler(handler); |
| 186 SystemInfoUIHTMLSource* html_source = new SystemInfoUIHTMLSource(); | 186 SystemInfoUIHTMLSource* html_source = new SystemInfoUIHTMLSource(); |
| 187 | 187 |
| 188 // Set up the chrome://system/ source. | 188 // Set up the chrome://system/ source. |
| 189 Profile* profile = Profile::FromWebUI(web_ui); | 189 Profile* profile = Profile::FromWebUI(web_ui); |
| 190 content::URLDataSource::Add(profile, html_source); | 190 content::URLDataSource::Add(profile, html_source); |
| 191 } | 191 } |
| 192 | 192 |
| 193 } // namespace chromeos | 193 } // namespace chromeos |
| OLD | NEW |