Moving the ViewHostMsg_PDFHasUnsupportedFeature IPC message to Chrome as PDF is a chrome specific
feature. Removed the HasUnsupportedFeature method from the pepper PluginDelegate interface as
it is only needed for PDF.

BUG=87335
Review URL: http://codereview.chromium.org/7709020

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@97890 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc b/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc
index f5519ea..a8d396d 100644
--- a/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc
+++ b/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc
@@ -433,7 +433,7 @@
     IPC_MESSAGE_HANDLER(ViewHostMsg_WebIntentDispatch,
                         OnWebIntentDispatch)
     IPC_MESSAGE_HANDLER(ChromeViewHostMsg_Snapshot, OnSnapshot)
-    IPC_MESSAGE_HANDLER(ViewHostMsg_PDFHasUnsupportedFeature,
+    IPC_MESSAGE_HANDLER(ChromeViewHostMsg_PDFHasUnsupportedFeature,
                         OnPDFHasUnsupportedFeature)
     IPC_MESSAGE_HANDLER(ChromeViewHostMsg_DidBlockDisplayingInsecureContent,
                         OnDidBlockDisplayingInsecureContent)
diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h
index 63a8e7e..79ea807 100644
--- a/chrome/common/render_messages.h
+++ b/chrome/common/render_messages.h
@@ -288,6 +288,14 @@
 IPC_MESSAGE_ROUTED1(ChromeViewMsg_SetClientSidePhishingDetection,
                     bool /* enable_phishing_detection */)
 
+// JavaScript related messages -----------------------------------------------
+
+// Notify the JavaScript engine in the render to change its parameters
+// while performing stress testing.
+IPC_MESSAGE_ROUTED2(ChromeViewMsg_JavaScriptStressTestControl,
+                    int /* cmd */,
+                    int /* param */)
+
 //-----------------------------------------------------------------------------
 // TabContents messages
 // These are messages sent from the renderer to the browser process.
@@ -520,10 +528,6 @@
                     int32 /* page_id */,
                     bool  /* result */)
 
-// JavaScript related messages -----------------------------------------------
+// The currently displayed PDF has an unsupported feature.
+IPC_MESSAGE_ROUTED0(ChromeViewHostMsg_PDFHasUnsupportedFeature)
 
-// Notify the JavaScript engine in the render to change its parameters
-// while performing stress testing.
-IPC_MESSAGE_ROUTED2(ChromeViewMsg_JavaScriptStressTestControl,
-                    int /* cmd */,
-                    int /* param */)
diff --git a/chrome/renderer/chrome_ppb_pdf_impl.cc b/chrome/renderer/chrome_ppb_pdf_impl.cc
index 8f4f31a..053bfa85 100644
--- a/chrome/renderer/chrome_ppb_pdf_impl.cc
+++ b/chrome/renderer/chrome_ppb_pdf_impl.cc
@@ -7,7 +7,9 @@
 #include "base/metrics/histogram.h"
 #include "base/utf_string_conversions.h"
 #include "build/build_config.h"
+#include "chrome/common/render_messages.h"
 #include "content/common/view_messages.h"
+#include "content/renderer/pepper_plugin_delegate_impl.h"
 #include "content/renderer/render_thread.h"
 #include "grit/webkit_resources.h"
 #include "grit/webkit_strings.h"
@@ -320,7 +322,12 @@
   if (!instance->IsFullPagePlugin())
     return;
 
-  instance->delegate()->HasUnsupportedFeature();
+  PepperPluginDelegateImpl* pepper_delegate =
+      static_cast<PepperPluginDelegateImpl*>(instance->delegate());
+
+  RenderThread::current()->Send(
+      new ChromeViewHostMsg_PDFHasUnsupportedFeature(
+          pepper_delegate->GetRoutingId()));
 }
 
 void SaveAs(PP_Instance instance_id) {
diff --git a/content/common/view_messages.h b/content/common/view_messages.h
index c49dcab..ec0b328 100644
--- a/content/common/view_messages.h
+++ b/content/common/view_messages.h
@@ -2010,9 +2010,6 @@
 IPC_MESSAGE_ROUTED1(ViewHostMsg_UpdateContentRestrictions,
                     int /* restrictions */)
 
-// The currently displayed PDF has an unsupported feature.
-IPC_MESSAGE_ROUTED0(ViewHostMsg_PDFHasUnsupportedFeature)
-
 // Brings up SaveAs... dialog to save specified URL.
 IPC_MESSAGE_ROUTED1(ViewHostMsg_SaveURLAs,
                     GURL /* url */)
diff --git a/content/renderer/pepper_plugin_delegate_impl.cc b/content/renderer/pepper_plugin_delegate_impl.cc
index 0476e53..b8d3777 100644
--- a/content/renderer/pepper_plugin_delegate_impl.cc
+++ b/content/renderer/pepper_plugin_delegate_impl.cc
@@ -1422,11 +1422,6 @@
       render_view_->routing_id(), restrictions));
 }
 
