| 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" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 namespace chromeos { | 44 namespace chromeos { |
| 45 | 45 |
| 46 class SystemInfoUIHTMLSource : public content::URLDataSource{ | 46 class SystemInfoUIHTMLSource : public content::URLDataSource{ |
| 47 public: | 47 public: |
| 48 SystemInfoUIHTMLSource(); | 48 SystemInfoUIHTMLSource(); |
| 49 | 49 |
| 50 // content::URLDataSource implementation. | 50 // content::URLDataSource implementation. |
| 51 virtual std::string GetSource() OVERRIDE; | 51 virtual std::string GetSource() OVERRIDE; |
| 52 virtual void StartDataRequest( | 52 virtual void StartDataRequest( |
| 53 const std::string& path, | 53 const std::string& path, |
| 54 bool is_incognito, | 54 const content::URLDataSource::ExtraRequestInfo& info, |
| 55 const content::URLDataSource::GotDataCallback& callback) OVERRIDE; | 55 const content::URLDataSource::GotDataCallback& callback) OVERRIDE; |
| 56 virtual std::string GetMimeType(const std::string&) const OVERRIDE { | 56 virtual std::string GetMimeType(const std::string&) const OVERRIDE { |
| 57 return "text/html"; | 57 return "text/html"; |
| 58 } | 58 } |
| 59 virtual bool ShouldAddContentSecurityPolicy() const OVERRIDE { | 59 virtual bool ShouldAddContentSecurityPolicy() const OVERRIDE { |
| 60 return false; | 60 return false; |
| 61 } | 61 } |
| 62 | 62 |
| 63 private: | 63 private: |
| 64 virtual ~SystemInfoUIHTMLSource() {} | 64 virtual ~SystemInfoUIHTMLSource() {} |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 : response_(NULL), | 100 : response_(NULL), |
| 101 ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) { | 101 ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) { |
| 102 } | 102 } |
| 103 | 103 |
| 104 std::string SystemInfoUIHTMLSource::GetSource() { | 104 std::string SystemInfoUIHTMLSource::GetSource() { |
| 105 return chrome::kChromeUISystemInfoHost; | 105 return chrome::kChromeUISystemInfoHost; |
| 106 } | 106 } |
| 107 | 107 |
| 108 void SystemInfoUIHTMLSource::StartDataRequest( | 108 void SystemInfoUIHTMLSource::StartDataRequest( |
| 109 const std::string& path, | 109 const std::string& path, |
| 110 bool is_incognito, | 110 const content::URLDataSource::ExtraRequestInfo& info, |
| 111 const content::URLDataSource::GotDataCallback& callback) { | 111 const content::URLDataSource::GotDataCallback& callback) { |
| 112 path_ = path; | 112 path_ = path; |
| 113 callback_ = callback; | 113 callback_ = callback; |
| 114 | 114 |
| 115 SystemLogsFetcher* fetcher = new SystemLogsFetcher(); | 115 SystemLogsFetcher* fetcher = new SystemLogsFetcher(); |
| 116 fetcher->Fetch(base::Bind(&SystemInfoUIHTMLSource::SysInfoComplete, | 116 fetcher->Fetch(base::Bind(&SystemInfoUIHTMLSource::SysInfoComplete, |
| 117 weak_ptr_factory_.GetWeakPtr())); | 117 weak_ptr_factory_.GetWeakPtr())); |
| 118 } | 118 } |
| 119 | 119 |
| 120 | 120 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 SystemInfoHandler* handler = new SystemInfoHandler(); | 186 SystemInfoHandler* handler = new SystemInfoHandler(); |
| 187 web_ui->AddMessageHandler(handler); | 187 web_ui->AddMessageHandler(handler); |
| 188 SystemInfoUIHTMLSource* html_source = new SystemInfoUIHTMLSource(); | 188 SystemInfoUIHTMLSource* html_source = new SystemInfoUIHTMLSource(); |
| 189 | 189 |
| 190 // Set up the chrome://system/ source. | 190 // Set up the chrome://system/ source. |
| 191 Profile* profile = Profile::FromWebUI(web_ui); | 191 Profile* profile = Profile::FromWebUI(web_ui); |
| 192 content::URLDataSource::Add(profile, html_source); | 192 content::URLDataSource::Add(profile, html_source); |
| 193 } | 193 } |
| 194 | 194 |
| 195 } // namespace chromeos | 195 } // namespace chromeos |
| OLD | NEW |