Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(233)

Side by Side Diff: chrome/browser/ui/webui/media_internals_ui.cc

Issue 7272036: Make MediaInternalsUI talk to MediaInternals. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Moving MediaInternalsProxy to its own file. Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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()) {
scherkus (not reviewing) 2011/06/29 17:55:12 re: pass in UI in ctor, you'll probably have to us
83 contents->profile()->GetChromeURLDataManager()->AddDataSource( 84 contents->profile()->GetChromeURLDataManager()->AddDataSource(
84 new MediaInternalsHTMLSource()); 85 new MediaInternalsHTMLSource());
86 proxy_->SetUI(this);
85 } 87 }
86 88
89 MediaInternalsUI::~MediaInternalsUI() {
90 proxy_->RemoveUI();
91 }
92
93 void MediaInternalsUI::OnWebUISend(const GURL& source_url,
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698