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

Side by Side Diff: content/browser/appcache/appcache_internals_ui.cc

Issue 1995113002: Rename WebUI::CallJavascriptFunction to WebUI::CallJavascriptFunctionUnsafe (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "content/browser/appcache/appcache_internals_ui.h" 5 #include "content/browser/appcache/appcache_internals_ui.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 proxy->RequestFileDetails( 412 proxy->RequestFileDetails(
413 {manifest_url, ToInt64(group_id_str), ToInt64(response_id_str)}); 413 {manifest_url, ToInt64(group_id_str), ToInt64(response_id_str)});
414 } 414 }
415 415
416 void AppCacheInternalsUI::OnAllAppCacheInfoReady( 416 void AppCacheInternalsUI::OnAllAppCacheInfoReady(
417 scoped_refptr<AppCacheInfoCollection> collection, 417 scoped_refptr<AppCacheInfoCollection> collection,
418 const base::FilePath& partition_path) { 418 const base::FilePath& partition_path) {
419 std::string incognito_path_prefix; 419 std::string incognito_path_prefix;
420 if (browser_context()->IsOffTheRecord()) 420 if (browser_context()->IsOffTheRecord())
421 incognito_path_prefix = "Incognito "; 421 incognito_path_prefix = "Incognito ";
422 web_ui()->CallJavascriptFunction( 422 web_ui()->CallJavascriptFunctionUnsafe(
423 kFunctionOnAllAppCacheInfoReady, 423 kFunctionOnAllAppCacheInfoReady,
424 base::StringValue(incognito_path_prefix + partition_path.AsUTF8Unsafe()), 424 base::StringValue(incognito_path_prefix + partition_path.AsUTF8Unsafe()),
425 *GetListValueFromAppCacheInfoCollection(collection.get())); 425 *GetListValueFromAppCacheInfoCollection(collection.get()));
426 } 426 }
427 427
428 void AppCacheInternalsUI::OnAppCacheInfoDeleted( 428 void AppCacheInternalsUI::OnAppCacheInfoDeleted(
429 const base::FilePath& partition_path, 429 const base::FilePath& partition_path,
430 const std::string& manifest_url, 430 const std::string& manifest_url,
431 bool deleted) { 431 bool deleted) {
432 web_ui()->CallJavascriptFunction( 432 web_ui()->CallJavascriptFunctionUnsafe(
433 kFunctionOnAppCacheInfoDeleted, 433 kFunctionOnAppCacheInfoDeleted,
434 base::StringValue(partition_path.AsUTF8Unsafe()), 434 base::StringValue(partition_path.AsUTF8Unsafe()),
435 base::StringValue(manifest_url), base::FundamentalValue(deleted)); 435 base::StringValue(manifest_url), base::FundamentalValue(deleted));
436 } 436 }
437 437
438 void AppCacheInternalsUI::OnAppCacheDetailsReady( 438 void AppCacheInternalsUI::OnAppCacheDetailsReady(
439 const base::FilePath& partition_path, 439 const base::FilePath& partition_path,
440 const std::string& manifest_url, 440 const std::string& manifest_url,
441 std::unique_ptr<AppCacheResourceInfoVector> resource_info_vector) { 441 std::unique_ptr<AppCacheResourceInfoVector> resource_info_vector) {
442 if (resource_info_vector) { 442 if (resource_info_vector) {
443 web_ui()->CallJavascriptFunction( 443 web_ui()->CallJavascriptFunctionUnsafe(
444 kFunctionOnAppCacheDetailsReady, base::StringValue(manifest_url), 444 kFunctionOnAppCacheDetailsReady, base::StringValue(manifest_url),
445 base::StringValue(partition_path.AsUTF8Unsafe()), 445 base::StringValue(partition_path.AsUTF8Unsafe()),
446 *GetListValueForAppCacheResourceInfoVector(resource_info_vector.get())); 446 *GetListValueForAppCacheResourceInfoVector(resource_info_vector.get()));
447 } else { 447 } else {
448 web_ui()->CallJavascriptFunction( 448 web_ui()->CallJavascriptFunctionUnsafe(
449 kFunctionOnAppCacheDetailsReady, base::StringValue(manifest_url), 449 kFunctionOnAppCacheDetailsReady, base::StringValue(manifest_url),
450 base::StringValue(partition_path.AsUTF8Unsafe())); 450 base::StringValue(partition_path.AsUTF8Unsafe()));
451 } 451 }
452 } 452 }
453 453
454 void AppCacheInternalsUI::OnFileDetailsReady( 454 void AppCacheInternalsUI::OnFileDetailsReady(
455 const Proxy::ResponseEnquiry& response_enquiry, 455 const Proxy::ResponseEnquiry& response_enquiry,
456 scoped_refptr<AppCacheResponseInfo> response_info, 456 scoped_refptr<AppCacheResponseInfo> response_info,
457 scoped_refptr<net::IOBuffer> response_data, 457 scoped_refptr<net::IOBuffer> response_data,
458 int data_length) { 458 int data_length) {
(...skipping 17 matching lines...) Expand all
476 } else { 476 } else {
477 headers.append("Failed to read response headers. <br>"); 477 headers.append("Failed to read response headers. <br>");
478 } 478 }
479 std::string hex_dump = base::StringPrintf( 479 std::string hex_dump = base::StringPrintf(
480 "<hr><pre> Showing %d of %d bytes\n\n", static_cast<int>(data_length), 480 "<hr><pre> Showing %d of %d bytes\n\n", static_cast<int>(data_length),
481 static_cast<int>(response_info->response_data_size())); 481 static_cast<int>(response_info->response_data_size()));
482 net::ViewCacheHelper::HexDump(response_data->data(), data_length, &hex_dump); 482 net::ViewCacheHelper::HexDump(response_data->data(), data_length, &hex_dump);
483 if (data_length < response_info->response_data_size()) 483 if (data_length < response_info->response_data_size())
484 hex_dump.append("\nNote: data is truncated..."); 484 hex_dump.append("\nNote: data is truncated...");
485 hex_dump.append("</pre>"); 485 hex_dump.append("</pre>");
486 web_ui()->CallJavascriptFunction( 486 web_ui()->CallJavascriptFunctionUnsafe(
487 kFunctionOnFileDetailsReady, 487 kFunctionOnFileDetailsReady,
488 *GetDictionaryValueForResponseEnquiry(response_enquiry), 488 *GetDictionaryValueForResponseEnquiry(response_enquiry),
489 base::StringValue(headers), base::StringValue(hex_dump)); 489 base::StringValue(headers), base::StringValue(hex_dump));
490 } 490 }
491 491
492 void AppCacheInternalsUI::OnFileDetailsFailed( 492 void AppCacheInternalsUI::OnFileDetailsFailed(
493 const Proxy::ResponseEnquiry& response_enquiry, 493 const Proxy::ResponseEnquiry& response_enquiry,
494 int net_result_code) { 494 int net_result_code) {
495 web_ui()->CallJavascriptFunction( 495 web_ui()->CallJavascriptFunctionUnsafe(
496 kFunctionOnFileDetailsFailed, 496 kFunctionOnFileDetailsFailed,
497 *GetDictionaryValueForResponseEnquiry(response_enquiry), 497 *GetDictionaryValueForResponseEnquiry(response_enquiry),
498 base::FundamentalValue(net_result_code)); 498 base::FundamentalValue(net_result_code));
499 } 499 }
500 500
501 AppCacheInternalsUI::Proxy* AppCacheInternalsUI::GetProxyForPartitionPath( 501 AppCacheInternalsUI::Proxy* AppCacheInternalsUI::GetProxyForPartitionPath(
502 const base::FilePath& partition_path) { 502 const base::FilePath& partition_path) {
503 for (const scoped_refptr<Proxy>& proxy : appcache_proxies_) { 503 for (const scoped_refptr<Proxy>& proxy : appcache_proxies_) {
504 if (proxy->partition_path_ == partition_path) 504 if (proxy->partition_path_ == partition_path)
505 return proxy.get(); 505 return proxy.get();
506 } 506 }
507 NOTREACHED(); 507 NOTREACHED();
508 return nullptr; 508 return nullptr;
509 } 509 }
510 510
511 } // namespace content 511 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/accessibility/accessibility_ui.cc ('k') | content/browser/gpu/gpu_internals_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698