// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "webkit/support/test_webplugin_page_delegate.h"

#include "third_party/WebKit/Source/Platform/chromium/public/Platform.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h"

namespace webkit_support {

webkit::npapi::WebPluginDelegate*
TestWebPluginPageDelegate::CreatePluginDelegate(
    const base::FilePath& file_path,
    const std::string& mime_type) {
  webkit::npapi::WebPluginDelegateImpl* delegate =
      webkit::npapi::WebPluginDelegateImpl::Create(file_path, mime_type);
#if defined(OS_MACOSX) && !defined(USE_AURA)
  if (delegate)
    delegate->SetContainerVisibility(true);
#endif
  return delegate;
}

WebKit::WebPlugin* TestWebPluginPageDelegate::CreatePluginReplacement(
    const base::FilePath& file_path) {
  return NULL;
}

WebKit::WebCookieJar* TestWebPluginPageDelegate::GetCookieJar() {
  return WebKit::Platform::current()->cookieJar();
}

}  // namespace webkit_support


// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "webkit/support/test_webplugin_page_delegate.h"

#include "third_party/WebKit/Source/Platform/chromium/public/Platform.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h"

namespace webkit_support {

webkit::npapi::WebPluginDelegate*
TestWebPluginPageDelegate::CreatePluginDelegate(
    const base::FilePath& file_path,
    const std::string& mime_type) {
  return webkit::npapi::WebPluginDelegateImpl::Create(file_path, mime_type);
}

WebKit::WebPlugin* TestWebPluginPageDelegate::CreatePluginReplacement(
    const base::FilePath& file_path) {
  return NULL;
}

WebKit::WebCookieJar* TestWebPluginPageDelegate::GetCookieJar() {
  return WebKit::Platform::current()->cookieJar();
}

}  // namespace webkit_support


--- 
+++ 
@@ -13,7 +13,13 @@
 TestWebPluginPageDelegate::CreatePluginDelegate(
     const base::FilePath& file_path,
     const std::string& mime_type) {
-  return webkit::npapi::WebPluginDelegateImpl::Create(file_path, mime_type);
+  webkit::npapi::WebPluginDelegateImpl* delegate =
+      webkit::npapi::WebPluginDelegateImpl::Create(file_path, mime_type);
+#if defined(OS_MACOSX) && !defined(USE_AURA)
+  if (delegate)
+    delegate->SetContainerVisibility(true);
+#endif
+  return delegate;
 }
 
 WebKit::WebPlugin* TestWebPluginPageDelegate::CreatePluginReplacement(
Fix plugin visibility in DRT

Ensure that SetContainerVisibility is called on WebPluginDelegateImpls when they're created in DRT, or else their cliprects will be wrong.

BUG=168900


Review URL: https://chromiumcodereview.appspot.com/12382007

git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@185729 0039d316-1c4b-4281-b951-d872f2087c98
