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 30 matching lines...) Expand all Loading... |
41 using content::WebContents; | 41 using content::WebContents; |
42 using content::WebUIMessageHandler; | 42 using content::WebUIMessageHandler; |
43 | 43 |
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() const OVERRIDE; |
52 virtual void StartDataRequest( | 52 virtual void StartDataRequest( |
53 const std::string& path, | 53 const std::string& path, |
54 bool is_incognito, | 54 bool is_incognito, |
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 } |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 // | 94 // |
95 // SystemInfoUIHTMLSource | 95 // SystemInfoUIHTMLSource |
96 // | 96 // |
97 //////////////////////////////////////////////////////////////////////////////// | 97 //////////////////////////////////////////////////////////////////////////////// |
98 | 98 |
99 SystemInfoUIHTMLSource::SystemInfoUIHTMLSource() | 99 SystemInfoUIHTMLSource::SystemInfoUIHTMLSource() |
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() const { |
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 bool is_incognito, |
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 |
(...skipping 71 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 |