-void PepperPluginDelegateImpl::HasUnsupportedFeature() {
-  render_view_->Send(new ViewHostMsg_PDFHasUnsupportedFeature(
-      render_view_->routing_id()));
-}
-
 void PepperPluginDelegateImpl::SaveURLAs(const GURL& url) {
   render_view_->Send(new ViewHostMsg_SaveURLAs(
       render_view_->routing_id(), url));
@@ -1477,6 +1472,10 @@
   return ppapi::Preferences(render_view_->webkit_preferences());
 }
 
+int PepperPluginDelegateImpl::GetRoutingId() const {
+  return render_view_->routing_id();
+}
+
 void PepperPluginDelegateImpl::PublishInitialPolicy(
     scoped_refptr<webkit::ppapi::PluginInstance> instance,
     const std::string& policy) {
diff --git a/content/renderer/pepper_plugin_delegate_impl.h b/content/renderer/pepper_plugin_delegate_impl.h
index 74c4019..df97cf8 100644
--- a/content/renderer/pepper_plugin_delegate_impl.h
+++ b/content/renderer/pepper_plugin_delegate_impl.h
@@ -294,7 +294,6 @@
   virtual void DidStartLoading() OVERRIDE;
   virtual void DidStopLoading() OVERRIDE;
   virtual void SetContentRestriction(int restrictions) OVERRIDE;
-  virtual void HasUnsupportedFeature() OVERRIDE;
   virtual void SaveURLAs(const GURL& url) OVERRIDE;
   virtual P2PSocketDispatcher* GetP2PSocketDispatcher() OVERRIDE;
   virtual webkit_glue::P2PTransport* CreateP2PTransport() OVERRIDE;
@@ -304,6 +303,8 @@
       OVERRIDE;
   virtual ::ppapi::Preferences GetPreferences() OVERRIDE;
 
+  int GetRoutingId() const;
+
  private:
   void PublishInitialPolicy(
       scoped_refptr<webkit::ppapi::PluginInstance> instance,
diff --git a/webkit/plugins/ppapi/mock_plugin_delegate.cc b/webkit/plugins/ppapi/mock_plugin_delegate.cc
index 543c21e..dab69dc 100644
--- a/webkit/plugins/ppapi/mock_plugin_delegate.cc
+++ b/webkit/plugins/ppapi/mock_plugin_delegate.cc
@@ -256,9 +256,6 @@
 void MockPluginDelegate::SetContentRestriction(int restrictions) {
 }
 
-void MockPluginDelegate::HasUnsupportedFeature() {
-}
-
 void MockPluginDelegate::SaveURLAs(const GURL& url) {
 }
 
diff --git a/webkit/plugins/ppapi/mock_plugin_delegate.h b/webkit/plugins/ppapi/mock_plugin_delegate.h
index 3d4a034..8a4be75 100644
--- a/webkit/plugins/ppapi/mock_plugin_delegate.h
+++ b/webkit/plugins/ppapi/mock_plugin_delegate.h
@@ -111,7 +111,6 @@
   virtual void DidStartLoading();
   virtual void DidStopLoading();
   virtual void SetContentRestriction(int restrictions);
-  virtual void HasUnsupportedFeature();
   virtual void SaveURLAs(const GURL& url);
   virtual P2PSocketDispatcher* GetP2PSocketDispatcher();
   virtual webkit_glue::P2PTransport* CreateP2PTransport();
diff --git a/webkit/plugins/ppapi/plugin_delegate.h b/webkit/plugins/ppapi/plugin_delegate.h
index fcbf2963..c0bb662 100644
--- a/webkit/plugins/ppapi/plugin_delegate.h
+++ b/webkit/plugins/ppapi/plugin_delegate.h
@@ -418,9 +418,6 @@
   // Sets restrictions on how the content can be used (i.e. no print/copy).
   virtual void SetContentRestriction(int restrictions) = 0;
 
-  // Tells the browser that the PDF has an unsupported feature.
-  virtual void HasUnsupportedFeature() = 0;
-
   // Tells the browser to bring up SaveAs dialog to save specified URL.
   virtual void SaveURLAs(const GURL& url) = 0;