summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/app/generated_resources.grd3
-rw-r--r--chrome/app/nibs/ContentBlockedPlugins.xib173
-rw-r--r--chrome/browser/cocoa/content_blocked_bubble_controller.h4
-rw-r--r--chrome/browser/cocoa/content_blocked_bubble_controller.mm54
-rw-r--r--chrome/browser/content_setting_bubble_model.cc43
-rw-r--r--chrome/browser/content_setting_bubble_model.h9
-rw-r--r--chrome/browser/content_setting_bubble_model_unittest.cc20
-rw-r--r--chrome/browser/gtk/content_setting_bubble_gtk.cc21
-rw-r--r--chrome/browser/gtk/content_setting_bubble_gtk.h3
-rw-r--r--chrome/browser/renderer_host/render_view_host.cc4
-rw-r--r--chrome/browser/renderer_host/render_view_host.h3
-rw-r--r--chrome/browser/tab_contents/tab_specific_content_settings.cc2
-rw-r--r--chrome/browser/tab_contents/tab_specific_content_settings.h8
-rw-r--r--chrome/browser/views/content_blocked_bubble_contents.cc24
-rw-r--r--chrome/browser/views/content_blocked_bubble_contents.h1
-rw-r--r--chrome/common/notification_type.h4
-rw-r--r--chrome/common/render_messages_internal.h3
-rw-r--r--chrome/renderer/blocked_plugin.cc15
-rw-r--r--chrome/renderer/blocked_plugin.h11
-rw-r--r--chrome/renderer/render_view.cc8
-rw-r--r--chrome/renderer/render_view.h1
21 files changed, 375 insertions, 39 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd
index de1feaa..c1c396f 100644
--- a/chrome/app/generated_resources.grd
+++ b/chrome/app/generated_resources.grd
@@ -2376,6 +2376,9 @@ each locale. -->
<message name="IDS_BLOCKED_PLUGINS_LINK" desc="Link to plug-ins section of content blocking management dialog, displayed in bubble when a page tries to display plug-ins.">
Manage plug-in blocking...
</message>
+ <message name="IDS_BLOCKED_PLUGINS_LOAD_ALL" desc="Button to load all blocked plugins on a page, displayed in bubble when a page tries to display plug-ins.">
+ Load all plug-ins on this page
+ </message>
<!-- SSL error strings -->
<message name="IDS_SEVERAL_SSL_ERRORS" desc="Bubble info header text when there is more than 1 error">
diff --git a/chrome/app/nibs/ContentBlockedPlugins.xib b/chrome/app/nibs/ContentBlockedPlugins.xib
index c83c9f5..b2047fb 100644
--- a/chrome/app/nibs/ContentBlockedPlugins.xib
+++ b/chrome/app/nibs/ContentBlockedPlugins.xib
@@ -3,12 +3,12 @@
<data>
<int key="IBDocument.SystemTarget">1050</int>
<string key="IBDocument.SystemVersion">9L31a</string>
- <string key="IBDocument.InterfaceBuilderVersion">677</string>
+ <string key="IBDocument.InterfaceBuilderVersion">680</string>
<string key="IBDocument.AppKitVersion">949.54</string>
<string key="IBDocument.HIToolboxVersion">353.00</string>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="4"/>
+ <integer value="35"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -37,7 +37,7 @@
<object class="NSWindowTemplate" id="1005">
<int key="NSWindowStyleMask">15</int>
<int key="NSWindowBacking">2</int>
- <string key="NSWindowRect">{{196, 376}, {316, 134}}</string>
+ <string key="NSWindowRect">{{196, 353}, {314, 157}}</string>
<int key="NSWTFlags">536873984</int>
<string key="NSWindowTitle">Window</string>
<string key="NSWindowClass">InfoBubbleWindow</string>
@@ -53,21 +53,51 @@
<int key="NSvFlags">274</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSCustomView" id="242530517">
+ <reference key="NSNextResponder" ref="301729179"/>
+ <int key="NSvFlags">292</int>
+ <object class="NSMutableArray" key="NSSubviews">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSButton" id="641116266">
+ <reference key="NSNextResponder" ref="242530517"/>
+ <int key="NSvFlags">292</int>
+ <string key="NSFrame">{{20, 18}, {212, 17}}</string>
+ <reference key="NSSuperview" ref="242530517"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="640364338">
+ <int key="NSCellFlags">-2080244224</int>
+ <int key="NSCellFlags2">134348800</int>
+ <string key="NSContents">^IDS_BLOCKED_PLUGINS_LOAD_ALL</string>
+ <object class="NSFont" key="NSSupport" id="26">
+ <string key="NSName">LucidaGrande</string>
+ <double key="NSSize">1.100000e+01</double>
+ <int key="NSfFlags">3100</int>
+ </object>
+ <reference key="NSControlView" ref="641116266"/>
+ <int key="NSButtonFlags">-2038152961</int>
+ <int key="NSButtonFlags2">164</int>
+ <string key="NSAlternateContents"/>
+ <string key="NSKeyEquivalent"/>
+ <int key="NSPeriodicDelay">400</int>
+ <int key="NSPeriodicInterval">75</int>
+ </object>
+ </object>
+ </object>
+ <string key="NSFrame">{{0, 34}, {252, 55}}</string>
+ <reference key="NSSuperview" ref="301729179"/>
+ <string key="NSClassName">GTMWidthBasedTweaker</string>
+ </object>
<object class="NSTextField" id="266815090">
<reference key="NSNextResponder" ref="301729179"/>
<int key="NSvFlags">266</int>
- <string key="NSFrame">{{17, 100}, {282, 14}}</string>
+ <string key="NSFrame">{{17, 123}, {280, 14}}</string>
<reference key="NSSuperview" ref="301729179"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="157361777">
<int key="NSCellFlags">67239424</int>
<int key="NSCellFlags2">272760832</int>
<string key="NSContents">^IDS_BLOCKED_PLUGINS_TITLE</string>
- <object class="NSFont" key="NSSupport" id="26">
- <string key="NSName">LucidaGrande</string>
- <double key="NSSize">1.100000e+01</double>
- <int key="NSfFlags">3100</int>
- </object>
+ <reference key="NSSupport" ref="26"/>
<reference key="NSControlView" ref="266815090"/>
<object class="NSColor" key="NSBackgroundColor" id="657398381">
<int key="NSColorSpace">6</int>
@@ -92,7 +122,7 @@
<object class="NSMatrix" id="126329017">
<reference key="NSNextResponder" ref="301729179"/>
<int key="NSvFlags">290</int>
- <string key="NSFrame">{{20, 54}, {276, 38}}</string>
+ <string key="NSFrame">{{20, 77}, {274, 38}}</string>
<reference key="NSSuperview" ref="301729179"/>
<bool key="NSEnabled">YES</bool>
<int key="NSNumRows">2</int>
@@ -161,7 +191,7 @@ AAMAAAABABIAAAECAAMAAAAEAAAFxgEDAAMAAAABAAEAAAEGAAMAAAABAAIAAAERAAQAAAABAAAACAES
AAMAAAABAAEAAAEVAAMAAAABAAQAAAEWAAMAAAABBxwAAAEXAAQAAAABAAAFEAEcAAMAAAABAAEAAAFS
AAMAAAABAAEAAAFTAAMAAAAEAAAFzodzAAcAAAwYAAAF1gAAAAAACAAIAAgACAABAAEAAQABAAAMGGFw
cGwCAAAAbW50clJHQiBYWVogB9YABAADABMALAASYWNzcEFQUEwAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAPbWAAEAAAAA0y1hcHBs2U706y3Sst1fqit5+wYbUQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAPbWAAEAAAAA0y1hcHBsAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAOclhZWgAAASwAAAAUZ1hZWgAAAUAAAAAUYlhZWgAAAVQAAAAUd3RwdAAAAWgAAAAUY2hhZAAA
AXwAAAAsclRSQwAAAagAAAAOZ1RSQwAAAbgAAAAOYlRSQwAAAcgAAAAOdmNndAAAAdgAAAMSbmRpbgAA
BOwAAAY+ZGVzYwAACywAAABkZHNjbQAAC5AAAAAubW1vZAAAC8AAAAAoY3BydAAAC+gAAAAtWFlaIAAA
@@ -226,7 +256,7 @@ QXBwbGUgQ29tcHV0ZXIsIEluYy4sIDIwMDUAAAAAA</bytes>
<int key="NSPeriodicInterval">75</int>
</object>
</object>
- <string key="NSCellSize">{276, 18}</string>
+ <string key="NSCellSize">{274, 18}</string>
<string key="NSIntercellSpacing">{4, 2}</string>
<int key="NSMatrixFlags">1151868928</int>
<string key="NSCellClass">NSActionCell</string>
@@ -298,7 +328,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<object class="NSBox" id="913795455">
<reference key="NSNextResponder" ref="301729179"/>
<int key="NSvFlags">34</int>
- <string key="NSFrame">{{20, 43}, {276, 5}}</string>
+ <string key="NSFrame">{{20, 43}, {274, 5}}</string>
<reference key="NSSuperview" ref="301729179"/>
<string key="NSOffsets">{0, 0}</string>
<object class="NSTextFieldCell" key="NSTitleCell">
@@ -348,7 +378,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
</object>
</object>
</object>
- <string key="NSFrameSize">{192, 37}</string>
+ <string key="NSFrameSize">{190, 37}</string>
<reference key="NSSuperview" ref="301729179"/>
<string key="NSClassName">GTMWidthBasedTweaker</string>
</object>
@@ -360,7 +390,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<object class="NSButton" id="433059244">
<reference key="NSNextResponder" ref="395762087"/>
<int key="NSvFlags">289</int>
- <string key="NSFrame">{{40, 13}, {68, 28}}</string>
+ <string key="NSFrame">{{39, 13}, {68, 28}}</string>
<reference key="NSSuperview" ref="395762087"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="255173005">
@@ -378,17 +408,17 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
</object>
</object>
</object>
- <string key="NSFrame">{{193, 0}, {123, 37}}</string>
+ <string key="NSFrame">{{191, 0}, {122, 37}}</string>
<reference key="NSSuperview" ref="301729179"/>
<string key="NSClassName">GTMWidthBasedTweaker</string>
</object>
</object>
- <string key="NSFrameSize">{316, 134}</string>
+ <string key="NSFrameSize">{314, 157}</string>
<reference key="NSSuperview" ref="1006"/>
<string key="NSClassName">InfoBubbleView</string>
</object>
</object>
- <string key="NSFrameSize">{316, 134}</string>
+ <string key="NSFrameSize">{314, 157}</string>
<reference key="NSSuperview"/>
</object>
<string key="NSScreenRect">{{0, 0}, {1680, 1028}}</string>
@@ -500,13 +530,29 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
</object>
<int key="connectionID">32</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">loadAllPlugins:</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="641116266"/>
+ </object>
+ <int key="connectionID">36</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">loadAllPluginsButton_</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="641116266"/>
+ </object>
+ <int key="connectionID">37</int>
+ </object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBObjectRecord">
<int key="objectID">0</int>
- <object class="NSArray" key="object" id="1002">
+ <object class="NSArray" key="object" id="134356264">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<reference key="children" ref="1000"/>
@@ -515,19 +561,19 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<object class="IBObjectRecord">
<int key="objectID">-2</int>
<reference key="object" ref="1001"/>
- <reference key="parent" ref="1002"/>
+ <reference key="parent" ref="134356264"/>
<string type="base64-UTF8" key="objectName">RmlsZSdzIE93bmVyA</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">-1</int>
<reference key="object" ref="1003"/>
- <reference key="parent" ref="1002"/>
+ <reference key="parent" ref="134356264"/>
<string key="objectName">First Responder</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">-3</int>
<reference key="object" ref="1004"/>
- <reference key="parent" ref="1002"/>
+ <reference key="parent" ref="134356264"/>
<string key="objectName">Application</string>
</object>
<object class="IBObjectRecord">
@@ -537,7 +583,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="1006"/>
</object>
- <reference key="parent" ref="1002"/>
+ <reference key="parent" ref="134356264"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">2</int>
@@ -558,6 +604,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<reference ref="266815090"/>
<reference ref="730386640"/>
<reference ref="395762087"/>
+ <reference ref="242530517"/>
</object>
<reference key="parent" ref="1006"/>
</object>
@@ -609,12 +656,12 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<object class="IBObjectRecord">
<int key="objectID">20</int>
<reference key="object" ref="670916757"/>
- <reference key="parent" ref="1002"/>
+ <reference key="parent" ref="134356264"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">21</int>
<reference key="object" ref="684547419"/>
- <reference key="parent" ref="1002"/>
+ <reference key="parent" ref="134356264"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">28</int>
@@ -662,6 +709,29 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<reference key="object" ref="255173005"/>
<reference key="parent" ref="433059244"/>
</object>
+ <object class="IBObjectRecord">
+ <int key="objectID">35</int>
+ <reference key="object" ref="242530517"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="641116266"/>
+ </object>
+ <reference key="parent" ref="301729179"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">33</int>
+ <reference key="object" ref="641116266"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="640364338"/>
+ </object>
+ <reference key="parent" ref="242530517"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">34</int>
+ <reference key="object" ref="640364338"/>
+ <reference key="parent" ref="641116266"/>
+ </object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
@@ -688,6 +758,8 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<string>2.IBPluginDependency</string>
<string>20.IBPluginDependency</string>
<string>21.IBPluginDependency</string>
+ <string>33.IBPluginDependency</string>
+ <string>34.IBPluginDependency</string>
<string>4.IBPluginDependency</string>
<string>7.IBPluginDependency</string>
<string>8.IBPluginDependency</string>
@@ -698,9 +770,9 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{32, 667}, {316, 134}}</string>
+ <string>{{32, 644}, {314, 157}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{32, 667}, {316, 134}}</string>
+ <string>{{32, 644}, {314, 157}}</string>
<boolean value="NO"/>
<string>{196, 240}</string>
<string>{{357, 418}, {480, 270}}</string>
@@ -719,6 +791,8 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
</object>
</object>
<object class="NSMutableDictionary" key="unlocalizedProperties">
@@ -741,12 +815,24 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">32</int>
+ <int key="maxID">37</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBPartialClassDescription">
+ <string key="className">BaseBubbleController</string>
+ <string key="superclassName">NSWindowController</string>
+ <object class="NSMutableDictionary" key="outlets">
+ <string key="NS.key.0">bubble_</string>
+ <string key="NS.object.0">InfoBubbleView</string>
+ </object>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">browser/cocoa/base_bubble_controller.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
<string key="className">ChromeEventProcessingWindow</string>
<string key="superclassName">NSWindow</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
@@ -764,20 +850,24 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
</object>
<object class="IBPartialClassDescription">
<string key="className">ContentBlockedBubbleController</string>
- <string key="superclassName">NSWindowController</string>
+ <string key="superclassName">BaseBubbleController</string>
<object class="NSMutableDictionary" key="actions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSMutableArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>allowBlockToggled:</string>
<string>closeBubble:</string>
+ <string>loadAllPlugins:</string>
<string>manageBlocking:</string>
+ <string>showMoreInfo:</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>id</string>
<string>id</string>
<string>id</string>
+ <string>id</string>
+ <string>id</string>
</object>
</object>
<object class="NSMutableDictionary" key="outlets">
@@ -785,19 +875,19 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<object class="NSMutableArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>allowBlockRadioGroup_</string>
- <string>bubble_</string>
<string>contentsContainer_</string>
<string>doneButton_</string>
+ <string>loadAllPluginsButton_</string>
<string>manageButton_</string>
<string>titleLabel_</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>NSMatrix</string>
- <string>InfoBubbleView</string>
<string>NSView</string>
<string>NSButton</string>
<string>NSButton</string>
+ <string>NSButton</string>
<string>NSTextField</string>
</object>
</object>
@@ -892,6 +982,20 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">../third_party/GTM/Foundation/GTMNSObject+KeyValueObserving.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">browser/cocoa/objc_zombie.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
<string key="minorKey">browser/cocoa/status_bubble_mac.h</string>
</object>
</object>
@@ -903,6 +1007,13 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
</object>
</object>
<object class="IBPartialClassDescription">
+ <string key="className">NSView</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">browser/cocoa/view_id_util.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
<string key="className">NSWindow</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
diff --git a/chrome/browser/cocoa/content_blocked_bubble_controller.h b/chrome/browser/cocoa/content_blocked_bubble_controller.h
index 74b23ce..56f2313 100644
--- a/chrome/browser/cocoa/content_blocked_bubble_controller.h
+++ b/chrome/browser/cocoa/content_blocked_bubble_controller.h
@@ -29,6 +29,7 @@ typedef std::map<NSButton*, int> PopupLinks;
IBOutlet NSButton* manageButton_;
IBOutlet NSButton* doneButton_;
+ IBOutlet NSButton* loadAllPluginsButton_;
// The container for the bubble contents of the geolocation bubble.
IBOutlet NSView* contentsContainer_;
@@ -59,4 +60,7 @@ typedef std::map<NSButton*, int> PopupLinks;
// Callback for "info" link.
- (IBAction)showMoreInfo:(id)sender;
+// Callback for "load all plugins" button.
+- (IBAction)loadAllPlugins:(id)sender;
+
@end
diff --git a/chrome/browser/cocoa/content_blocked_bubble_controller.mm b/chrome/browser/cocoa/content_blocked_bubble_controller.mm
index 8f3d613..494a3c9 100644
--- a/chrome/browser/cocoa/content_blocked_bubble_controller.mm
+++ b/chrome/browser/cocoa/content_blocked_bubble_controller.mm
@@ -46,6 +46,10 @@ const int kGeoLabelHeight = 14;
// Height of the "Clear" button in the geolocation bubble.
const int kGeoClearButtonHeight = 17;
+// Padding between radio buttons and "Load all plugins" button
+// in the plugin bubble.
+const int kLoadAllPluginsButtonVerticalPadding = 8;
+
// General padding between elements in the geolocation bubble.
const int kGeoPadding = 8;
@@ -87,6 +91,7 @@ NSTextField* LabelWithFrame(NSString* text, const NSRect& frame) {
- (void)initializeRadioGroup;
- (void)initializePopupList;
- (void)initializeGeoLists;
+- (void)sizeToFitLoadPluginsButton;
- (void)sizeToFitManageDoneButtons;
- (void)removeInfoButton;
- (void)popupLinkClicked:(id)sender;
@@ -345,6 +350,36 @@ NSTextField* LabelWithFrame(NSString* text, const NSRect& frame) {
[contentsContainer_ setFrame:containerFrame];
}
+- (void)sizeToFitLoadPluginsButton {
+ if (CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableClickToPlay)) {
+ const ContentSettingBubbleModel::BubbleContent& content =
+ contentSettingBubbleModel_->bubble_content();
+ [loadAllPluginsButton_ setEnabled:content.load_plugins_link_enabled];
+
+ // Resize horizontally to fit button if necessary.
+ NSRect windowFrame = [[self window] frame];
+ int widthNeeded = NSWidth([loadAllPluginsButton_ frame]) +
+ 2 * NSMinX([loadAllPluginsButton_ frame]);
+ if (NSWidth(windowFrame) < widthNeeded) {
+ windowFrame.size.width = widthNeeded;
+ [[self window] setFrame:windowFrame display:NO];
+ }
+ } else {
+ // Remove button and resize vertically.
+ int deltaY = kLoadAllPluginsButtonVerticalPadding +
+ NSHeight([loadAllPluginsButton_ frame]);
+ [loadAllPluginsButton_ removeFromSuperview];
+ NSRect frame = [[self window] frame];
+ frame.size.height -= deltaY;
+ [[self window] setFrame:frame display:NO];
+ NSPoint radioOrigin = [allowBlockRadioGroup_ frame].origin;
+ radioOrigin.y -= deltaY;
+ [allowBlockRadioGroup_ setFrameOrigin:radioOrigin];
+ [allowBlockRadioGroup_ setNeedsDisplay];
+ }
+}
+
- (void)sizeToFitManageDoneButtons {
CGFloat actualWidth = NSWidth([[[self window] contentView] frame]);
CGFloat requiredWidth = NSMaxX([manageButton_ frame]) + kManageDonePadding +
@@ -381,16 +416,18 @@ NSTextField* LabelWithFrame(NSString* text, const NSRect& frame) {
[self sizeToFitManageDoneButtons];
[self initializeTitle];
- if (contentSettingBubbleModel_->content_type() ==
- CONTENT_SETTINGS_TYPE_COOKIES)
+
+ ContentSettingsType type = contentSettingBubbleModel_->content_type();
+ if (type == CONTENT_SETTINGS_TYPE_PLUGINS)
+ [self sizeToFitLoadPluginsButton];
+ if (type == CONTENT_SETTINGS_TYPE_COOKIES)
[self removeInfoButton];
if (allowBlockRadioGroup_) // not bound in cookie bubble xib
[self initializeRadioGroup];
- if (contentSettingBubbleModel_->content_type() ==
- CONTENT_SETTINGS_TYPE_POPUPS)
+
+ if (type == CONTENT_SETTINGS_TYPE_POPUPS)
[self initializePopupList];
- if (contentSettingBubbleModel_->content_type() ==
- CONTENT_SETTINGS_TYPE_GEOLOCATION)
+ if (type == CONTENT_SETTINGS_TYPE_GEOLOCATION)
[self initializeGeoLists];
}
@@ -416,6 +453,11 @@ NSTextField* LabelWithFrame(NSString* text, const NSRect& frame) {
[self close];
}
+- (IBAction)loadAllPlugins:(id)sender {
+ contentSettingBubbleModel_->OnLoadPluginsLinkClicked();
+ [self close];
+}
+
- (void)popupLinkClicked:(id)sender {
content_blocked_bubble::PopupLinks::iterator i(popupLinks_.find(sender));
DCHECK(i != popupLinks_.end());
diff --git a/chrome/browser/content_setting_bubble_model.cc b/chrome/browser/content_setting_bubble_model.cc
index 88bb04d..2b8e190 100644
--- a/chrome/browser/content_setting_bubble_model.cc
+++ b/chrome/browser/content_setting_bubble_model.cc
@@ -11,6 +11,7 @@
#include "chrome/browser/host_content_settings_map.h"
#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
+#include "chrome/browser/renderer_host/render_view_host.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/browser/tab_contents/tab_contents_delegate.h"
#include "chrome/common/chrome_switches.h"
@@ -177,6 +178,37 @@ class ContentSettingSingleRadioGroup : public ContentSettingTitleAndLinkModel {
}
};
+class ContentSettingPluginBubbleModel : public ContentSettingSingleRadioGroup {
+ public:
+ ContentSettingPluginBubbleModel(TabContents* tab_contents, Profile* profile,
+ ContentSettingsType content_type)
+ : ContentSettingSingleRadioGroup(tab_contents, profile, content_type) {
+ DCHECK_EQ(content_type, CONTENT_SETTINGS_TYPE_PLUGINS);
+ SetLoadPluginsLinkTitle();
+ }
+
+ private:
+ void SetLoadPluginsLinkTitle() {
+ if (CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableClickToPlay)) {
+ set_load_plugins_link_title(
+ l10n_util::GetStringUTF8(IDS_BLOCKED_PLUGINS_LOAD_ALL));
+ }
+ }
+
+ virtual void OnLoadPluginsLinkClicked() {
+ DCHECK(CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableClickToPlay));
+ if (tab_contents()) {
+ tab_contents()->render_view_host()->LoadBlockedPlugins();
+ }
+ set_load_plugins_link_enabled(false);
+ TabSpecificContentSettings* settings =
+ tab_contents()->GetTabSpecificContentSettings();
+ settings->set_load_plugins_link_enabled(false);
+ }
+};
+
class ContentSettingPopupBubbleModel : public ContentSettingSingleRadioGroup {
public:
ContentSettingPopupBubbleModel(TabContents* tab_contents, Profile* profile,
@@ -304,6 +336,10 @@ ContentSettingBubbleModel*
return new ContentSettingDomainListBubbleModel(tab_contents, profile,
content_type);
}
+ if (content_type == CONTENT_SETTINGS_TYPE_PLUGINS) {
+ return new ContentSettingPluginBubbleModel(tab_contents, profile,
+ content_type);
+ }
return new ContentSettingSingleRadioGroup(tab_contents, profile,
content_type);
}
@@ -313,6 +349,13 @@ ContentSettingBubbleModel::ContentSettingBubbleModel(
ContentSettingsType content_type)
: tab_contents_(tab_contents), profile_(profile),
content_type_(content_type) {
+ if (tab_contents) {
+ TabSpecificContentSettings* settings =
+ tab_contents->GetTabSpecificContentSettings();
+ set_load_plugins_link_enabled(settings->load_plugins_link_enabled());
+ } else {
+ set_load_plugins_link_enabled(true);
+ }
registrar_.Add(this, NotificationType::TAB_CONTENTS_DESTROYED,
Source<TabContents>(tab_contents));
}
diff --git a/chrome/browser/content_setting_bubble_model.h b/chrome/browser/content_setting_bubble_model.h
index fd56ef8..3d7c08a 100644
--- a/chrome/browser/content_setting_bubble_model.h
+++ b/chrome/browser/content_setting_bubble_model.h
@@ -61,6 +61,8 @@ class ContentSettingBubbleModel : public NotificationObserver {
std::string manage_link;
std::string clear_link;
std::string info_link;
+ std::string load_plugins_link_title;
+ bool load_plugins_link_enabled;
};
const BubbleContent& bubble_content() const { return bubble_content_; }
@@ -75,6 +77,7 @@ class ContentSettingBubbleModel : public NotificationObserver {
virtual void OnManageLinkClicked() {}
virtual void OnClearLinkClicked() {}
virtual void OnInfoLinkClicked() {}
+ virtual void OnLoadPluginsLinkClicked() {}
protected:
ContentSettingBubbleModel(TabContents* tab_contents, Profile* profile,
@@ -102,6 +105,12 @@ class ContentSettingBubbleModel : public NotificationObserver {
void set_info_link(const std::string& link) {
bubble_content_.info_link = link;
}
+ void set_load_plugins_link_title(const std::string& title) {
+ bubble_content_.load_plugins_link_title = title;
+ }
+ void set_load_plugins_link_enabled(bool enabled) {
+ bubble_content_.load_plugins_link_enabled = enabled;
+ }
private:
TabContents* tab_contents_;
diff --git a/chrome/browser/content_setting_bubble_model_unittest.cc b/chrome/browser/content_setting_bubble_model_unittest.cc
index 5f96e49..7a77fb9 100644
--- a/chrome/browser/content_setting_bubble_model_unittest.cc
+++ b/chrome/browser/content_setting_bubble_model_unittest.cc
@@ -38,6 +38,7 @@ class ContentSettingBubbleModelTest : public RenderViewHostTestHarness {
EXPECT_NE(std::string(), bubble_content.manage_link);
EXPECT_EQ(std::string(), bubble_content.info_link);
EXPECT_EQ(std::string(), bubble_content.title);
+ EXPECT_EQ(std::string(), bubble_content.load_plugins_link_title);
}
ChromeThread ui_thread_;
@@ -58,6 +59,7 @@ TEST_F(ContentSettingBubbleModelTest, ImageRadios) {
EXPECT_NE(std::string(), bubble_content.manage_link);
EXPECT_EQ(std::string(), bubble_content.info_link);
EXPECT_NE(std::string(), bubble_content.title);
+ EXPECT_EQ(std::string(), bubble_content.load_plugins_link_title);
}
TEST_F(ContentSettingBubbleModelTest, Cookies) {
@@ -74,6 +76,24 @@ TEST_F(ContentSettingBubbleModelTest, Cookies) {
EXPECT_NE(std::string(), bubble_content.manage_link);
EXPECT_NE(std::string(), bubble_content.info_link);
EXPECT_NE(std::string(), bubble_content.title);
+ EXPECT_EQ(std::string(), bubble_content.load_plugins_link_title);
+}
+
+TEST_F(ContentSettingBubbleModelTest, Plugins) {
+ TabSpecificContentSettings* content_settings =
+ contents()->GetTabSpecificContentSettings();
+ content_settings->OnContentBlocked(CONTENT_SETTINGS_TYPE_PLUGINS);
+
+ scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model(
+ ContentSettingBubbleModel::CreateContentSettingBubbleModel(
+ contents(), profile_.get(), CONTENT_SETTINGS_TYPE_PLUGINS));
+ const ContentSettingBubbleModel::BubbleContent& bubble_content =
+ content_setting_bubble_model->bubble_content();
+ EXPECT_EQ(2U, bubble_content.radio_group.radio_items.size());
+ EXPECT_NE(std::string(), bubble_content.manage_link);
+ EXPECT_EQ(std::string(), bubble_content.info_link);
+ EXPECT_NE(std::string(), bubble_content.title);
+ EXPECT_EQ(std::string(), bubble_content.load_plugins_link_title);
}
TEST_F(ContentSettingBubbleModelTest, Geolocation) {
diff --git a/chrome/browser/gtk/content_setting_bubble_gtk.cc b/chrome/browser/gtk/content_setting_bubble_gtk.cc
index f285fd8..d0d4a56 100644
--- a/chrome/browser/gtk/content_setting_bubble_gtk.cc
+++ b/chrome/browser/gtk/content_setting_bubble_gtk.cc
@@ -197,6 +197,22 @@ void ContentSettingBubbleGtk::BuildBubble() {
FALSE, FALSE, 0);
}
+ if (!content.load_plugins_link_title.empty()) {
+ GtkWidget* load_plugins_link_box = gtk_hbox_new(FALSE, 0);
+ GtkWidget* load_plugins_link = gtk_chrome_link_button_new(
+ content.load_plugins_link_title.c_str());
+ gtk_widget_set_sensitive(load_plugins_link,
+ content.load_plugins_link_enabled);
+ g_signal_connect(load_plugins_link, "clicked",
+ G_CALLBACK(OnLoadPluginsLinkClickedThunk), this);
+ gtk_box_pack_start(GTK_BOX(load_plugins_link_box), load_plugins_link,
+ FALSE, FALSE, 0);
+ gtk_box_pack_start(GTK_BOX(bubble_content), load_plugins_link_box,
+ FALSE, FALSE, 0);
+ gtk_box_pack_start(GTK_BOX(bubble_content), gtk_hseparator_new(),
+ FALSE, FALSE, 0);
+ }
+
GtkWidget* bottom_box = gtk_hbox_new(FALSE, 0);
GtkWidget* manage_link =
@@ -281,3 +297,8 @@ void ContentSettingBubbleGtk::OnInfoLinkClicked(GtkWidget* button) {
content_setting_bubble_model_->OnInfoLinkClicked();
Close();
}
+
+void ContentSettingBubbleGtk::OnLoadPluginsLinkClicked(GtkWidget* button) {
+ content_setting_bubble_model_->OnLoadPluginsLinkClicked();
+ Close();
+}
diff --git a/chrome/browser/gtk/content_setting_bubble_gtk.h b/chrome/browser/gtk/content_setting_bubble_gtk.h
index 94b8e17..3859b30 100644
--- a/chrome/browser/gtk/content_setting_bubble_gtk.h
+++ b/chrome/browser/gtk/content_setting_bubble_gtk.h
@@ -60,6 +60,7 @@ class ContentSettingBubbleGtk : public InfoBubbleGtkDelegate,
CHROMEGTK_CALLBACK_0(ContentSettingBubbleGtk, void, OnManageLinkClicked);
CHROMEGTK_CALLBACK_0(ContentSettingBubbleGtk, void, OnClearLinkClicked);
CHROMEGTK_CALLBACK_0(ContentSettingBubbleGtk, void, OnInfoLinkClicked);
+ CHROMEGTK_CALLBACK_0(ContentSettingBubbleGtk, void, OnLoadPluginsLinkClicked);
// We position the bubble near this widget.
GtkWidget* anchor_;
@@ -88,6 +89,8 @@ class ContentSettingBubbleGtk : public InfoBubbleGtkDelegate,
typedef std::vector<GtkWidget*> RadioGroupGtk;
RadioGroupGtk radio_group_gtk_;
+
+ GtkWidget* load_plugins_link_;
};
#endif // CHROME_BROWSER_GTK_CONTENT_SETTING_BUBBLE_GTK_H_
diff --git a/chrome/browser/renderer_host/render_view_host.cc b/chrome/browser/renderer_host/render_view_host.cc
index ccaa30a..c3a7713 100644
--- a/chrome/browser/renderer_host/render_view_host.cc
+++ b/chrome/browser/renderer_host/render_view_host.cc
@@ -652,6 +652,10 @@ void RenderViewHost::InstallMissingPlugin() {
Send(new ViewMsg_InstallMissingPlugin(routing_id()));
}
+void RenderViewHost::LoadBlockedPlugins() {
+ Send(new ViewMsg_LoadBlockedPlugins(routing_id()));
+}
+
void RenderViewHost::FilesSelectedInChooser(
const std::vector<FilePath>& files) {
// Grant the security access requested to the given files.
diff --git a/chrome/browser/renderer_host/render_view_host.h b/chrome/browser/renderer_host/render_view_host.h
index 4683f7a..ff5ff94 100644
--- a/chrome/browser/renderer_host/render_view_host.h
+++ b/chrome/browser/renderer_host/render_view_host.h
@@ -345,6 +345,9 @@ class RenderViewHost : public RenderWidgetHost {
// missing plugin. Called by PluginInstaller.
void InstallMissingPlugin();
+ // Load all blocked plugins in the RenderView.
+ void LoadBlockedPlugins();
+
// Get all savable resource links from current webpage, include main
// frame and sub-frame.
void GetAllSavableResourceLinksForCurrentPage(const GURL& page_url);
diff --git a/chrome/browser/tab_contents/tab_specific_content_settings.cc b/chrome/browser/tab_contents/tab_specific_content_settings.cc
index 57b9a2b..b09992c 100644
--- a/chrome/browser/tab_contents/tab_specific_content_settings.cc
+++ b/chrome/browser/tab_contents/tab_specific_content_settings.cc
@@ -102,6 +102,7 @@ TabSpecificContentSettings::TabSpecificContentSettings(
: allowed_local_shared_objects_(profile),
blocked_local_shared_objects_(profile),
geolocation_settings_state_(profile),
+ load_plugins_link_enabled_(true),
delegate_(NULL) {
ClearBlockedContentSettings();
delegate_ = delegate;
@@ -110,6 +111,7 @@ TabSpecificContentSettings::TabSpecificContentSettings(
void TabSpecificContentSettings::ClearBlockedContentSettings() {
for (size_t i = 0; i < arraysize(content_blocked_); ++i)
content_blocked_[i] = false;
+ load_plugins_link_enabled_ = true;
blocked_local_shared_objects_.Reset();
allowed_local_shared_objects_.Reset();
if (delegate_)
diff --git a/chrome/browser/tab_contents/tab_specific_content_settings.h b/chrome/browser/tab_contents/tab_specific_content_settings.h
index 9e2148d..157976b 100644
--- a/chrome/browser/tab_contents/tab_specific_content_settings.h
+++ b/chrome/browser/tab_contents/tab_specific_content_settings.h
@@ -65,6 +65,11 @@ class TabSpecificContentSettings
// Returns a CookiesTreeModel object for the recoreded blocked cookies.
CookiesTreeModel* GetBlockedCookiesTreeModel();
+ bool load_plugins_link_enabled() { return load_plugins_link_enabled_; }
+ void set_load_plugins_link_enabled(bool enabled) {
+ load_plugins_link_enabled_ = enabled;
+ }
+
// RenderViewHostDelegate::ContentSettings implementation.
virtual void OnContentBlocked(ContentSettingsType type);
virtual void OnCookieAccessed(const GURL& url,
@@ -122,6 +127,9 @@ class TabSpecificContentSettings
// Manages information about Geolocation API usage in this page.
GeolocationSettingsState geolocation_settings_state_;
+ // Stores whether the user can load blocked plugins on this page.
+ bool load_plugins_link_enabled_;
+
Delegate* delegate_;
DISALLOW_COPY_AND_ASSIGN(TabSpecificContentSettings);
diff --git a/chrome/browser/views/content_blocked_bubble_contents.cc b/chrome/browser/views/content_blocked_bubble_contents.cc
index bef80be..11bdded 100644
--- a/chrome/browser/views/content_blocked_bubble_contents.cc
+++ b/chrome/browser/views/content_blocked_bubble_contents.cc
@@ -103,7 +103,8 @@ ContentSettingBubbleContents::ContentSettingBubbleContents(
close_button_(NULL),
manage_link_(NULL),
clear_link_(NULL),
- info_link_(NULL) {
+ info_link_(NULL),
+ load_plugins_link_(NULL) {
registrar_.Add(this, NotificationType::TAB_CONTENTS_DESTROYED,
Source<TabContents>(tab_contents));
}
@@ -157,6 +158,12 @@ void ContentSettingBubbleContents::LinkActivated(views::Link* source,
info_bubble_->Close(); // CAREFUL: This deletes us.
return;
}
+ if (source == load_plugins_link_) {
+ content_setting_bubble_model_->OnLoadPluginsLinkClicked();
+ info_bubble_->set_fade_away_on_close(true);
+ info_bubble_->Close(); // CAREFUL: This deletes us.
+ return;
+ }
PopupLinks::const_iterator i(popup_links_.find(source));
DCHECK(i != popup_links_.end());
@@ -303,6 +310,21 @@ void ContentSettingBubbleContents::InitControlLayout() {
layout->AddPaddingRow(0, kRelatedControlVerticalSpacing);
}
+ if (!bubble_content.load_plugins_link_title.empty()) {
+ load_plugins_link_ = new views::Link(
+ UTF8ToWide(bubble_content.load_plugins_link_title));
+ load_plugins_link_->SetEnabled(bubble_content.load_plugins_link_enabled);
+ load_plugins_link_->SetController(this);
+ layout->StartRow(0, single_column_set_id);
+ layout->AddView(load_plugins_link_);
+
+ layout->AddPaddingRow(0, kRelatedControlVerticalSpacing);
+ layout->StartRow(0, single_column_set_id);
+ layout->AddView(new views::Separator, 1, 1,
+ GridLayout::FILL, GridLayout::FILL);
+ layout->AddPaddingRow(0, kRelatedControlVerticalSpacing);
+ }
+
const int double_column_set_id = 1;
views::ColumnSet* double_column_set =
layout->AddColumnSet(double_column_set_id);
diff --git a/chrome/browser/views/content_blocked_bubble_contents.h b/chrome/browser/views/content_blocked_bubble_contents.h
index a48cfcbc..6d6c72c 100644
--- a/chrome/browser/views/content_blocked_bubble_contents.h
+++ b/chrome/browser/views/content_blocked_bubble_contents.h
@@ -95,6 +95,7 @@ class ContentSettingBubbleContents : public views::View,
views::Link* manage_link_;
views::Link* clear_link_;
views::Link* info_link_;
+ views::Link* load_plugins_link_;
DISALLOW_IMPLICIT_CONSTRUCTORS(ContentSettingBubbleContents);
};
diff --git a/chrome/common/notification_type.h b/chrome/common/notification_type.h
index 253994a..85aba99 100644
--- a/chrome/common/notification_type.h
+++ b/chrome/common/notification_type.h
@@ -549,6 +549,10 @@ class NotificationType {
// interception. No details are expected.
CHROME_PLUGIN_UNLOADED,
+ // This is sent in the RenderView when previously blocked plugins on a page
+ // should be loaded. The source is the RenderView. No details are expected.
+ SHOULD_LOAD_PLUGINS,
+
// This is sent when a login prompt is shown. The source is the
// Source<NavigationController> for the tab in which the prompt is shown.
// Details are a LoginNotificationDetails which provide the LoginHandler
diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h
index 6fd0c49..55f9037 100644
--- a/chrome/common/render_messages_internal.h
+++ b/chrome/common/render_messages_internal.h
@@ -509,6 +509,9 @@ IPC_BEGIN_MESSAGES(View)
IPC_MESSAGE_CONTROL1(ViewMsg_PurgePluginListCache,
bool /* reload_pages */)
+ // Tells the render view to load all blocked plugins.
+ IPC_MESSAGE_ROUTED0(ViewMsg_LoadBlockedPlugins)
+
IPC_MESSAGE_ROUTED1(ViewMsg_RunFileChooserResponse,
std::vector<FilePath> /* selected files */)
diff --git a/chrome/renderer/blocked_plugin.cc b/chrome/renderer/blocked_plugin.cc
index 3e891b3..a6ef499 100644
--- a/chrome/renderer/blocked_plugin.cc
+++ b/chrome/renderer/blocked_plugin.cc
@@ -9,6 +9,7 @@
#include "base/file_path.h"
#include "base/string_piece.h"
#include "chrome/common/jstemplate_builder.h"
+#include "chrome/common/notification_service.h"
#include "chrome/renderer/render_view.h"
#include "grit/generated_resources.h"
#include "grit/renderer_resources.h"
@@ -57,6 +58,10 @@ BlockedPlugin::BlockedPlugin(RenderView* render_view,
web_view->mainFrame()->loadHTMLString(htmlData,
GURL(kBlockedPluginDataURL));
+
+ registrar_.Add(this,
+ NotificationType::SHOULD_LOAD_PLUGINS,
+ NotificationService::AllSources());
}
void BlockedPlugin::BindWebFrame(WebFrame* frame) {
@@ -68,6 +73,16 @@ void BlockedPlugin::WillDestroyPlugin() {
delete this;
}
+void BlockedPlugin::Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details) {
+ if (type == NotificationType::SHOULD_LOAD_PLUGINS) {
+ LoadPlugin();
+ } else {
+ NOTREACHED();
+ }
+}
+
void BlockedPlugin::Load(const CppArgumentList& args, CppVariant* result) {
LoadPlugin();
}
diff --git a/chrome/renderer/blocked_plugin.h b/chrome/renderer/blocked_plugin.h
index 2e7bd75..014c489 100644
--- a/chrome/renderer/blocked_plugin.h
+++ b/chrome/renderer/blocked_plugin.h
@@ -6,6 +6,7 @@
#define CHROME_RENDERER_BLOCKED_PLUGIN_H_
#pragma once
+#include "chrome/common/notification_registrar.h"
#include "third_party/WebKit/WebKit/chromium/public/WebPluginParams.h"
#include "webkit/glue/cpp_bound_class.h"
#include "webkit/glue/plugins/webview_plugin.h"
@@ -13,7 +14,8 @@
class RenderView;
class BlockedPlugin : public CppBoundClass,
- public WebViewPlugin::Delegate {
+ public WebViewPlugin::Delegate,
+ public NotificationObserver {
public:
BlockedPlugin(RenderView* render_view,
WebKit::WebFrame* frame,
@@ -28,6 +30,11 @@ class BlockedPlugin : public CppBoundClass,
virtual void BindWebFrame(WebKit::WebFrame* frame);
virtual void WillDestroyPlugin();
+ // NotificationObserver methods:
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details);
+
private:
virtual ~BlockedPlugin() { }
@@ -35,6 +42,8 @@ class BlockedPlugin : public CppBoundClass,
WebKit::WebFrame* frame_;
WebKit::WebPluginParams plugin_params_;
WebViewPlugin* plugin_;
+
+ NotificationRegistrar registrar_;
};
#endif // CHROME_RENDERER_BLOCKED_PLUGIN_H_
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc
index 4efa8de..03d18a9 100644
--- a/chrome/renderer/render_view.cc
+++ b/chrome/renderer/render_view.cc
@@ -30,6 +30,7 @@
#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/jstemplate_builder.h"
+#include "chrome/common/notification_service.h"
#include "chrome/common/page_zoom.h"
#include "chrome/common/pepper_plugin_registry.h"
#include "chrome/common/render_messages.h"
@@ -685,6 +686,7 @@ void RenderView::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER(ViewMsg_UpdateWebPreferences, OnUpdateWebPreferences)
IPC_MESSAGE_HANDLER(ViewMsg_SetAltErrorPageURL, OnSetAltErrorPageURL)
IPC_MESSAGE_HANDLER(ViewMsg_InstallMissingPlugin, OnInstallMissingPlugin)
+ IPC_MESSAGE_HANDLER(ViewMsg_LoadBlockedPlugins, OnLoadBlockedPlugins)
IPC_MESSAGE_HANDLER(ViewMsg_RunFileChooserResponse, OnFileChooserResponse)
IPC_MESSAGE_HANDLER(ViewMsg_EnableViewSourceMode, OnEnableViewSourceMode)
IPC_MESSAGE_HANDLER(ViewMsg_GetAllSavableResourceLinksForCurrentPage,
@@ -3985,6 +3987,12 @@ void RenderView::OnInstallMissingPlugin() {
first_default_plugin_->InstallMissingPlugin();
}
+void RenderView::OnLoadBlockedPlugins() {
+ NotificationService::current()->Notify(NotificationType::SHOULD_LOAD_PLUGINS,
+ Source<RenderView>(this),
+ NotificationService::NoDetails());
+}
+
void RenderView::OnFileChooserResponse(const std::vector<FilePath>& paths) {
// This could happen if we navigated to a different page before the user
// closed the chooser.
diff --git a/chrome/renderer/render_view.h b/chrome/renderer/render_view.h
index 6e2a43b..82a293a 100644
--- a/chrome/renderer/render_view.h
+++ b/chrome/renderer/render_view.h
@@ -765,6 +765,7 @@ class RenderView : public RenderWidget,
const std::string& origin,
const std::string& target);
void OnInstallMissingPlugin();
+ void OnLoadBlockedPlugins();
void OnMediaPlayerActionAt(const gfx::Point& location,
const WebKit::WebMediaPlayerAction& action);
void OnMoveOrResizeStarted();