| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/blocked_plugin.h" | 5 #include "chrome/renderer/blocked_plugin.h" |
| 6 | 6 |
| 7 #include "base/string_piece.h" | 7 #include "base/string_piece.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "chrome/common/jstemplate_builder.h" | 10 #include "chrome/common/jstemplate_builder.h" |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 } else if (message.type() == ViewMsg_LoadBlockedPlugins::ID) { | 140 } else if (message.type() == ViewMsg_LoadBlockedPlugins::ID) { |
| 141 LoadPlugin(); | 141 LoadPlugin(); |
| 142 } else if (message.type() == ViewMsg_DisplayPrerenderedPage::ID) { | 142 } else if (message.type() == ViewMsg_DisplayPrerenderedPage::ID) { |
| 143 if (is_blocked_for_prerendering_) | 143 if (is_blocked_for_prerendering_) |
| 144 LoadPlugin(); | 144 LoadPlugin(); |
| 145 } | 145 } |
| 146 | 146 |
| 147 return false; | 147 return false; |
| 148 } | 148 } |
| 149 | 149 |
| 150 void BlockedPlugin::OnMenuItemSelected(unsigned id) { | 150 void BlockedPlugin::OnMenuItemSelected( |
| 151 const webkit_glue::CustomContextMenuContext& /* ignored */, |
| 152 unsigned id) { |
| 151 if (id == kMenuActionLoad) { | 153 if (id == kMenuActionLoad) { |
| 152 LoadPlugin(); | 154 LoadPlugin(); |
| 153 } else if (id == kMenuActionRemove) { | 155 } else if (id == kMenuActionRemove) { |
| 154 HidePlugin(); | 156 HidePlugin(); |
| 155 } | 157 } |
| 156 } | 158 } |
| 157 | 159 |
| 158 void BlockedPlugin::LoadPlugin() { | 160 void BlockedPlugin::LoadPlugin() { |
| 159 CHECK(plugin_); | 161 CHECK(plugin_); |
| 160 // This is not strictly necessary but is an important defense in case the | 162 // This is not strictly necessary but is an important defense in case the |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 if (element.hasAttribute("style")) { | 227 if (element.hasAttribute("style")) { |
| 226 WebString style_str = element.getAttribute("style"); | 228 WebString style_str = element.getAttribute("style"); |
| 227 if (width_regex.match(style_str) >= 0 && | 229 if (width_regex.match(style_str) >= 0 && |
| 228 height_regex.match(style_str) >= 0) | 230 height_regex.match(style_str) >= 0) |
| 229 element.setAttribute("style", "display: none;"); | 231 element.setAttribute("style", "display: none;"); |
| 230 } | 232 } |
| 231 } | 233 } |
| 232 } | 234 } |
| 233 } | 235 } |
| 234 | 236 |
| OLD | NEW |