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 #ifndef CHROME_BROWSER_UI_WEBUI_ABOUT_UI_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_ABOUT_UI_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_ABOUT_UI_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_ABOUT_UI_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "content/public/browser/url_data_source.h" |
13 #include "content/public/browser/url_data_source_delegate.h" | |
14 #include "content/public/browser/web_ui_controller.h" | 13 #include "content/public/browser/web_ui_controller.h" |
15 | 14 |
16 class Profile; | 15 class Profile; |
17 | 16 |
18 // We expose this class because the OOBE flow may need to explicitly add the | 17 // We expose this class because the OOBE flow may need to explicitly add the |
19 // chrome://terms source outside of the normal flow. | 18 // chrome://terms source outside of the normal flow. |
20 class AboutUIHTMLSource : public content::URLDataSourceDelegate, | 19 class AboutUIHTMLSource : public content::URLDataSource { |
21 public base::SupportsWeakPtr<AboutUIHTMLSource> { | |
22 public: | 20 public: |
23 // Construct a data source for the specified |source_name|. | 21 // Construct a data source for the specified |source_name|. |
24 AboutUIHTMLSource(const std::string& source_name, Profile* profile); | 22 AboutUIHTMLSource(const std::string& source_name, Profile* profile); |
25 | 23 |
26 // content::URLDataSourceDelegate implementation. | 24 // content::URLDataSource implementation. |
27 virtual std::string GetSource() OVERRIDE; | 25 virtual std::string GetSource() OVERRIDE; |
28 virtual void StartDataRequest(const std::string& path, | 26 virtual void StartDataRequest( |
29 bool is_incognito, | 27 const std::string& path, |
30 int request_id) OVERRIDE; | 28 bool is_incognito, |
| 29 const content::URLDataSource::GotDataCallback& callback) OVERRIDE; |
31 virtual std::string GetMimeType(const std::string& path) const OVERRIDE; | 30 virtual std::string GetMimeType(const std::string& path) const OVERRIDE; |
32 | 31 |
33 // Send the response data. | 32 // Send the response data. |
34 void FinishDataRequest(const std::string& html, int request_id); | 33 void FinishDataRequest( |
| 34 const std::string& html, |
| 35 const content::URLDataSource::GotDataCallback& callback); |
35 | 36 |
36 Profile* profile() { return profile_; } | 37 Profile* profile() { return profile_; } |
37 | 38 |
38 private: | 39 private: |
39 virtual ~AboutUIHTMLSource(); | 40 virtual ~AboutUIHTMLSource(); |
40 | 41 |
41 std::string source_name_; | 42 std::string source_name_; |
42 Profile* profile_; | 43 Profile* profile_; |
43 | 44 |
44 DISALLOW_COPY_AND_ASSIGN(AboutUIHTMLSource); | 45 DISALLOW_COPY_AND_ASSIGN(AboutUIHTMLSource); |
(...skipping 12 matching lines...) Expand all Loading... |
57 | 58 |
58 // Helper functions | 59 // Helper functions |
59 void AppendHeader(std::string* output, int refresh, | 60 void AppendHeader(std::string* output, int refresh, |
60 const std::string& unescaped_title); | 61 const std::string& unescaped_title); |
61 void AppendBody(std::string *output); | 62 void AppendBody(std::string *output); |
62 void AppendFooter(std::string *output); | 63 void AppendFooter(std::string *output); |
63 | 64 |
64 } // namespace about_ui | 65 } // namespace about_ui |
65 | 66 |
66 #endif // CHROME_BROWSER_UI_WEBUI_ABOUT_UI_H_ | 67 #endif // CHROME_BROWSER_UI_WEBUI_ABOUT_UI_H_ |
OLD | NEW |