summaryrefslogtreecommitdiffstats
path: root/webkit/plugins
diff options
context:
space:
mode:
authorthestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-27 22:49:23 +0000
committerthestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-27 22:49:23 +0000
commit3b91edbe092913447750a7e9fd9ee6e6365808a6 (patch)
tree60943423e9ed686fc3c9cbacd00dbda140bdfaa5 /webkit/plugins
parent544911b27983d73704e1caa31e0f9a851d748cb2 (diff)
downloadchromium_src-3b91edbe092913447750a7e9fd9ee6e6365808a6.zip
chromium_src-3b91edbe092913447750a7e9fd9ee6e6365808a6.tar.gz
chromium_src-3b91edbe092913447750a7e9fd9ee6e6365808a6.tar.bz2
Cleanup WebPluginDelegate implementations.
Review URL: https://chromiumcodereview.appspot.com/10983059 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@159140 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/plugins')
-rw-r--r--webkit/plugins/npapi/plugin_constants_win.h4
-rw-r--r--webkit/plugins/npapi/plugin_list.cc7
-rw-r--r--webkit/plugins/npapi/webplugin_delegate_impl.cc5
-rw-r--r--webkit/plugins/npapi/webplugin_delegate_impl_android.cc3
-rw-r--r--webkit/plugins/npapi/webplugin_delegate_impl_aura.cc22
-rw-r--r--webkit/plugins/npapi/webplugin_delegate_impl_gtk.cc42
-rw-r--r--webkit/plugins/npapi/webplugin_delegate_impl_mac.mm17
-rw-r--r--webkit/plugins/npapi/webplugin_delegate_impl_win.cc16
-rw-r--r--webkit/plugins/npapi/webplugin_impl.cc34
9 files changed, 55 insertions, 95 deletions
diff --git a/webkit/plugins/npapi/plugin_constants_win.h b/webkit/plugins/npapi/plugin_constants_win.h
index 2ef80fe..f683b6e 100644
--- a/webkit/plugins/npapi/plugin_constants_win.h
+++ b/webkit/plugins/npapi/plugin_constants_win.h
@@ -8,6 +8,10 @@
#include "base/string16.h"
#include "webkit/plugins/webkit_plugins_export.h"
+#if !defined(OS_WIN)
+#error "Windows-only header"
+#endif
+
namespace webkit {
namespace npapi {
diff --git a/webkit/plugins/npapi/plugin_list.cc b/webkit/plugins/npapi/plugin_list.cc
index e87490c..cb36398 100644
--- a/webkit/plugins/npapi/plugin_list.cc
+++ b/webkit/plugins/npapi/plugin_list.cc
@@ -16,10 +16,13 @@
#include "googleurl/src/gurl.h"
#include "net/base/mime_util.h"
#include "webkit/glue/webkit_glue.h"
-#include "webkit/plugins/npapi/plugin_constants_win.h"
#include "webkit/plugins/npapi/plugin_lib.h"
#include "webkit/plugins/plugin_switches.h"
+#if defined(OS_WIN)
+#include "webkit/plugins/npapi/plugin_constants_win.h"
+#endif
+
namespace {
using webkit::npapi::PluginList;
@@ -51,7 +54,7 @@ bool AllowMimeTypeMismatch(const std::string& orig_mime_type,
return allow;
}
-}
+} // namespace
namespace webkit {
namespace npapi {
diff --git a/webkit/plugins/npapi/webplugin_delegate_impl.cc b/webkit/plugins/npapi/webplugin_delegate_impl.cc
index c2c7697..09031bf 100644
--- a/webkit/plugins/npapi/webplugin_delegate_impl.cc
+++ b/webkit/plugins/npapi/webplugin_delegate_impl.cc
@@ -7,23 +7,18 @@
#include <string>
#include <vector>
-#include "base/file_util.h"
#include "base/memory/scoped_ptr.h"
#include "base/message_loop.h"
#include "base/process_util.h"
#include "base/string_util.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
#include "webkit/glue/webkit_glue.h"
-#include "webkit/plugins/npapi/plugin_constants_win.h"
#include "webkit/plugins/npapi/plugin_instance.h"
#include "webkit/plugins/npapi/plugin_lib.h"
-#include "webkit/plugins/npapi/plugin_list.h"
#include "webkit/plugins/npapi/plugin_stream_url.h"
using WebKit::WebCursorInfo;
-using WebKit::WebKeyboardEvent;
using WebKit::WebInputEvent;
-using WebKit::WebMouseEvent;
namespace webkit {
namespace npapi {
diff --git a/webkit/plugins/npapi/webplugin_delegate_impl_android.cc b/webkit/plugins/npapi/webplugin_delegate_impl_android.cc
index 2abce77..65ea6c4 100644
--- a/webkit/plugins/npapi/webplugin_delegate_impl_android.cc
+++ b/webkit/plugins/npapi/webplugin_delegate_impl_android.cc
@@ -6,11 +6,8 @@
#include "base/basictypes.h"
#include "base/logging.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
#include "webkit/plugins/npapi/plugin_instance.h"
#include "webkit/plugins/npapi/webplugin.h"
-#include "webkit/glue/webkit_glue.h"
using WebKit::WebCursorInfo;
using WebKit::WebInputEvent;
diff --git a/webkit/plugins/npapi/webplugin_delegate_impl_aura.cc b/webkit/plugins/npapi/webplugin_delegate_impl_aura.cc
index e663306..9d8cabc 100644
--- a/webkit/plugins/npapi/webplugin_delegate_impl_aura.cc
+++ b/webkit/plugins/npapi/webplugin_delegate_impl_aura.cc
@@ -4,37 +4,17 @@
#include "webkit/plugins/npapi/webplugin_delegate_impl.h"
-#include "base/basictypes.h"
-#include "base/file_util.h"
-#include "base/message_loop.h"
-#include "base/process_util.h"
-#include "base/metrics/stats_counters.h"
-#include "base/string_util.h"
-#include "skia/ext/platform_canvas.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
-#include "ui/gfx/blit.h"
-#include "webkit/plugins/npapi/gtk_plugin_container.h"
-#include "webkit/plugins/npapi/plugin_constants_win.h"
#include "webkit/plugins/npapi/plugin_instance.h"
-#include "webkit/plugins/npapi/plugin_lib.h"
-#include "webkit/plugins/npapi/plugin_list.h"
-#include "webkit/plugins/npapi/plugin_stream_url.h"
-#include "webkit/plugins/npapi/webplugin.h"
-
-#include "third_party/npapi/bindings/npapi_x11.h"
using WebKit::WebCursorInfo;
-using WebKit::WebKeyboardEvent;
using WebKit::WebInputEvent;
-using WebKit::WebMouseEvent;
namespace webkit {
namespace npapi {
WebPluginDelegateImpl::WebPluginDelegateImpl(
gfx::PluginWindowHandle containing_view,
- PluginInstance *instance) {
+ PluginInstance* instance) {
}
WebPluginDelegateImpl::~WebPluginDelegateImpl() {
diff --git a/webkit/plugins/npapi/webplugin_delegate_impl_gtk.cc b/webkit/plugins/npapi/webplugin_delegate_impl_gtk.cc
index aca78e8..52aa70b 100644
--- a/webkit/plugins/npapi/webplugin_delegate_impl_gtk.cc
+++ b/webkit/plugins/npapi/webplugin_delegate_impl_gtk.cc
@@ -4,30 +4,20 @@
#include "webkit/plugins/npapi/webplugin_delegate_impl.h"
-#include <string>
-#include <vector>
-
#include <gtk/gtk.h>
#include <gdk/gdkx.h>
-#include "base/basictypes.h"
-#include "base/file_util.h"
-#include "base/message_loop.h"
-#include "base/process_util.h"
+#include <string>
+#include <vector>
+
#include "base/metrics/stats_counters.h"
-#include "base/string_util.h"
#include "skia/ext/platform_canvas.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
#include "ui/base/gtk/gtk_compat.h"
#include "ui/gfx/blit.h"
-#include "webkit/plugins/npapi/gtk_plugin_container.h"
-#include "webkit/plugins/npapi/plugin_constants_win.h"
#include "webkit/plugins/npapi/plugin_instance.h"
-#include "webkit/plugins/npapi/plugin_lib.h"
-#include "webkit/plugins/npapi/plugin_list.h"
-#include "webkit/plugins/npapi/plugin_stream_url.h"
#include "webkit/plugins/npapi/webplugin.h"
+#include "webkit/plugins/plugin_constants.h"
#include "third_party/npapi/bindings/npapi_x11.h"
@@ -41,7 +31,7 @@ namespace npapi {
WebPluginDelegateImpl::WebPluginDelegateImpl(
gfx::PluginWindowHandle containing_view,
- PluginInstance *instance)
+ PluginInstance* instance)
: windowed_handle_(0),
windowed_did_set_window_(false),
windowless_(false),
@@ -61,7 +51,7 @@ WebPluginDelegateImpl::WebPluginDelegateImpl(
containing_view_has_focus_(true),
creation_succeeded_(false) {
memset(&window_, 0, sizeof(window_));
- if (instance_->mime_type() == "application/x-shockwave-flash") {
+ if (instance_->mime_type() == kFlashPluginSwfMimeType) {
// Flash is tied to Firefox's whacky behavior with windowless plugins. See
// comments in WindowlessPaint.
// TODO(viettrungluu): PLUGIN_QUIRK_WINDOWLESS_NO_RIGHT_CLICK: Don't allow
@@ -217,8 +207,6 @@ void WebPluginDelegateImpl::WindowedSetWindow() {
window_.width = window_rect_.width();
window_.x = window_rect_.x();
window_.y = window_rect_.y();
-
- //window_.window = windowed_handle_;
window_.type = NPWindowTypeWindow;
// Reset this flag before entering the instance in case of side-effects.
@@ -404,7 +392,7 @@ void WebPluginDelegateImpl::WindowlessPaint(cairo_t* context,
// Construct the paint message, targeting the pixmap.
NPEvent np_event = {0};
- XGraphicsExposeEvent &event = np_event.xgraphicsexpose;
+ XGraphicsExposeEvent& event = np_event.xgraphicsexpose;
event.type = GraphicsExpose;
event.x = pixmap_draw_rect.x();
event.y = pixmap_draw_rect.y();
@@ -505,7 +493,7 @@ void WebPluginDelegateImpl::WindowlessSetWindow() {
DCHECK(instance()->windowless());
// Mozilla docs say that this window param is not used for windowless
// plugins; rather, the window is passed during the GraphicsExpose event.
- DCHECK(window_.window == 0);
+ DCHECK_EQ(window_.window, static_cast<void*>(NULL));
window_.clipRect.top = clip_rect_.y() + window_rect_.y();
window_.clipRect.left = clip_rect_.x() + window_rect_.x();
@@ -543,7 +531,7 @@ bool WebPluginDelegateImpl::PlatformSetPluginHasFocus(bool focused) {
DCHECK(instance()->windowless());
NPEvent np_event = {0};
- XFocusChangeEvent &event = np_event.xfocus;
+ XFocusChangeEvent& event = np_event.xfocus;
event.type = focused ? FocusIn : FocusOut;
event.display = GDK_DISPLAY();
// Same values as Firefox. .serial and .window stay 0.
@@ -579,7 +567,7 @@ static int GetXModifierState(int modifiers) {
static bool NPEventFromWebMouseEvent(const WebMouseEvent& event,
Time timestamp,
- NPEvent *np_event) {
+ NPEvent* np_event) {
np_event->xany.display = GDK_DISPLAY();
// NOTE: Firefox keeps xany.serial and xany.window as 0.
@@ -589,7 +577,7 @@ static bool NPEventFromWebMouseEvent(const WebMouseEvent& event,
switch (event.type) {
case WebInputEvent::MouseMove: {
np_event->type = MotionNotify;
- XMotionEvent &motion_event = np_event->xmotion;
+ XMotionEvent& motion_event = np_event->xmotion;
motion_event.root = root;
motion_event.time = timestamp;
motion_event.x = event.x;
@@ -608,7 +596,7 @@ static bool NPEventFromWebMouseEvent(const WebMouseEvent& event,
} else {
np_event->type = LeaveNotify;
}
- XCrossingEvent &crossing_event = np_event->xcrossing;
+ XCrossingEvent& crossing_event = np_event->xcrossing;
crossing_event.root = root;
crossing_event.time = timestamp;
crossing_event.x = event.x;
@@ -632,7 +620,7 @@ static bool NPEventFromWebMouseEvent(const WebMouseEvent& event,
} else {
np_event->type = ButtonRelease;
}
- XButtonEvent &button_event = np_event->xbutton;
+ XButtonEvent& button_event = np_event->xbutton;
button_event.root = root;
button_event.time = timestamp;
button_event.x = event.x;
@@ -665,7 +653,7 @@ static bool NPEventFromWebMouseEvent(const WebMouseEvent& event,
static bool NPEventFromWebKeyboardEvent(const WebKeyboardEvent& event,
Time timestamp,
- NPEvent *np_event) {
+ NPEvent* np_event) {
np_event->xany.display = GDK_DISPLAY();
// NOTE: Firefox keeps xany.serial and xany.window as 0.
@@ -680,7 +668,7 @@ static bool NPEventFromWebKeyboardEvent(const WebKeyboardEvent& event,
NOTREACHED();
return false;
}
- XKeyEvent &key_event = np_event->xkey;
+ XKeyEvent& key_event = np_event->xkey;
key_event.send_event = False;
key_event.display = GDK_DISPLAY();
// NOTE: Firefox keeps xany.serial and xany.window as 0.
diff --git a/webkit/plugins/npapi/webplugin_delegate_impl_mac.mm b/webkit/plugins/npapi/webplugin_delegate_impl_mac.mm
index 165046c..ff23bcb 100644
--- a/webkit/plugins/npapi/webplugin_delegate_impl_mac.mm
+++ b/webkit/plugins/npapi/webplugin_delegate_impl_mac.mm
@@ -2,30 +2,25 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#import <Cocoa/Cocoa.h>
-#import <QuartzCore/QuartzCore.h>
-
#include "webkit/plugins/npapi/webplugin_delegate_impl.h"
-#include <string>
+#import <Cocoa/Cocoa.h>
+#import <QuartzCore/QuartzCore.h>
#include <unistd.h>
+
#include <set>
+#include <string>
-#include "base/file_util.h"
#include "base/mac/mac_util.h"
#include "base/memory/scoped_ptr.h"
-#include "base/message_loop.h"
#include "base/metrics/stats_counters.h"
#include "base/string_util.h"
-#include "base/utf_string_conversions.h"
#include "base/sys_string_conversions.h"
+#include "base/utf_string_conversions.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
#include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h"
-#include "webkit/glue/webkit_glue.h"
#include "webkit/plugins/npapi/plugin_instance.h"
#include "webkit/plugins/npapi/plugin_lib.h"
-#include "webkit/plugins/npapi/plugin_list.h"
-#include "webkit/plugins/npapi/plugin_stream_url.h"
#include "webkit/plugins/npapi/plugin_web_event_converter_mac.h"
#include "webkit/plugins/npapi/webplugin.h"
#include "webkit/plugins/npapi/webplugin_accelerated_surface_mac.h"
@@ -156,7 +151,7 @@ int ExternalDragTracker::WebEventButtonModifierMask() {
WebPluginDelegateImpl::WebPluginDelegateImpl(
gfx::PluginWindowHandle containing_view,
- PluginInstance *instance)
+ PluginInstance* instance)
: windowed_handle_(gfx::kNullPluginWindow),
// all Mac plugins are "windowless" in the Windows/X11 sense
windowless_(true),
diff --git a/webkit/plugins/npapi/webplugin_delegate_impl_win.cc b/webkit/plugins/npapi/webplugin_delegate_impl_win.cc
index 594d61f..cc9aaee 100644
--- a/webkit/plugins/npapi/webplugin_delegate_impl_win.cc
+++ b/webkit/plugins/npapi/webplugin_delegate_impl_win.cc
@@ -10,13 +10,10 @@
#include "base/bind.h"
#include "base/compiler_specific.h"
-#include "base/file_util.h"
#include "base/lazy_instance.h"
#include "base/memory/scoped_ptr.h"
#include "base/message_loop.h"
#include "base/metrics/stats_counters.h"
-#include "base/string_number_conversions.h"
-#include "base/string_split.h"
#include "base/string_util.h"
#include "base/stringprintf.h"
#include "base/synchronization/lock.h"
@@ -35,6 +32,7 @@
#include "webkit/plugins/npapi/plugin_utils.h"
#include "webkit/plugins/npapi/webplugin.h"
#include "webkit/plugins/npapi/webplugin_ime_win.h"
+#include "webkit/plugins/plugin_constants.h"
using WebKit::WebCursorInfo;
using WebKit::WebKeyboardEvent;
@@ -394,7 +392,7 @@ BOOL WINAPI WebPluginDelegateImpl::VirtualFreePatch(LPVOID address,
WebPluginDelegateImpl::WebPluginDelegateImpl(
gfx::PluginWindowHandle containing_view,
- PluginInstance *instance)
+ PluginInstance* instance)
: parent_(containing_view),
instance_(instance),
quirks_(0),
@@ -424,7 +422,7 @@ WebPluginDelegateImpl::WebPluginDelegateImpl(
std::wstring filename =
StringToLowerASCII(plugin_info.path.BaseName().value());
- if (instance_->mime_type() == "application/x-shockwave-flash" ||
+ if (instance_->mime_type() == kFlashPluginSwfMimeType ||
filename == kFlashPlugin) {
// Flash only requests windowless plugins if we return a Mozilla user
// agent.
@@ -716,7 +714,7 @@ bool WebPluginDelegateImpl::WindowedCreatePlugin() {
std::wstring plugin_name = plugin_lib->plugin_info().name;
if (!plugin_name.empty()) {
ATOM plugin_name_atom = GlobalAddAtomW(plugin_name.c_str());
- DCHECK(0 != plugin_name_atom);
+ DCHECK_NE(0, plugin_name_atom);
result = SetProp(windowed_handle_,
kPluginNameAtomProperty,
reinterpret_cast<HANDLE>(plugin_name_atom));
@@ -726,7 +724,7 @@ bool WebPluginDelegateImpl::WindowedCreatePlugin() {
string16 plugin_version = plugin_lib->plugin_info().version;
if (!plugin_version.empty()) {
ATOM plugin_version_atom = GlobalAddAtomW(plugin_version.c_str());
- DCHECK(0 != plugin_version_atom);
+ DCHECK_NE(0, plugin_version_atom);
result = SetProp(windowed_handle_,
kPluginVersionAtomProperty,
reinterpret_cast<HANDLE>(plugin_version_atom));
@@ -1334,7 +1332,7 @@ bool WebPluginDelegateImpl::PlatformSetPluginHasFocus(bool focused) {
}
static bool NPEventFromWebMouseEvent(const WebMouseEvent& event,
- NPEvent *np_event) {
+ NPEvent* np_event) {
np_event->lParam = static_cast<uint32>(MAKELPARAM(event.windowX,
event.windowY));
np_event->wParam = 0;
@@ -1389,7 +1387,7 @@ static bool NPEventFromWebMouseEvent(const WebMouseEvent& event,
}
static bool NPEventFromWebKeyboardEvent(const WebKeyboardEvent& event,
- NPEvent *np_event) {
+ NPEvent* np_event) {
np_event->wParam = event.windowsKeyCode;
switch (event.type) {
diff --git a/webkit/plugins/npapi/webplugin_impl.cc b/webkit/plugins/npapi/webplugin_impl.cc
index 085d415..a8b9672 100644
--- a/webkit/plugins/npapi/webplugin_impl.cc
+++ b/webkit/plugins/npapi/webplugin_impl.cc
@@ -9,8 +9,8 @@
#include "base/memory/linked_ptr.h"
#include "base/message_loop.h"
#include "base/metrics/histogram.h"
-#include "base/string_util.h"
#include "base/stringprintf.h"
+#include "base/string_util.h"
#include "base/utf_string_conversions.h"
#include "googleurl/src/gurl.h"
#include "googleurl/src/url_util.h"
@@ -18,26 +18,26 @@
#include "net/base/net_errors.h"
#include "net/http/http_response_headers.h"
#include "skia/ext/platform_canvas.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/WebConsoleMessage.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebCookieJar.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebCString.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebData.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebHTTPBody.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebHTTPHeaderVisitor.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLError.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLLoaderClient.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLLoader.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLResponse.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebConsoleMessage.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginParams.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLError.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLLoader.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLLoaderClient.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebURLLoaderOptions.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLResponse.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
#include "ui/gfx/rect.h"
#include "webkit/appcache/web_application_cache_host_impl.h"
@@ -46,6 +46,7 @@
#include "webkit/plugins/npapi/plugin_instance.h"
#include "webkit/plugins/npapi/webplugin_delegate.h"
#include "webkit/plugins/npapi/webplugin_page_delegate.h"
+#include "webkit/plugins/plugin_constants.h"
using appcache::WebApplicationCacheHostImpl;
using WebKit::WebCanvas;
@@ -81,7 +82,6 @@ namespace npapi {
namespace {
-const char kFlashMimeType[] = "application/x-shockwave-flash";
const char kOctetStreamMimeType[] = "application/octet-stream";
const char kHTMLMimeType[] = "text/html";
const char kPlainTextMimeType[] = "text/plain";
@@ -165,7 +165,7 @@ class MultiPartResponseClient : public WebURLLoaderClient {
class HeaderFlattener : public WebHTTPHeaderVisitor {
public:
- HeaderFlattener(std::string* buf) : buf_(buf) {
+ explicit HeaderFlattener(std::string* buf) : buf_(buf) {
}
virtual void visitHeader(const WebString& name, const WebString& value) {
@@ -608,7 +608,7 @@ WebPluginDelegate* WebPluginImpl::delegate() {
bool WebPluginImpl::IsValidUrl(const GURL& url, Referrer referrer_flag) {
if (referrer_flag == PLUGIN_SRC &&
- mime_type_ == kFlashMimeType &&
+ mime_type_ == kFlashPluginSwfMimeType &&
url.GetOrigin() != plugin_url_.GetOrigin()) {
// Do url check to make sure that there are no @, ;, \ chars in between url
// scheme and url path.
@@ -905,7 +905,7 @@ void WebPluginImpl::didReceiveResponse(WebURLLoader* loader,
// Defend against content confusion by the Flash plug-in.
if (client_info->is_plugin_src_load &&
- mime_type_ == kFlashMimeType) {
+ mime_type_ == kFlashPluginSwfMimeType) {
client_info->check_flash_version = true;
std::string sniff =
response.httpHeaderField("X-Content-Type-Options").utf8();
@@ -914,7 +914,7 @@ void WebPluginImpl::didReceiveResponse(WebURLLoader* loader,
StringToLowerASCII(&sniff);
StringToLowerASCII(&content_type);
// TODO(cevans): remove when we no longer need these.
- if (content_type.find(kFlashMimeType) != std::string::npos) {
+ if (content_type.find(kFlashPluginSwfMimeType) != std::string::npos) {
UMA_HISTOGRAM_ENUMERATION(kPluginFlashMimeType,
MIME_TYPE_OK,
MIME_TYPE_NUM_EVENTS);
@@ -941,7 +941,7 @@ void WebPluginImpl::didReceiveResponse(WebURLLoader* loader,
}
if (sniff.find("nosniff") != std::string::npos &&
!content_type.empty() &&
- content_type.find(kFlashMimeType) == std::string::npos) {
+ content_type.find(kFlashPluginSwfMimeType) == std::string::npos) {
loader->cancel();
client_info->client->DidFail();
return;