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

Side by Side Diff: chrome/renderer/plugins/plugin_placeholder.cc

Issue 11066043: Block NPAPI plug-ins in Metro mode instead of not loading them at all. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 2 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/renderer/plugins/plugin_placeholder.h" 5 #include "chrome/renderer/plugins/plugin_placeholder.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/json/string_escape.h" 9 #include "base/json/string_escape.h"
10 #include "base/string_piece.h" 10 #include "base/string_piece.h"
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 void PluginPlaceholder::LoadPlugin() { 550 void PluginPlaceholder::LoadPlugin() {
551 // This is not strictly necessary but is an important defense in case the 551 // This is not strictly necessary but is an important defense in case the
552 // event propagation changes between "close" vs. "click-to-play". 552 // event propagation changes between "close" vs. "click-to-play".
553 if (hidden_) 553 if (hidden_)
554 return; 554 return;
555 if (!allow_loading_) { 555 if (!allow_loading_) {
556 NOTREACHED(); 556 NOTREACHED();
557 return; 557 return;
558 } 558 }
559 559
560 if (status_->value ==
561 ChromeViewHostMsg_GetPluginInfo_Status::kNpapiNotSupported) {
562 #if defined(OS_WIN)
563 RenderThread::Get()->RecordUserMetrics("Metro_RestartOnDesktop_Plugin");
564 RenderThread::Get()->Send(
cpu_(ooo_6.6-7.5) 2012/10/18 00:42:59 we need a person from sec-team to approve this.
Bernhard Bauer 2012/10/18 09:13:57 Chris, what's your opinion?
565 new ChromeViewHostMsg_RestartInDesktopMode(routing_id()));
566 return;
567 #else
568 NOTREACHED();
569 #endif
570 }
571
560 // TODO(mmenke): In the case of prerendering, feed into 572 // TODO(mmenke): In the case of prerendering, feed into
561 // ChromeContentRendererClient::CreatePlugin instead, to 573 // ChromeContentRendererClient::CreatePlugin instead, to
562 // reduce the chance of future regressions. 574 // reduce the chance of future regressions.
563 WebPlugin* plugin = 575 WebPlugin* plugin =
564 render_view()->CreatePlugin(frame_, plugin_info_, plugin_params_); 576 render_view()->CreatePlugin(frame_, plugin_info_, plugin_params_);
565 ReplacePlugin(plugin); 577 ReplacePlugin(plugin);
566 } 578 }
567 579
568 void PluginPlaceholder::LoadCallback(const CppArgumentList& args, 580 void PluginPlaceholder::LoadCallback(const CppArgumentList& args,
569 CppVariant* result) { 581 CppVariant* result) {
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 bool PluginPlaceholder::IsYouTubeURL(const GURL& url, 642 bool PluginPlaceholder::IsYouTubeURL(const GURL& url,
631 const std::string& mime_type) { 643 const std::string& mime_type) {
632 std::string host = url.host(); 644 std::string host = url.host();
633 bool is_youtube = EndsWith(host, "youtube.com", true) || 645 bool is_youtube = EndsWith(host, "youtube.com", true) ||
634 EndsWith(host, "youtube-nocookie.com", true); 646 EndsWith(host, "youtube-nocookie.com", true);
635 647
636 return is_youtube && IsValidYouTubeVideo(url.path()) && 648 return is_youtube && IsValidYouTubeVideo(url.path()) &&
637 LowerCaseEqualsASCII(mime_type, kFlashPluginSwfMimeType); 649 LowerCaseEqualsASCII(mime_type, kFlashPluginSwfMimeType);
638 } 650 }
639 #endif 651 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698