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

Side by Side Diff: chrome/renderer/chrome_content_renderer_client.cc

Issue 376033002: Adding MimeHandlerView. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@pending-zork-patch2
Patch Set: sync @tott Created 6 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
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/renderer/chrome_content_renderer_client.h" 5 #include "chrome/renderer/chrome_content_renderer_client.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/debug/crash_logging.h" 8 #include "base/debug/crash_logging.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/metrics/field_trial.h" 10 #include "base/metrics/field_trial.h"
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 return NULL; 508 return NULL;
509 509
510 const std::string extension_id = origin.host().utf8().data(); 510 const std::string extension_id = origin.host().utf8().data();
511 return extension_dispatcher_->extensions()->GetByID(extension_id); 511 return extension_dispatcher_->extensions()->GetByID(extension_id);
512 } 512 }
513 513
514 bool ChromeContentRendererClient::OverrideCreatePlugin( 514 bool ChromeContentRendererClient::OverrideCreatePlugin(
515 content::RenderFrame* render_frame, 515 content::RenderFrame* render_frame,
516 WebLocalFrame* frame, 516 WebLocalFrame* frame,
517 const WebPluginParams& params, 517 const WebPluginParams& params,
518 int* instance_id,
518 WebPlugin** plugin) { 519 WebPlugin** plugin) {
520 *instance_id = -1; // kInstanceIDNone.
519 std::string orig_mime_type = params.mimeType.utf8(); 521 std::string orig_mime_type = params.mimeType.utf8();
520 if (orig_mime_type == content::kBrowserPluginMimeType) { 522 if (orig_mime_type == content::kBrowserPluginMimeType) {
521 WebDocument document = frame->document(); 523 WebDocument document = frame->document();
522 const Extension* extension = 524 const Extension* extension =
523 GetExtensionByOrigin(document.securityOrigin()); 525 GetExtensionByOrigin(document.securityOrigin());
524 if (extension) { 526 if (extension) {
525 const extensions::APIPermission::ID perms[] = { 527 const extensions::APIPermission::ID perms[] = {
526 extensions::APIPermission::kAppView, 528 extensions::APIPermission::kAppView,
527 extensions::APIPermission::kWebView, 529 extensions::APIPermission::kWebView,
528 }; 530 };
529 for (size_t i = 0; i < arraysize(perms); ++i) { 531 for (size_t i = 0; i < arraysize(perms); ++i) {
530 if (extension->permissions_data()->HasAPIPermission(perms[i])) 532 if (extension->permissions_data()->HasAPIPermission(perms[i]))
531 return false; 533 return false;
532 } 534 }
533 } 535 }
534 } 536 }
535 537
536 ChromeViewHostMsg_GetPluginInfo_Output output; 538 ChromeViewHostMsg_GetPluginInfo_Output output;
537 #if defined(ENABLE_PLUGINS) 539 #if defined(ENABLE_PLUGINS)
538 render_frame->Send(new ChromeViewHostMsg_GetPluginInfo( 540 render_frame->Send(new ChromeViewHostMsg_GetPluginInfo(
539 render_frame->GetRoutingID(), GURL(params.url), 541 render_frame->GetRoutingID(), GURL(params.url),
540 frame->top()->document().url(), orig_mime_type, &output)); 542 frame->top()->document().url(), orig_mime_type, &output));
541 543
542 if (output.plugin.type == content::WebPluginInfo::PLUGIN_TYPE_BROWSER_PLUGIN) 544 if (output.plugin.type ==
545 content::WebPluginInfo::PLUGIN_TYPE_BROWSER_PLUGIN) {
546 *instance_id = output.instance_id;
543 return false; 547 return false;
548 }
544 #else 549 #else
545 output.status.value = ChromeViewHostMsg_GetPluginInfo_Status::kNotFound; 550 output.status.value = ChromeViewHostMsg_GetPluginInfo_Status::kNotFound;
546 #endif 551 #endif
547 *plugin = CreatePlugin(render_frame, frame, params, output); 552 *plugin = CreatePlugin(render_frame, frame, params, output);
548 return true; 553 return true;
549 } 554 }
550 555
551 WebPlugin* ChromeContentRendererClient::CreatePluginReplacement( 556 WebPlugin* ChromeContentRendererClient::CreatePluginReplacement(
552 content::RenderFrame* render_frame, 557 content::RenderFrame* render_frame,
553 const base::FilePath& plugin_path) { 558 const base::FilePath& plugin_path) {
(...skipping 945 matching lines...) Expand 10 before | Expand all | Expand 10 after
1499 1504
1500 if (IsExtensionOrSharedModuleWhitelisted(url, allowed_video_decode_origins_)) 1505 if (IsExtensionOrSharedModuleWhitelisted(url, allowed_video_decode_origins_))
1501 return true; 1506 return true;
1502 1507
1503 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); 1508 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel();
1504 return channel <= chrome::VersionInfo::CHANNEL_DEV; 1509 return channel <= chrome::VersionInfo::CHANNEL_DEV;
1505 #else 1510 #else
1506 return false; 1511 return false;
1507 #endif 1512 #endif
1508 } 1513 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698