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

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

Issue 16290004: Update chrome/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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) 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/nacl_ui.h" 5 #include "chrome/browser/ui/webui/nacl_ui.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 page_has_requested_data_(false), 185 page_has_requested_data_(false),
186 has_plugin_info_(false), 186 has_plugin_info_(false),
187 pnacl_path_validated_(false), 187 pnacl_path_validated_(false),
188 pnacl_path_exists_(false), 188 pnacl_path_exists_(false),
189 proxy_(new NaClDomHandlerProxy(this)) { 189 proxy_(new NaClDomHandlerProxy(this)) {
190 PluginService::GetInstance()->GetPlugins(base::Bind( 190 PluginService::GetInstance()->GetPlugins(base::Bind(
191 &NaClDomHandler::OnGotPlugins, weak_ptr_factory_.GetWeakPtr())); 191 &NaClDomHandler::OnGotPlugins, weak_ptr_factory_.GetWeakPtr()));
192 } 192 }
193 193
194 NaClDomHandler::~NaClDomHandler() { 194 NaClDomHandler::~NaClDomHandler() {
195 if (proxy_) 195 if (proxy_.get())
196 proxy_->set_handler(NULL); 196 proxy_->set_handler(NULL);
197 } 197 }
198 198
199 void NaClDomHandler::RegisterMessages() { 199 void NaClDomHandler::RegisterMessages() {
200 web_ui()->RegisterMessageCallback( 200 web_ui()->RegisterMessageCallback(
201 "requestNaClInfo", 201 "requestNaClInfo",
202 base::Bind(&NaClDomHandler::HandleRequestNaClInfo, 202 base::Bind(&NaClDomHandler::HandleRequestNaClInfo,
203 base::Unretained(this))); 203 base::Unretained(this)));
204 } 204 }
205 205
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 MaybeRespondToPage(); 342 MaybeRespondToPage();
343 } 343 }
344 344
345 void NaClDomHandler::MaybeRespondToPage() { 345 void NaClDomHandler::MaybeRespondToPage() {
346 // Don't reply until everything is ready. The page will show a 'loading' 346 // Don't reply until everything is ready. The page will show a 'loading'
347 // message until then. 347 // message until then.
348 if (!page_has_requested_data_ || !has_plugin_info_) 348 if (!page_has_requested_data_ || !has_plugin_info_)
349 return; 349 return;
350 350
351 if (!pnacl_path_validated_) { 351 if (!pnacl_path_validated_) {
352 DCHECK(proxy_); 352 DCHECK(proxy_.get());
353 proxy_->ValidatePnaclPath(); 353 proxy_->ValidatePnaclPath();
354 return; 354 return;
355 } 355 }
356 356
357 DictionaryValue naclInfo; 357 DictionaryValue naclInfo;
358 PopulatePageInformation(&naclInfo); 358 PopulatePageInformation(&naclInfo);
359 web_ui()->CallJavascriptFunction("nacl.returnNaClInfo", naclInfo); 359 web_ui()->CallJavascriptFunction("nacl.returnNaClInfo", naclInfo);
360 } 360 }
361 361
362 } // namespace 362 } // namespace
363 363
364 /////////////////////////////////////////////////////////////////////////////// 364 ///////////////////////////////////////////////////////////////////////////////
365 // 365 //
366 // NaClUI 366 // NaClUI
367 // 367 //
368 /////////////////////////////////////////////////////////////////////////////// 368 ///////////////////////////////////////////////////////////////////////////////
369 369
370 NaClUI::NaClUI(content::WebUI* web_ui) : WebUIController(web_ui) { 370 NaClUI::NaClUI(content::WebUI* web_ui) : WebUIController(web_ui) {
371 content::RecordAction(UserMetricsAction("ViewAboutNaCl")); 371 content::RecordAction(UserMetricsAction("ViewAboutNaCl"));
372 372
373 web_ui->AddMessageHandler(new NaClDomHandler()); 373 web_ui->AddMessageHandler(new NaClDomHandler());
374 374
375 // Set up the about:nacl source. 375 // Set up the about:nacl source.
376 Profile* profile = Profile::FromWebUI(web_ui); 376 Profile* profile = Profile::FromWebUI(web_ui);
377 content::WebUIDataSource::Add(profile, CreateNaClUIHTMLSource()); 377 content::WebUIDataSource::Add(profile, CreateNaClUIHTMLSource());
378 } 378 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/inspect_ui.cc ('k') | chrome/browser/ui/webui/net_internals/net_internals_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698