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/media_internals_ui.h" | 5 #include "chrome/browser/ui/webui/media_internals/media_internals_ui.h" |
6 | 6 |
7 #include "base/memory/ref_counted_memory.h" | |
8 #include "base/values.h" | 7 #include "base/values.h" |
9 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 9 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
11 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" | 10 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" |
11 #include "chrome/browser/ui/webui/media_internals/media_internals_handler.h" | |
12 #include "chrome/common/jstemplate_builder.h" | 12 #include "chrome/common/jstemplate_builder.h" |
13 #include "chrome/common/url_constants.h" | 13 #include "chrome/common/url_constants.h" |
14 #include "grit/browser_resources.h" | 14 #include "grit/browser_resources.h" |
15 #include "ui/base/resource/resource_bundle.h" | 15 #include "ui/base/resource/resource_bundle.h" |
16 | 16 |
17 namespace { | 17 namespace { |
18 | 18 |
19 class MediaInternalsHTMLSource : public ChromeURLDataManager::DataSource { | 19 class MediaInternalsHTMLSource : public ChromeURLDataManager::DataSource { |
Evan Stade
2011/07/07 20:42:43
yes this is fine to have here
| |
20 public: | 20 public: |
21 MediaInternalsHTMLSource(); | 21 MediaInternalsHTMLSource(); |
22 | 22 |
23 // Called when the network layer has requested a resource underneath | 23 // Called when the network layer has requested a resource underneath |
24 // the path we registered. | 24 // the path we registered. |
25 virtual void StartDataRequest(const std::string& path, | 25 virtual void StartDataRequest(const std::string& path, |
26 bool is_incognito, | 26 bool is_incognito, |
27 int request_id); | 27 int request_id); |
28 virtual std::string GetMimeType(const std::string& path) const; | 28 virtual std::string GetMimeType(const std::string& path) const; |
29 | 29 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
62 std::copy(html.begin(), html.end(), bytes->data.begin()); | 62 std::copy(html.begin(), html.end(), bytes->data.begin()); |
63 | 63 |
64 SendResponse(request_id, bytes); | 64 SendResponse(request_id, bytes); |
65 } | 65 } |
66 | 66 |
67 std::string MediaInternalsHTMLSource::GetMimeType( | 67 std::string MediaInternalsHTMLSource::GetMimeType( |
68 const std::string& path) const { | 68 const std::string& path) const { |
69 return "text/html"; | 69 return "text/html"; |
70 } | 70 } |
71 | 71 |
72 } // namespace | 72 } // namespace |
73 | |
74 | 73 |
75 //////////////////////////////////////////////////////////////////////////////// | 74 //////////////////////////////////////////////////////////////////////////////// |
76 // | 75 // |
77 // MediaInternalsUI | 76 // MediaInternalsUI |
78 // | 77 // |
79 //////////////////////////////////////////////////////////////////////////////// | 78 //////////////////////////////////////////////////////////////////////////////// |
80 | 79 |
81 MediaInternalsUI::MediaInternalsUI(TabContents* contents) | 80 MediaInternalsUI::MediaInternalsUI(TabContents* contents) |
82 : ChromeWebUI(contents) { | 81 : ChromeWebUI(contents) { |
82 AddMessageHandler((new MediaInternalsMessageHandler())->Attach(this)); | |
83 | |
83 contents->profile()->GetChromeURLDataManager()->AddDataSource( | 84 contents->profile()->GetChromeURLDataManager()->AddDataSource( |
84 new MediaInternalsHTMLSource()); | 85 new MediaInternalsHTMLSource()); |
85 } | 86 } |
86 | |
OLD | NEW |