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_ui.h" |
6 | 6 |
7 #include "base/memory/ref_counted_memory.h" | 7 #include "base/memory/ref_counted_memory.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 10 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
11 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" | 11 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" |
12 #include "chrome/browser/ui/webui/media_internals_proxy.h" | |
12 #include "chrome/common/jstemplate_builder.h" | 13 #include "chrome/common/jstemplate_builder.h" |
13 #include "chrome/common/url_constants.h" | 14 #include "chrome/common/url_constants.h" |
14 #include "grit/browser_resources.h" | 15 #include "grit/browser_resources.h" |
15 #include "ui/base/resource/resource_bundle.h" | 16 #include "ui/base/resource/resource_bundle.h" |
16 | 17 |
17 namespace { | 18 namespace { |
18 | 19 |
19 class MediaInternalsHTMLSource : public ChromeURLDataManager::DataSource { | 20 class MediaInternalsHTMLSource : public ChromeURLDataManager::DataSource { |
20 public: | 21 public: |
21 MediaInternalsHTMLSource(); | 22 MediaInternalsHTMLSource(); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
64 SendResponse(request_id, bytes); | 65 SendResponse(request_id, bytes); |
65 } | 66 } |
66 | 67 |
67 std::string MediaInternalsHTMLSource::GetMimeType( | 68 std::string MediaInternalsHTMLSource::GetMimeType( |
68 const std::string& path) const { | 69 const std::string& path) const { |
69 return "text/html"; | 70 return "text/html"; |
70 } | 71 } |
71 | 72 |
72 } // namespace | 73 } // namespace |
73 | 74 |
74 | |
75 //////////////////////////////////////////////////////////////////////////////// | 75 //////////////////////////////////////////////////////////////////////////////// |
76 // | 76 // |
77 // MediaInternalsUI | 77 // MediaInternalsUI |
78 // | 78 // |
79 //////////////////////////////////////////////////////////////////////////////// | 79 //////////////////////////////////////////////////////////////////////////////// |
80 | 80 |
81 MediaInternalsUI::MediaInternalsUI(TabContents* contents) | 81 MediaInternalsUI::MediaInternalsUI(TabContents* contents) |
82 : ChromeWebUI(contents) { | 82 : ChromeWebUI(contents), |
83 proxy_(new MediaInternalsProxy()) { | |
83 contents->profile()->GetChromeURLDataManager()->AddDataSource( | 84 contents->profile()->GetChromeURLDataManager()->AddDataSource( |
84 new MediaInternalsHTMLSource()); | 85 new MediaInternalsHTMLSource()); |
86 proxy_->AttachUI(this); | |
85 } | 87 } |
86 | 88 |
89 MediaInternalsUI::~MediaInternalsUI() { | |
90 proxy_->DetachUI(); | |
91 } | |
92 | |
93 void MediaInternalsUI::OnWebUISend(const GURL& source_url, | |
Evan Stade
2011/06/29 20:13:01
what is this? I dont see docs for OnWebUISend anyw
Scott Franklin
2011/06/29 23:47:08
It's defined in content/browser/webui/webui.h. I p
| |
94 const std::string& name, | |
95 const ListValue& content) { | |
96 if (name == "getAll") | |
97 proxy_->GetEverything(); | |
98 } | |
99 | |
100 void MediaInternalsUI::OnUpdate(const string16& update) { | |
101 ExecuteJavascript(update); | |
102 } | |
OLD | NEW |