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

Side by Side Diff: chrome/renderer/blocked_plugin.cc

Issue 5998002: Revert "Move the NPAPI files from webkit/glue/plugins to webkit/plugins/npapi" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 10 years 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
« no previous file with comments | « chrome/renderer/blocked_plugin.h ('k') | chrome/renderer/pepper_devices.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "app/resource_bundle.h" 8 #include "app/resource_bundle.h"
9 #include "base/string_piece.h" 9 #include "base/string_piece.h"
10 #include "base/values.h" 10 #include "base/values.h"
11 #include "chrome/common/jstemplate_builder.h" 11 #include "chrome/common/jstemplate_builder.h"
12 #include "chrome/common/notification_service.h" 12 #include "chrome/common/notification_service.h"
13 #include "chrome/common/render_messages.h" 13 #include "chrome/common/render_messages.h"
14 #include "chrome/renderer/render_view.h" 14 #include "chrome/renderer/render_view.h"
15 #include "grit/generated_resources.h" 15 #include "grit/generated_resources.h"
16 #include "grit/renderer_resources.h" 16 #include "grit/renderer_resources.h"
17 #include "third_party/WebKit/WebKit/chromium/public/WebContextMenuData.h" 17 #include "third_party/WebKit/WebKit/chromium/public/WebContextMenuData.h"
18 #include "third_party/WebKit/WebKit/chromium/public/WebData.h" 18 #include "third_party/WebKit/WebKit/chromium/public/WebData.h"
19 #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" 19 #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h"
20 #include "third_party/WebKit/WebKit/chromium/public/WebMenuItemInfo.h" 20 #include "third_party/WebKit/WebKit/chromium/public/WebMenuItemInfo.h"
21 #include "third_party/WebKit/WebKit/chromium/public/WebPluginContainer.h" 21 #include "third_party/WebKit/WebKit/chromium/public/WebPluginContainer.h"
22 #include "third_party/WebKit/WebKit/chromium/public/WebPoint.h" 22 #include "third_party/WebKit/WebKit/chromium/public/WebPoint.h"
23 #include "third_party/WebKit/WebKit/chromium/public/WebVector.h" 23 #include "third_party/WebKit/WebKit/chromium/public/WebVector.h"
24 #include "third_party/WebKit/WebKit/chromium/public/WebView.h" 24 #include "third_party/WebKit/WebKit/chromium/public/WebView.h"
25 #include "webkit/glue/plugins/plugin_group.h"
26 #include "webkit/glue/plugins/webview_plugin.h"
25 #include "webkit/glue/webpreferences.h" 27 #include "webkit/glue/webpreferences.h"
26 #include "webkit/plugins/npapi/plugin_group.h"
27 #include "webkit/plugins/npapi/webview_plugin.h"
28 28
29 using WebKit::WebContextMenuData; 29 using WebKit::WebContextMenuData;
30 using WebKit::WebFrame; 30 using WebKit::WebFrame;
31 using WebKit::WebMenuItemInfo; 31 using WebKit::WebMenuItemInfo;
32 using WebKit::WebPlugin; 32 using WebKit::WebPlugin;
33 using WebKit::WebPluginContainer; 33 using WebKit::WebPluginContainer;
34 using WebKit::WebPluginParams; 34 using WebKit::WebPluginParams;
35 using WebKit::WebPoint; 35 using WebKit::WebPoint;
36 using WebKit::WebString; 36 using WebKit::WebString;
37 using WebKit::WebVector; 37 using WebKit::WebVector;
38 38
39 static const char* const kBlockedPluginDataURL = "chrome://blockedplugindata/"; 39 static const char* const kBlockedPluginDataURL = "chrome://blockedplugindata/";
40 static const unsigned kMenuActionLoad = 1; 40 static const unsigned kMenuActionLoad = 1;
41 static const unsigned kMenuActionRemove = 2; 41 static const unsigned kMenuActionRemove = 2;
42 42
43 BlockedPlugin::BlockedPlugin(RenderView* render_view, 43 BlockedPlugin::BlockedPlugin(RenderView* render_view,
44 WebFrame* frame, 44 WebFrame* frame,
45 const webkit::npapi::PluginGroup& info, 45 const PluginGroup& info,
46 const WebPluginParams& params, 46 const WebPluginParams& params,
47 const WebPreferences& preferences, 47 const WebPreferences& preferences,
48 int template_id, 48 int template_id,
49 const string16& message) 49 const string16& message)
50 : render_view_(render_view), 50 : render_view_(render_view),
51 frame_(frame), 51 frame_(frame),
52 plugin_params_(params) { 52 plugin_params_(params) {
53 const base::StringPiece template_html( 53 const base::StringPiece template_html(
54 ResourceBundle::GetSharedInstance().GetRawDataResource(template_id)); 54 ResourceBundle::GetSharedInstance().GetRawDataResource(template_id));
55 55
56 DCHECK(!template_html.empty()) << "unable to load template. ID: " 56 DCHECK(!template_html.empty()) << "unable to load template. ID: "
57 << template_id; 57 << template_id;
58 58
59 DictionaryValue values; 59 DictionaryValue values;
60 values.SetString("message", message); 60 values.SetString("message", message);
61 name_ = info.GetGroupName(); 61 name_ = info.GetGroupName();
62 values.SetString("name", name_); 62 values.SetString("name", name_);
63 63
64 // "t" is the id of the templates root node. 64 // "t" is the id of the templates root node.
65 std::string html_data = jstemplate_builder::GetTemplatesHtml( 65 std::string html_data = jstemplate_builder::GetTemplatesHtml(
66 template_html, &values, "t"); 66 template_html, &values, "t");
67 67
68 plugin_ = webkit::npapi::WebViewPlugin::Create(this, 68 plugin_ = WebViewPlugin::Create(this,
69 preferences, 69 preferences,
70 html_data, 70 html_data,
71 GURL(kBlockedPluginDataURL)); 71 GURL(kBlockedPluginDataURL));
72 72
73 registrar_.Add(this, 73 registrar_.Add(this,
74 NotificationType::SHOULD_LOAD_PLUGINS, 74 NotificationType::SHOULD_LOAD_PLUGINS,
75 NotificationService::AllSources()); 75 NotificationService::AllSources());
76 } 76 }
77 77
78 BlockedPlugin::~BlockedPlugin() { 78 BlockedPlugin::~BlockedPlugin() {
79 render_view_->CustomMenuListenerDestroyed(this); 79 render_view_->CustomMenuListenerDestroyed(this);
80 } 80 }
81 81
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 plugin_->destroy(); 158 plugin_->destroy();
159 } 159 }
160 } 160 }
161 161
162 void BlockedPlugin::HidePlugin() { 162 void BlockedPlugin::HidePlugin() {
163 CHECK(plugin_); 163 CHECK(plugin_);
164 WebPluginContainer* container = plugin_->container(); 164 WebPluginContainer* container = plugin_->container();
165 container->element().setAttribute("style", "display: none;"); 165 container->element().setAttribute("style", "display: none;");
166 } 166 }
167 167
OLDNEW
« no previous file with comments | « chrome/renderer/blocked_plugin.h ('k') | chrome/renderer/pepper_devices.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698