summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-10 14:41:37 +0000
committersadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-10 14:41:37 +0000
commit41a9d29a4d10c53e9e97b170e1ae0bf80bd7e707 (patch)
tree058ac1cfce3c8a4ea1393e405b2ef6f406b41e89
parent0ee1d0f4fc3a1b5378453a00d704c3aa1b7bed74 (diff)
downloadchromium_src-41a9d29a4d10c53e9e97b170e1ae0bf80bd7e707.zip
chromium_src-41a9d29a4d10c53e9e97b170e1ae0bf80bd7e707.tar.gz
chromium_src-41a9d29a4d10c53e9e97b170e1ae0bf80bd7e707.tar.bz2
notification balloons: Remove views and cocoa implementations of BalloonCollection.
In both aura/views and mac, notifications are done through the message-center. So the implementations of BalloonCollection are never used. So remove these. Only the GTK version of the implementation remains. BUG=354062, 361784 R=mukai@chromium.org, rsesek@chromium.org, sky@chromium.org Review URL: https://codereview.chromium.org/231213003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@262988 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/app/nibs/Notification.xib555
-rw-r--r--chrome/browser/extensions/extension_crash_recovery_browsertest.cc14
-rw-r--r--chrome/browser/notifications/balloon_collection_impl.cc26
-rw-r--r--chrome/browser/notifications/balloon_collection_impl.h28
-rw-r--r--chrome/browser/notifications/notification_ui_manager.cc14
-rw-r--r--chrome/browser/task_manager/task_manager.cc4
-rw-r--r--chrome/browser/ui/cocoa/notifications/balloon_collection_cocoa.mm79
-rw-r--r--chrome/browser/ui/cocoa/notifications/balloon_controller.h94
-rw-r--r--chrome/browser/ui/cocoa/notifications/balloon_controller.mm224
-rw-r--r--chrome/browser/ui/cocoa/notifications/balloon_controller_unittest.mm116
-rw-r--r--chrome/browser/ui/cocoa/notifications/balloon_view.h34
-rw-r--r--chrome/browser/ui/cocoa/notifications/balloon_view.mm100
-rw-r--r--chrome/browser/ui/cocoa/notifications/balloon_view_bridge.h39
-rw-r--r--chrome/browser/ui/cocoa/notifications/balloon_view_bridge.mm48
-rw-r--r--chrome/browser/ui/cocoa/notifications/balloon_view_host_mac.h30
-rw-r--r--chrome/browser/ui/cocoa/notifications/balloon_view_host_mac.mm46
-rw-r--r--chrome/browser/ui/views/notifications/OWNERS1
-rw-r--r--chrome/browser/ui/views/notifications/balloon_collection_views.cc112
-rw-r--r--chrome/browser/ui/views/notifications/balloon_view_host.cc54
-rw-r--r--chrome/browser/ui/views/notifications/balloon_view_host.h47
-rw-r--r--chrome/browser/ui/views/notifications/balloon_view_views.cc531
-rw-r--r--chrome/browser/ui/views/notifications/balloon_view_views.h169
-rw-r--r--chrome/chrome_browser.gypi33
-rw-r--r--chrome/chrome_browser_ui.gypi19
-rw-r--r--chrome/chrome_nibs.gypi1
-rw-r--r--chrome/chrome_tests.gypi12
-rw-r--r--chrome/chrome_tests_unit.gypi1
27 files changed, 39 insertions, 2392 deletions
diff --git a/chrome/app/nibs/Notification.xib b/chrome/app/nibs/Notification.xib
deleted file mode 100644
index f3d6ebb..0000000
--- a/chrome/app/nibs/Notification.xib
+++ /dev/null
@@ -1,555 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10">
- <data>
- <int key="IBDocument.SystemTarget">1050</int>
- <string key="IBDocument.SystemVersion">12B19</string>
- <string key="IBDocument.InterfaceBuilderVersion">2549</string>
- <string key="IBDocument.AppKitVersion">1187</string>
- <string key="IBDocument.HIToolboxVersion">624.00</string>
- <object class="NSMutableDictionary" key="IBDocument.PluginVersions">
- <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string key="NS.object.0">2549</string>
- </object>
- <object class="NSArray" key="IBDocument.IntegratedClassDependencies">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>NSButton</string>
- <string>NSButtonCell</string>
- <string>NSCustomObject</string>
- <string>NSCustomView</string>
- <string>NSTextField</string>
- <string>NSTextFieldCell</string>
- <string>NSView</string>
- <string>NSWindowTemplate</string>
- </object>
- <object class="NSArray" key="IBDocument.PluginDependencies">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- </object>
- <object class="NSMutableDictionary" key="IBDocument.Metadata">
- <string key="NS.key.0">PluginDependencyRecalculationVersion</string>
- <integer value="1" key="NS.object.0"/>
- </object>
- <object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSCustomObject" id="1001">
- <string key="NSClassName">BalloonController</string>
- </object>
- <object class="NSCustomObject" id="1003">
- <string key="NSClassName">FirstResponder</string>
- </object>
- <object class="NSCustomObject" id="1004">
- <string key="NSClassName">NSApplication</string>
- </object>
- <object class="NSWindowTemplate" id="644637438">
- <int key="NSWindowStyleMask">1</int>
- <int key="NSWindowBacking">2</int>
- <string key="NSWindowRect">{{1140, 794}, {300, 76}}</string>
- <int key="NSWTFlags">603980800</int>
- <string key="NSWindowTitle">Window</string>
- <string key="NSWindowClass">BalloonWindow</string>
- <nil key="NSViewClass"/>
- <nil key="NSUserInterfaceItemIdentifier"/>
- <string key="NSWindowContentMinSize">{300, 25}</string>
- <object class="NSView" key="NSWindowView" id="433977361">
- <reference key="NSNextResponder"/>
- <int key="NSvFlags">256</int>
- <object class="NSMutableArray" key="NSSubviews">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSCustomView" id="662796088">
- <reference key="NSNextResponder" ref="433977361"/>
- <int key="NSvFlags">4378</int>
- <string key="NSFrameSize">{300, 60}</string>
- <reference key="NSSuperview" ref="433977361"/>
- <reference key="NSWindow"/>
- <string key="NSClassName">BalloonContentViewCocoa</string>
- </object>
- <object class="NSCustomView" id="667965148">
- <reference key="NSNextResponder" ref="433977361"/>
- <int key="NSvFlags">266</int>
- <object class="NSMutableArray" key="NSSubviews">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSTextField" id="293244832">
- <reference key="NSNextResponder" ref="667965148"/>
- <int key="NSvFlags">271</int>
- <string key="NSFrame">{{24, 2}, {248, 14}}</string>
- <reference key="NSSuperview" ref="667965148"/>
- <reference key="NSWindow"/>
- <bool key="NSEnabled">YES</bool>
- <object class="NSTextFieldCell" key="NSCell" id="963811960">
- <int key="NSCellFlags">67108928</int>
- <int key="NSCellFlags2">138414080</int>
- <string key="NSContents">source origin</string>
- <object class="NSFont" key="NSSupport">
- <string key="NSName">LucidaGrande</string>
- <double key="NSSize">11</double>
- <int key="NSfFlags">16</int>
- </object>
- <reference key="NSControlView" ref="293244832"/>
- <object class="NSColor" key="NSBackgroundColor">
- <int key="NSColorSpace">6</int>
- <string key="NSCatalogName">System</string>
- <string key="NSColorName">controlColor</string>
- <object class="NSColor" key="NSColor">
- <int key="NSColorSpace">3</int>
- <bytes key="NSWhite">MC42NjY2NjY2NjY3AA</bytes>
- </object>
- </object>
- <object class="NSColor" key="NSTextColor">
- <int key="NSColorSpace">3</int>
- <bytes key="NSWhite">MC40MzE0NTE2MgA</bytes>
- </object>
- </object>
- <bool key="NSAllowsLogicalLayoutDirection">NO</bool>
- </object>
- <object class="NSButton" id="439315238">
- <reference key="NSNextResponder" ref="667965148"/>
- <int key="NSvFlags">265</int>
- <object class="NSMutableArray" key="NSSubviews">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- <string key="NSFrame">{{279, 2}, {14, 14}}</string>
- <reference key="NSSuperview" ref="667965148"/>
- <reference key="NSWindow"/>
- <bool key="NSViewIsLayerTreeHost">YES</bool>
- <bool key="NSEnabled">YES</bool>
- <object class="NSButtonCell" key="NSCell" id="34148179">
- <int key="NSCellFlags">67108864</int>
- <int key="NSCellFlags2">134217728</int>
- <string key="NSContents">Button</string>
- <object class="NSFont" key="NSSupport">
- <string key="NSName">LucidaGrande</string>
- <double key="NSSize">13</double>
- <int key="NSfFlags">1044</int>
- </object>
- <reference key="NSControlView" ref="439315238"/>
- <int key="NSButtonFlags">-2042347520</int>
- <int key="NSButtonFlags2">135</int>
- <string key="NSAlternateContents"/>
- <string key="NSKeyEquivalent"/>
- <int key="NSPeriodicDelay">200</int>
- <int key="NSPeriodicInterval">25</int>
- </object>
- <bool key="NSAllowsLogicalLayoutDirection">NO</bool>
- </object>
- </object>
- <string key="NSFrame">{{0, 59}, {300, 16}}</string>
- <reference key="NSSuperview" ref="433977361"/>
- <reference key="NSWindow"/>
- <string key="NSClassName">BalloonShelfViewCocoa</string>
- </object>
- <object class="NSCustomView" id="308128728">
- <reference key="NSNextResponder" ref="433977361"/>
- <int key="NSvFlags">274</int>
- <string key="NSFrameSize">{300, 76}</string>
- <reference key="NSSuperview" ref="433977361"/>
- <reference key="NSWindow"/>
- <string key="NSClassName">BalloonOverlayViewCocoa</string>
- </object>
- </object>
- <string key="NSFrameSize">{300, 76}</string>
- <reference key="NSSuperview"/>
- <reference key="NSWindow"/>
- </object>
- <string key="NSScreenRect">{{0, 0}, {1440, 878}}</string>
- <string key="NSMinSize">{300, 47}</string>
- <string key="NSMaxSize">{10000000000000, 10000000000000}</string>
- <bool key="NSWindowIsRestorable">YES</bool>
- </object>
- </object>
- <object class="IBObjectContainer" key="IBDocument.Objects">
- <object class="NSMutableArray" key="connectionRecords">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">originLabel_</string>
- <reference key="source" ref="1001"/>
- <reference key="destination" ref="293244832"/>
- </object>
- <int key="connectionID">60</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">htmlContainer_</string>
- <reference key="source" ref="1001"/>
- <reference key="destination" ref="662796088"/>
- </object>
- <int key="connectionID">61</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">optionsButtonPressed:</string>
- <reference key="source" ref="1001"/>
- <reference key="destination" ref="439315238"/>
- </object>
- <int key="connectionID">66</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">optionsButton_</string>
- <reference key="source" ref="1001"/>
- <reference key="destination" ref="439315238"/>
- </object>
- <int key="connectionID">67</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">window</string>
- <reference key="source" ref="1001"/>
- <reference key="destination" ref="644637438"/>
- </object>
- <int key="connectionID">68</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">shelf_</string>
- <reference key="source" ref="1001"/>
- <reference key="destination" ref="667965148"/>
- </object>
- <int key="connectionID">86</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">delegate</string>
- <reference key="source" ref="644637438"/>
- <reference key="destination" ref="1001"/>
- </object>
- <int key="connectionID">87</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="0">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- <reference key="children" ref="1000"/>
- <nil key="parent"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">-2</int>
- <reference key="object" ref="1001"/>
- <reference key="parent" ref="0"/>
- <string key="objectName">File's Owner</string>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">-1</int>
- <reference key="object" ref="1003"/>
- <reference key="parent" ref="0"/>
- <string key="objectName">First Responder</string>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">-3</int>
- <reference key="object" ref="1004"/>
- <reference key="parent" ref="0"/>
- <string key="objectName">Application</string>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">54</int>
- <reference key="object" ref="644637438"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="433977361"/>
- </object>
- <reference key="parent" ref="0"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">55</int>
- <reference key="object" ref="433977361"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="662796088"/>
- <reference ref="667965148"/>
- <reference ref="308128728"/>
- </object>
- <reference key="parent" ref="644637438"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">56</int>
- <reference key="object" ref="662796088"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- <reference key="parent" ref="433977361"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">85</int>
- <reference key="object" ref="667965148"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="293244832"/>
- <reference ref="439315238"/>
- </object>
- <reference key="parent" ref="433977361"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">2</int>
- <reference key="object" ref="293244832"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="963811960"/>
- </object>
- <reference key="parent" ref="667965148"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">3</int>
- <reference key="object" ref="963811960"/>
- <reference key="parent" ref="293244832"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">64</int>
- <reference key="object" ref="439315238"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="34148179"/>
- </object>
- <reference key="parent" ref="667965148"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">65</int>
- <reference key="object" ref="34148179"/>
- <reference key="parent" ref="439315238"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">88</int>
- <reference key="object" ref="308128728"/>
- <reference key="parent" ref="433977361"/>
- </object>
- </object>
- </object>
- <object class="NSMutableDictionary" key="flattenedProperties">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>-1.IBPluginDependency</string>
- <string>-2.IBPluginDependency</string>
- <string>-3.IBPluginDependency</string>
- <string>2.IBPluginDependency</string>
- <string>3.IBPluginDependency</string>
- <string>54.IBPluginDependency</string>
- <string>54.IBWindowTemplateEditedContentRect</string>
- <string>54.NSWindowTemplate.visibleAtLaunch</string>
- <string>55.IBPluginDependency</string>
- <string>56.IBPluginDependency</string>
- <string>56.IBViewIntegration.shadowBlurRadius</string>
- <string>56.IBViewIntegration.shadowColor</string>
- <string>56.IBViewIntegration.shadowOffsetHeight</string>
- <string>56.IBViewIntegration.shadowOffsetWidth</string>
- <string>64.CustomClassName</string>
- <string>64.IBPluginDependency</string>
- <string>65.IBPluginDependency</string>
- <string>85.IBPluginDependency</string>
- <string>88.IBPluginDependency</string>
- </object>
- <object class="NSArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <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>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{441, 539}, {300, 76}}</string>
- <boolean value="NO"/>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <real value="0.0"/>
- <object class="NSColor">
- <int key="NSColorSpace">3</int>
- <bytes key="NSWhite">MAA</bytes>
- </object>
- <real value="0.0"/>
- <real value="0.0"/>
- <string>HoverImageButton</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">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference key="dict.sortedKeys" ref="0"/>
- <reference key="dict.values" ref="0"/>
- </object>
- <nil key="activeLocalization"/>
- <object class="NSMutableDictionary" key="localizations">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference key="dict.sortedKeys" ref="0"/>
- <reference key="dict.values" ref="0"/>
- </object>
- <nil key="sourceID"/>
- <int key="maxID">88</int>
- </object>
- <object class="IBClassDescriber" key="IBDocument.Classes">
- <object class="NSMutableArray" key="referencedPartialClassDescriptions">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBPartialClassDescription">
- <string key="className">BalloonContentViewCocoa</string>
- <string key="superclassName">NSView</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">./Classes/BalloonContentViewCocoa.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">BalloonController</string>
- <string key="superclassName">NSWindowController</string>
- <object class="NSMutableDictionary" key="actions">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>closeButtonPressed:</string>
- <string>optionsButtonPressed:</string>
- <string>permissionRevoked:</string>
- </object>
- <object class="NSArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- </object>
- </object>
- <object class="NSMutableDictionary" key="actionInfosByName">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>closeButtonPressed:</string>
- <string>optionsButtonPressed:</string>
- <string>permissionRevoked:</string>
- </object>
- <object class="NSArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBActionInfo">
- <string key="name">closeButtonPressed:</string>
- <string key="candidateClassName">id</string>
- </object>
- <object class="IBActionInfo">
- <string key="name">optionsButtonPressed:</string>
- <string key="candidateClassName">id</string>
- </object>
- <object class="IBActionInfo">
- <string key="name">permissionRevoked:</string>
- <string key="candidateClassName">id</string>
- </object>
- </object>
- </object>
- <object class="NSMutableDictionary" key="outlets">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>closeButton_</string>
- <string>htmlContainer_</string>
- <string>optionsButton_</string>
- <string>originLabel_</string>
- <string>shelf_</string>
- </object>
- <object class="NSArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>NSButton</string>
- <string>BalloonContentViewCocoa</string>
- <string>HoverImageButton</string>
- <string>NSTextField</string>
- <string>BalloonShelfViewCocoa</string>
- </object>
- </object>
- <object class="NSMutableDictionary" key="toOneOutletInfosByName">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>closeButton_</string>
- <string>htmlContainer_</string>
- <string>optionsButton_</string>
- <string>originLabel_</string>
- <string>shelf_</string>
- </object>
- <object class="NSArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBToOneOutletInfo">
- <string key="name">closeButton_</string>
- <string key="candidateClassName">NSButton</string>
- </object>
- <object class="IBToOneOutletInfo">
- <string key="name">htmlContainer_</string>
- <string key="candidateClassName">BalloonContentViewCocoa</string>
- </object>
- <object class="IBToOneOutletInfo">
- <string key="name">optionsButton_</string>
- <string key="candidateClassName">HoverImageButton</string>
- </object>
- <object class="IBToOneOutletInfo">
- <string key="name">originLabel_</string>
- <string key="candidateClassName">NSTextField</string>
- </object>
- <object class="IBToOneOutletInfo">
- <string key="name">shelf_</string>
- <string key="candidateClassName">BalloonShelfViewCocoa</string>
- </object>
- </object>
- </object>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">./Classes/BalloonController.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">BalloonOverlayViewCocoa</string>
- <string key="superclassName">NSView</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">./Classes/BalloonOverlayViewCocoa.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">BalloonShelfViewCocoa</string>
- <string key="superclassName">NSView</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">./Classes/BalloonShelfViewCocoa.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">BalloonWindow</string>
- <string key="superclassName">NSWindow</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">./Classes/BalloonWindow.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">HoverButton</string>
- <string key="superclassName">NSButton</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">./Classes/HoverButton.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">HoverImageButton</string>
- <string key="superclassName">HoverButton</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">./Classes/HoverImageButton.h</string>
- </object>
- </object>
- </object>
- </object>
- <int key="IBDocument.localizationMode">0</int>
- <string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
- <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencies">
- <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string>
- <integer value="1050" key="NS.object.0"/>
- </object>
- <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
- <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string>
- <real value="1070" key="NS.object.0"/>
- </object>
- <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
- <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3</string>
- <integer value="3000" key="NS.object.0"/>
- </object>
- <bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
- <int key="IBDocument.defaultPropertyAccessControl">3</int>
- </data>
-</archive>
diff --git a/chrome/browser/extensions/extension_crash_recovery_browsertest.cc b/chrome/browser/extensions/extension_crash_recovery_browsertest.cc
index 29d8f84..c92f149 100644
--- a/chrome/browser/extensions/extension_crash_recovery_browsertest.cc
+++ b/chrome/browser/extensions/extension_crash_recovery_browsertest.cc
@@ -147,7 +147,7 @@ class MAYBE_ExtensionCrashRecoveryTest
it++;
std::string id = (*it)->id();
message_center->ClickOnNotification(id);
-#if !defined(OS_CHROMEOS)
+#if defined(TOOLKIT_GTK)
} else {
Balloon* balloon = GetNotificationDelegate(index);
ASSERT_TRUE(balloon);
@@ -167,7 +167,7 @@ class MAYBE_ExtensionCrashRecoveryTest
for (size_t i=0; i < index; i++) { it++; }
ASSERT_TRUE(g_browser_process->notification_ui_manager()->
CancelById((*it)->id()));
-#if !defined(OS_CHROMEOS)
+#if defined(TOOLKIT_GTK)
} else {
Balloon* balloon = GetNotificationDelegate(index);
ASSERT_TRUE(balloon);
@@ -181,17 +181,17 @@ class MAYBE_ExtensionCrashRecoveryTest
if (message_center::IsRichNotificationEnabled())
return message_center::MessageCenter::Get()->NotificationCount();
-#if defined(OS_CHROMEOS)
- CHECK(false);
- return 0;
-#else
+#if defined(TOOLKIT_GTK)
return BalloonNotificationUIManager::GetInstanceForTesting()->
balloon_collection()->GetActiveBalloons().size();
+#else
+ CHECK(false);
+ return 0;
#endif
}
private:
-#if !defined(OS_CHROMEOS)
+#if defined(TOOLKIT_GTK)
Balloon* GetNotificationDelegate(size_t index) {
BalloonNotificationUIManager* manager =
BalloonNotificationUIManager::GetInstanceForTesting();
diff --git a/chrome/browser/notifications/balloon_collection_impl.cc b/chrome/browser/notifications/balloon_collection_impl.cc
index bf3efca..86e850b 100644
--- a/chrome/browser/notifications/balloon_collection_impl.cc
+++ b/chrome/browser/notifications/balloon_collection_impl.cc
@@ -31,19 +31,14 @@ const int kMinAllowedBalloonCount = 2;
// The spacing between the balloon and the panel.
const int kVerticalSpacingBetweenBalloonAndPanel = 5;
-#if USE_OFFSETS
// Delay from the mouse leaving the balloon collection before
// there is a relayout, in milliseconds.
const int kRepositionDelayMs = 300;
-#endif // USE_OFFSETS
BalloonCollectionImpl::BalloonCollectionImpl()
-#if USE_OFFSETS
: reposition_factory_(this),
- added_as_message_loop_observer_(false)
-#endif
-{
+ added_as_message_loop_observer_(false) {
registrar_.Add(this, chrome::NOTIFICATION_PANEL_COLLECTION_UPDATED,
content::NotificationService::AllSources());
registrar_.Add(this, chrome::NOTIFICATION_PANEL_CHANGED_EXPANSION_STATE,
@@ -53,9 +48,7 @@ BalloonCollectionImpl::BalloonCollectionImpl()
}
BalloonCollectionImpl::~BalloonCollectionImpl() {
-#if USE_OFFSETS
RemoveMessageLoopObserver();
-#endif
}
void BalloonCollectionImpl::AddImpl(const Notification& notification,
@@ -69,11 +62,9 @@ void BalloonCollectionImpl::AddImpl(const Notification& notification,
layout_.max_balloon_height()));
new_balloon->SetPosition(layout_.OffScreenLocation(), false);
new_balloon->Show();
-#if USE_OFFSETS
int count = base_.count();
if (count > 0 && layout_.RequiresOffsets())
new_balloon->set_offset(base_.balloons()[count - 1]->offset());
-#endif
base_.Add(new_balloon, add_to_front);
PositionBalloons(false);
@@ -139,7 +130,6 @@ void BalloonCollectionImpl::DisplayChanged() {
}
void BalloonCollectionImpl::OnBalloonClosed(Balloon* source) {
-#if USE_OFFSETS
// We want to free the balloon when finished.
const Balloons& balloons = base_.balloons();
@@ -166,7 +156,6 @@ void BalloonCollectionImpl::OnBalloonClosed(Balloon* source) {
if (apply_offset)
AddMessageLoopObserver();
}
-#endif
base_.Remove(source);
PositionBalloons(true);
@@ -232,7 +221,6 @@ gfx::Rect BalloonCollectionImpl::GetBalloonsBoundingBox() const {
return bounds;
}
-#if USE_OFFSETS
void BalloonCollectionImpl::AddMessageLoopObserver() {
if (!added_as_message_loop_observer_) {
base::MessageLoopForUI::current()->AddObserver(this);
@@ -278,7 +266,6 @@ void BalloonCollectionImpl::HandleMouseMoveEvent() {
reposition_factory_.InvalidateWeakPtrs();
}
}
-#endif
BalloonCollectionImpl::Layout::Layout()
: placement_(INVALID),
@@ -392,13 +379,6 @@ bool BalloonCollectionImpl::Layout::RequiresOffsets() const {
// schemes that grow down do not require offsets.
bool offsets = (placement_ == VERTICALLY_FROM_BOTTOM_LEFT ||
placement_ == VERTICALLY_FROM_BOTTOM_RIGHT);
-
-#if defined(OS_MACOSX)
- // These schemes are in screen-coordinates, and top and bottom
- // are inverted on Mac.
- offsets = !offsets;
-#endif
-
return offsets;
}
@@ -470,13 +450,9 @@ bool BalloonCollectionImpl::Layout::ComputeOffsetToMoveAbovePanels() {
bool BalloonCollectionImpl::Layout::RefreshSystemMetrics() {
bool changed = false;
-#if defined(OS_MACOSX)
- gfx::Rect new_work_area = GetMacWorkArea();
-#else
// TODO(scottmg): NativeScreen is wrong. http://crbug.com/133312
gfx::Rect new_work_area =
gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().work_area();
-#endif
if (work_area_ != new_work_area) {
work_area_.SetRect(new_work_area.x(), new_work_area.y(),
new_work_area.width(), new_work_area.height());
diff --git a/chrome/browser/notifications/balloon_collection_impl.h b/chrome/browser/notifications/balloon_collection_impl.h
index e6ec0c9c..00e23f2 100644
--- a/chrome/browser/notifications/balloon_collection_impl.h
+++ b/chrome/browser/notifications/balloon_collection_impl.h
@@ -20,25 +20,13 @@
#include "ui/gfx/point.h"
#include "ui/gfx/rect.h"
-// Mac balloons grow from the top down and have close buttons on top, so
-// offsetting is not necessary for easy multiple-closing. Other platforms grow
-// from the bottom up and have close buttons on top, so it is necessary.
-#if defined(OS_MACOSX)
-#define USE_OFFSETS 0
-#else
-#define USE_OFFSETS 1
-#endif
-
// A balloon collection represents a set of notification balloons being
// shown on the screen. It positions new notifications according to
// a layout, and monitors for balloons being closed, which it reports
// up to its parent, the notification UI manager.
class BalloonCollectionImpl : public BalloonCollection,
- public content::NotificationObserver
-#if USE_OFFSETS
- , public base::MessageLoopForUI::Observer
-#endif
-{
+ public content::NotificationObserver,
+ public base::MessageLoopForUI::Observer {
public:
BalloonCollectionImpl();
virtual ~BalloonCollectionImpl();
@@ -64,13 +52,8 @@ class BalloonCollectionImpl : public BalloonCollection,
const content::NotificationDetails& details) OVERRIDE;
// MessageLoopForUI::Observer interface.
-#if defined(OS_WIN) || defined(USE_AURA)
- virtual void WillProcessEvent(const base::NativeEvent& event) OVERRIDE;
- virtual void DidProcessEvent(const base::NativeEvent& event) OVERRIDE;
-#elif defined(TOOLKIT_GTK)
virtual void WillProcessEvent(GdkEvent* event) OVERRIDE;
virtual void DidProcessEvent(GdkEvent* event) OVERRIDE;
-#endif
// base_ is embedded, so this is a simple accessor for the number of
// balloons in the collection.
@@ -207,11 +190,6 @@ class BalloonCollectionImpl : public BalloonCollection,
// Cross-platform internal implementation for PositionBalloons.
void PositionBalloonsInternal(bool is_reposition);
-#if defined(OS_MACOSX)
- // Get the work area on Mac OS, without inverting the coordinates.
- static gfx::Rect GetMacWorkArea();
-#endif
-
// Base implementation for the collection of active balloons.
BalloonCollectionBase base_;
@@ -220,7 +198,6 @@ class BalloonCollectionImpl : public BalloonCollection,
content::NotificationRegistrar registrar_;
-#if USE_OFFSETS
// Start and stop observing all UI events.
void AddMessageLoopObserver();
void RemoveMessageLoopObserver();
@@ -239,7 +216,6 @@ class BalloonCollectionImpl : public BalloonCollection,
// Is the balloon collection currently listening for UI events?
bool added_as_message_loop_observer_;
-#endif
DISALLOW_COPY_AND_ASSIGN(BalloonCollectionImpl);
};
diff --git a/chrome/browser/notifications/notification_ui_manager.cc b/chrome/browser/notifications/notification_ui_manager.cc
index 84fe1aa..c4e841f 100644
--- a/chrome/browser/notifications/notification_ui_manager.cc
+++ b/chrome/browser/notifications/notification_ui_manager.cc
@@ -41,19 +41,13 @@ NotificationUIManager* NotificationUIManager::Create(PrefService* local_state) {
settings_provider.Pass());
}
-#if defined(OS_CHROMEOS)
- // Since we can't reach here for CrOS (see above), no point compiling all
- // the dependent classes there.
- CHECK(false);
- return NULL;
-#elif defined(OS_MACOSX) || defined(USE_AURA)
- // IsRichNotificationEnabled() always returns true in this case.
- CHECK(false);
- return NULL;
-#else
+#if defined(TOOLKIT_GTK)
BalloonNotificationUIManager* balloon_manager =
new BalloonNotificationUIManager(local_state);
balloon_manager->SetBalloonCollection(BalloonCollection::Create());
return balloon_manager;
+#else
+ CHECK(false);
+ return NULL;
#endif
}
diff --git a/chrome/browser/task_manager/task_manager.cc b/chrome/browser/task_manager/task_manager.cc
index 0bc723d..2986e48 100644
--- a/chrome/browser/task_manager/task_manager.cc
+++ b/chrome/browser/task_manager/task_manager.cc
@@ -47,7 +47,7 @@
#include "ui/base/text/bytes_formatting.h"
#include "ui/gfx/image/image_skia.h"
-#if !defined(OS_CHROMEOS)
+#if defined(TOOLKIT_GTK)
#include "chrome/browser/task_manager/notification_resource_provider.h"
#endif
@@ -276,7 +276,7 @@ TaskManagerModel::TaskManagerModel(TaskManager* task_manager)
scoped_ptr<WebContentsInformation>(
new task_manager::GuestInformation())));
-#if !defined(OS_CHROMEOS) && defined(ENABLE_NOTIFICATIONS)
+#if defined(TOOLKIT_GTK) && defined(ENABLE_NOTIFICATIONS)
ResourceProvider* provider =
task_manager::NotificationResourceProvider::Create(task_manager);
if (provider)
diff --git a/chrome/browser/ui/cocoa/notifications/balloon_collection_cocoa.mm b/chrome/browser/ui/cocoa/notifications/balloon_collection_cocoa.mm
deleted file mode 100644
index 9e76836..0000000
--- a/chrome/browser/ui/cocoa/notifications/balloon_collection_cocoa.mm
+++ /dev/null
@@ -1,79 +0,0 @@
-// 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 "chrome/browser/notifications/balloon_collection_impl.h"
-
-#import <Cocoa/Cocoa.h>
-
-#include "chrome/browser/ui/cocoa/notifications/balloon_view_bridge.h"
-
-Balloon* BalloonCollectionImpl::MakeBalloon(const Notification& notification,
- Profile* profile) {
- Balloon* balloon = new Balloon(notification, profile, this);
- balloon->set_view(new BalloonViewBridge());
- gfx::Size size(layout_.min_balloon_width(), layout_.min_balloon_height());
- balloon->set_content_size(size);
- return balloon;
-}
-
-// static
-gfx::Rect BalloonCollectionImpl::GetMacWorkArea() {
- NSScreen* primary = [[NSScreen screens] objectAtIndex:0];
- return gfx::Rect(NSRectToCGRect([primary visibleFrame]));
-}
-
-int BalloonCollectionImpl::Layout::InterBalloonMargin() const {
- return 5;
-}
-
-int BalloonCollectionImpl::Layout::HorizontalEdgeMargin() const {
- return 5;
-}
-
-int BalloonCollectionImpl::Layout::VerticalEdgeMargin() const {
- return 0;
-}
-
-bool BalloonCollectionImpl::Layout::NeedToMoveAboveLeftSidePanels() const {
- return placement_ == VERTICALLY_FROM_TOP_LEFT;
-}
-
-bool BalloonCollectionImpl::Layout::NeedToMoveAboveRightSidePanels() const {
- return placement_ == VERTICALLY_FROM_TOP_RIGHT;
-}
-
-void BalloonCollectionImpl::PositionBalloons(bool reposition) {
- // Use an animation context so that all the balloons animate together.
- [NSAnimationContext beginGrouping];
- [[NSAnimationContext currentContext] setDuration:0.1f];
- PositionBalloonsInternal(reposition);
- [NSAnimationContext endGrouping];
-}
-
-void BalloonCollectionImpl::SetPositionPreference(
- PositionPreference position) {
- if (position == DEFAULT_POSITION)
- position = UPPER_RIGHT;
-
- // All positioning schemes are vertical, but mac
- // uses a vertically reversed screen orientation.
- if (position == UPPER_RIGHT)
- layout_.set_placement(Layout::VERTICALLY_FROM_BOTTOM_RIGHT);
- else if (position == UPPER_LEFT)
- layout_.set_placement(Layout::VERTICALLY_FROM_BOTTOM_LEFT);
- else if (position == LOWER_LEFT)
- layout_.set_placement(Layout::VERTICALLY_FROM_TOP_LEFT);
- else if (position == LOWER_RIGHT)
- layout_.set_placement(Layout::VERTICALLY_FROM_TOP_RIGHT);
- else
- NOTREACHED();
-
- layout_.ComputeOffsetToMoveAbovePanels();
- PositionBalloons(true);
-}
-
-// static
-BalloonCollection* BalloonCollection::Create() {
- return new BalloonCollectionImpl();
-}
diff --git a/chrome/browser/ui/cocoa/notifications/balloon_controller.h b/chrome/browser/ui/cocoa/notifications/balloon_controller.h
deleted file mode 100644
index 7c9c00a..0000000
--- a/chrome/browser/ui/cocoa/notifications/balloon_controller.h
+++ /dev/null
@@ -1,94 +0,0 @@
-// 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.
-
-#ifndef CHROME_BROWSER_UI_COCOA_NOTIFICATIONS_BALLOON_CONTROLLER_H_
-#define CHROME_BROWSER_UI_COCOA_NOTIFICATIONS_BALLOON_CONTROLLER_H_
-
-#import <Cocoa/Cocoa.h>
-
-#include "base/mac/scoped_nsobject.h"
-#include "base/memory/scoped_ptr.h"
-
-class Balloon;
-@class BalloonContentViewCocoa;
-@class BalloonShelfViewCocoa;
-class BalloonViewHost;
-@class HoverImageButton;
-@class MenuController;
-class NotificationOptionsMenuModel;
-
-// The Balloon controller creates the view elements to display a
-// notification balloon, resize it if the HTML contents of that
-// balloon change, and move it when the collection of balloons is
-// modified.
-@interface BalloonController : NSWindowController<NSWindowDelegate> {
- @private
- // The balloon which represents the contents of this view. Weak pointer
- // owned by the browser's NotificationUIManager.
- Balloon* balloon_;
-
- // The view that contains the contents of the notification
- IBOutlet BalloonContentViewCocoa* htmlContainer_;
-
- // The view that contains the controls of the notification
- IBOutlet BalloonShelfViewCocoa* shelf_;
-
- // The close button.
- IBOutlet NSButton* closeButton_;
-
- // Tracking region for the close button.
- int closeButtonTrackingTag_;
-
- // The origin label.
- IBOutlet NSTextField* originLabel_;
-
- // The options menu that appears when "options" is pressed.
- IBOutlet HoverImageButton* optionsButton_;
- scoped_ptr<NotificationOptionsMenuModel> menuModel_;
- base::scoped_nsobject<MenuController> menuController_;
-
- // The host for the renderer of the HTML contents.
- scoped_ptr<BalloonViewHost> htmlContents_;
-
- // Variables to delay close requested by script while showing modal menu.
- BOOL optionMenuIsActive_;
- BOOL delayedClose_;
-}
-
-// Initialize with a balloon object containing the notification data.
-- (id)initWithBalloon:(Balloon*)balloon;
-
-// Callback function for the close button.
-- (IBAction)closeButtonPressed:(id)sender;
-
-// Callback function for the options button.
-- (IBAction)optionsButtonPressed:(id)sender;
-
-// Callback function for the "revoke" option in the menu.
-- (IBAction)permissionRevoked:(id)sender;
-
-// Closes the balloon. Can be called by the bridge or by the close
-// button handler.
-- (void)closeBalloon:(bool)byUser;
-
-// Update the contents of the balloon to match the notification.
-- (void)updateContents;
-
-// Repositions the view to match the position and size of the balloon.
-// Called by the bridge when the size changes.
-- (void)repositionToBalloon;
-
-// The current size of the view, possibly subject to an animation completing.
-- (int)desiredTotalWidth;
-- (int)desiredTotalHeight;
-
-// The BalloonHost
-- (BalloonViewHost*)getHost;
-@end
-
-@interface BalloonController (UnitTesting)
-- (void)initializeHost;
-@end
-
-#endif // CHROME_BROWSER_UI_COCOA_NOTIFICATIONS_BALLOON_CONTROLLER_H_
diff --git a/chrome/browser/ui/cocoa/notifications/balloon_controller.mm b/chrome/browser/ui/cocoa/notifications/balloon_controller.mm
deleted file mode 100644
index fb481cd..0000000
--- a/chrome/browser/ui/cocoa/notifications/balloon_controller.mm
+++ /dev/null
@@ -1,224 +0,0 @@
-// 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 "chrome/browser/ui/cocoa/notifications/balloon_controller.h"
-
-#include "base/mac/bundle_locations.h"
-#include "base/mac/mac_util.h"
-#include "base/strings/utf_string_conversions.h"
-#include "chrome/browser/notifications/balloon.h"
-#include "chrome/browser/notifications/desktop_notification_service.h"
-#include "chrome/browser/notifications/desktop_notification_service_factory.h"
-#include "chrome/browser/notifications/notification.h"
-#include "chrome/browser/notifications/notification_options_menu_model.h"
-#include "chrome/browser/profiles/profile.h"
-#import "chrome/browser/ui/cocoa/notifications/balloon_view.h"
-#include "chrome/browser/ui/cocoa/notifications/balloon_view_host_mac.h"
-#include "content/public/browser/render_view_host.h"
-#include "content/public/browser/web_contents.h"
-#include "grit/generated_resources.h"
-#include "grit/theme_resources.h"
-#import "ui/base/cocoa/hover_image_button.h"
-#import "ui/base/cocoa/menu_controller.h"
-#include "ui/base/l10n/l10n_util.h"
-#include "ui/base/resource/resource_bundle.h"
-
-namespace {
-
-// Margin, in pixels, between the notification frame and the contents
-// of the notification.
-const int kTopMargin = 1;
-const int kBottomMargin = 2;
-const int kLeftMargin = 2;
-const int kRightMargin = 2;
-
-} // namespace
-
-@interface BalloonController (Private)
-- (void)updateTrackingRect;
-@end
-
-@implementation BalloonController
-
-- (id)initWithBalloon:(Balloon*)balloon {
- NSString* nibpath =
- [base::mac::FrameworkBundle() pathForResource:@"Notification"
- ofType:@"nib"];
- if ((self = [super initWithWindowNibPath:nibpath owner:self])) {
- balloon_ = balloon;
- [self initializeHost];
- menuModel_.reset(new NotificationOptionsMenuModel(balloon));
- menuController_.reset([[MenuController alloc] initWithModel:menuModel_.get()
- useWithPopUpButtonCell:NO]);
- }
- return self;
-}
-
-- (void)awakeFromNib {
- DCHECK([self window]);
- DCHECK_EQ(self, [[self window] delegate]);
-
- ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
- [optionsButton_ setDefaultImage:
- rb.GetNativeImageNamed(IDR_BALLOON_WRENCH).ToNSImage()];
- [optionsButton_ setHoverImage:
- rb.GetNativeImageNamed(IDR_BALLOON_WRENCH_H).ToNSImage()];
- [optionsButton_ setPressedImage:
- rb.GetNativeImageNamed(IDR_BALLOON_WRENCH_P).ToNSImage()];
- [[optionsButton_ cell] setHighlightsBy:NSNoCellMask];
-
- NSString* sourceLabelText = l10n_util::GetNSStringF(
- IDS_NOTIFICATION_BALLOON_SOURCE_LABEL,
- balloon_->notification().display_source());
- [originLabel_ setStringValue:sourceLabelText];
-
- // This condition is false in unit tests which have no RVH.
- if (htmlContents_.get()) {
- gfx::NativeView contents = htmlContents_->native_view();
- [contents setFrame:NSMakeRect(kLeftMargin, kTopMargin, 0, 0)];
- [[htmlContainer_ superview] addSubview:contents
- positioned:NSWindowBelow
- relativeTo:nil];
- }
-
- // Use the standard close button for a utility window.
- closeButton_ = [NSWindow standardWindowButton:NSWindowCloseButton
- forStyleMask:NSUtilityWindowMask];
- NSRect frame = [closeButton_ frame];
- [closeButton_ setFrame:NSMakeRect(6, 1, frame.size.width, frame.size.height)];
- [closeButton_ setTarget:self];
- [closeButton_ setAction:@selector(closeButtonPressed:)];
- [shelf_ addSubview:closeButton_];
- [self updateTrackingRect];
-
- // Set the initial position without animating (the balloon should not
- // yet be visible).
- DCHECK(![[self window] isVisible]);
- NSRect balloon_frame = NSMakeRect(balloon_->GetPosition().x(),
- balloon_->GetPosition().y(),
- [self desiredTotalWidth],
- [self desiredTotalHeight]);
- [[self window] setFrame:balloon_frame
- display:NO];
-}
-
-- (void)updateTrackingRect {
- if (closeButtonTrackingTag_)
- [shelf_ removeTrackingRect:closeButtonTrackingTag_];
-
- closeButtonTrackingTag_ = [shelf_ addTrackingRect:[closeButton_ frame]
- owner:self
- userData:nil
- assumeInside:NO];
-}
-
-- (void) mouseEntered:(NSEvent*)event {
- [[closeButton_ cell] setHighlighted:YES];
-}
-
-- (void) mouseExited:(NSEvent*)event {
- [[closeButton_ cell] setHighlighted:NO];
-}
-
-- (void)closeBalloonNow:(bool)byUser {
- if (!balloon_)
- return;
- [self close];
- if (htmlContents_.get())
- htmlContents_->Shutdown();
- if (balloon_)
- balloon_->OnClose(byUser);
- balloon_ = NULL;
-}
-
-- (IBAction)optionsButtonPressed:(id)sender {
- optionMenuIsActive_ = YES;
- [NSMenu popUpContextMenu:[menuController_ menu]
- withEvent:[NSApp currentEvent]
- forView:optionsButton_];
- optionMenuIsActive_ = NO;
- if (delayedClose_)
- [self closeBalloonNow: false]; // always by script.
-}
-
-- (IBAction)permissionRevoked:(id)sender {
- DesktopNotificationService* service =
- DesktopNotificationServiceFactory::GetForProfile(balloon_->profile());
- service->DenyPermission(balloon_->notification().origin_url());
-}
-
-- (IBAction)closeButtonPressed:(id)sender {
- [self closeBalloon:YES];
- [self close];
-}
-
-- (void)close {
- if (closeButtonTrackingTag_)
- [shelf_ removeTrackingRect:closeButtonTrackingTag_];
-
- [super close];
-}
-
-- (void)closeBalloon:(bool)byUser {
- // Keep alive while user is interacting with popup menu.
- // Otherwise the script can close the notification and underlying balloon
- // will be destroyed while user select a menu command.
- if (!byUser && optionMenuIsActive_) {
- delayedClose_ = YES;
- return;
- }
- [self closeBalloonNow: byUser];
-}
-
-- (void)updateContents {
- DCHECK(htmlContents_.get()) << "BalloonView::Update called before Show";
- if (htmlContents_->web_contents()) {
- htmlContents_->web_contents()->GetController().LoadURL(
- balloon_->notification().content_url(), content::Referrer(),
- content::PAGE_TRANSITION_LINK, std::string());
- }
-}
-
-- (void)repositionToBalloon {
- DCHECK(balloon_);
- int x = balloon_->GetPosition().x();
- int y = balloon_->GetPosition().y();
- int w = [self desiredTotalWidth];
- int h = [self desiredTotalHeight];
-
- [[self window] setFrame:NSMakeRect(x, y, w, h)
- display:YES];
- if (htmlContents_.get())
- htmlContents_->UpdateActualSize(balloon_->content_size());
-}
-
-// Returns the total width the view should be to accommodate the balloon.
-- (int)desiredTotalWidth {
- return (balloon_ ? balloon_->content_size().width() : 0) +
- kLeftMargin + kRightMargin;
-}
-
-// Returns the total height the view should be to accommodate the balloon.
-- (int)desiredTotalHeight {
- return (balloon_ ? balloon_->content_size().height() : 0) +
- kTopMargin + kBottomMargin + [shelf_ frame].size.height;
-}
-
-// Returns the BalloonHost {
-- (BalloonViewHost*) getHost {
- return htmlContents_.get();
-}
-
-// Initializes the renderer host showing the HTML contents.
-- (void)initializeHost {
- htmlContents_.reset(new BalloonViewHost(balloon_));
- htmlContents_->Init();
-}
-
-// NSWindowDelegate notification.
-- (void)windowWillClose:(NSNotification*)notif {
- [self autorelease];
-}
-
-@end
diff --git a/chrome/browser/ui/cocoa/notifications/balloon_controller_unittest.mm b/chrome/browser/ui/cocoa/notifications/balloon_controller_unittest.mm
deleted file mode 100644
index 0bfcd6f3..0000000
--- a/chrome/browser/ui/cocoa/notifications/balloon_controller_unittest.mm
+++ /dev/null
@@ -1,116 +0,0 @@
-// 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 "base/memory/scoped_ptr.h"
-#include "base/strings/utf_string_conversions.h"
-#include "chrome/browser/notifications/balloon.h"
-#include "chrome/browser/notifications/balloon_collection.h"
-#include "chrome/browser/notifications/notification.h"
-#include "chrome/browser/notifications/notification_object_proxy.h"
-#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/cocoa/cocoa_test_helper.h"
-#include "chrome/browser/ui/cocoa/notifications/balloon_controller.h"
-#include "chrome/test/base/chrome_render_view_host_test_harness.h"
-#include "chrome/test/base/test_browser_window.h"
-#include "chrome/test/base/testing_profile.h"
-
-// Subclass balloon controller and mock out the initialization of the RVH.
-@interface TestBalloonController : BalloonController {
-}
-- (void)initializeHost;
-@end
-
-@implementation TestBalloonController
-- (void)initializeHost {}
-@end
-
-namespace {
-
-// Use a dummy balloon collection for testing.
-class MockBalloonCollection : public BalloonCollection {
- virtual void Add(const Notification& notification,
- Profile* profile) OVERRIDE {}
- virtual const Notification* FindById(const std::string& id) const OVERRIDE {
- return NULL;
- }
- virtual bool RemoveById(const std::string& id) OVERRIDE { return false; }
- virtual bool RemoveBySourceOrigin(const GURL& origin) OVERRIDE {
- return false;
- }
- virtual bool RemoveByProfile(Profile* profile) OVERRIDE { return false; }
- virtual void RemoveAll() OVERRIDE {}
- virtual bool HasSpace() const OVERRIDE { return true; }
- virtual void ResizeBalloon(
- Balloon* balloon,
- const gfx::Size& size) OVERRIDE {
- }
- virtual void DisplayChanged() OVERRIDE {}
- virtual void SetPositionPreference(PositionPreference preference) OVERRIDE {}
- virtual void OnBalloonClosed(Balloon* source) OVERRIDE {};
- virtual const Balloons& GetActiveBalloons() OVERRIDE {
- NOTREACHED();
- return balloons_;
- }
- private:
- Balloons balloons_;
-};
-
-class BalloonControllerTest : public ChromeRenderViewHostTestHarness {
- virtual void SetUp() OVERRIDE {
- ChromeRenderViewHostTestHarness::SetUp();
- CocoaTest::BootstrapCocoa();
- Browser::CreateParams native_params(profile(), chrome::GetActiveDesktop());
- browser_.reset(
- chrome::CreateBrowserWithTestWindowForParams(&native_params));
- collection_.reset(new MockBalloonCollection());
- }
-
- virtual void TearDown() OVERRIDE {
- collection_.reset();
- browser_.reset();
- ChromeRenderViewHostTestHarness::TearDown();
- }
-
- protected:
- scoped_ptr<Browser> browser_;
- scoped_ptr<BalloonCollection> collection_;
-};
-
-TEST_F(BalloonControllerTest, ShowAndCloseTest) {
- Notification n(GURL("http://www.google.com"), GURL("http://www.google.com"),
- base::ASCIIToUTF16("http://www.google.com"), base::string16(),
- new NotificationObjectProxy(-1, -1, -1, false));
- scoped_ptr<Balloon> balloon(
- new Balloon(n, profile(), collection_.get()));
- balloon->SetPosition(gfx::Point(1, 1), false);
- balloon->set_content_size(gfx::Size(100, 100));
-
- BalloonController* controller =
- [[TestBalloonController alloc] initWithBalloon:balloon.get()];
-
- [controller showWindow:nil];
- [controller closeBalloon:YES];
-}
-
-TEST_F(BalloonControllerTest, SizesTest) {
- Notification n(GURL("http://www.google.com"), GURL("http://www.google.com"),
- base::ASCIIToUTF16("http://www.google.com"), base::string16(),
- new NotificationObjectProxy(-1, -1, -1, false));
- scoped_ptr<Balloon> balloon(
- new Balloon(n, profile(), collection_.get()));
- balloon->SetPosition(gfx::Point(1, 1), false);
- balloon->set_content_size(gfx::Size(100, 100));
-
- BalloonController* controller =
- [[TestBalloonController alloc] initWithBalloon:balloon.get()];
-
- [controller showWindow:nil];
-
- EXPECT_TRUE([controller desiredTotalWidth] > 100);
- EXPECT_TRUE([controller desiredTotalHeight] > 100);
-
- [controller closeBalloon:YES];
-}
-
-}
diff --git a/chrome/browser/ui/cocoa/notifications/balloon_view.h b/chrome/browser/ui/cocoa/notifications/balloon_view.h
deleted file mode 100644
index f41e8c0..0000000
--- a/chrome/browser/ui/cocoa/notifications/balloon_view.h
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright (c) 2010 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.
-
-#ifndef CHROME_BROWSER_UI_COCOA_NOTIFICATIONS_BALLOON_VIEW_H_
-#define CHROME_BROWSER_UI_COCOA_NOTIFICATIONS_BALLOON_VIEW_H_
-
-#import <Cocoa/Cocoa.h>
-
-@interface BalloonWindow : NSWindow {
-}
-@end
-
-// This view class draws a frame around the HTML contents of a
-// notification balloon.
-@interface BalloonContentViewCocoa : NSView {
-}
-@end
-
-// This view class draws the shelf of a notification balloon,
-// containing the controls.
-@interface BalloonShelfViewCocoa : NSView {
-}
-@end
-
-// This view overlays the notification balloon on top. It is used to intercept
-// mouse input to prevent reordering of the other browser windows when clicking
-// on the notification balloon.
-@interface BalloonOverlayViewCocoa : NSView {
-}
-@end
-
-
-#endif // CHROME_BROWSER_UI_COCOA_NOTIFICATIONS_BALLOON_VIEW_H_
diff --git a/chrome/browser/ui/cocoa/notifications/balloon_view.mm b/chrome/browser/ui/cocoa/notifications/balloon_view.mm
deleted file mode 100644
index 7b884fd..0000000
--- a/chrome/browser/ui/cocoa/notifications/balloon_view.mm
+++ /dev/null
@@ -1,100 +0,0 @@
-// Copyright (c) 2011 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 "chrome/browser/ui/cocoa/notifications/balloon_view.h"
-
-#import <Cocoa/Cocoa.h>
-
-#include "base/basictypes.h"
-#import "chrome/browser/ui/cocoa/notifications/balloon_controller.h"
-#import "third_party/google_toolbox_for_mac/src/AppKit/GTMNSBezierPath+RoundRect.h"
-
-namespace {
-
-const int kRoundedCornerSize = 6;
-
-} // namespace
-
-@implementation BalloonWindow
-- (id)initWithContentRect:(NSRect)contentRect
- styleMask:(NSUInteger)aStyle
- backing:(NSBackingStoreType)bufferingType
- defer:(BOOL)flag {
- self = [super initWithContentRect:contentRect
- styleMask:NSBorderlessWindowMask
- backing:NSBackingStoreBuffered
- defer:NO];
- // Using NSModalPanelWindowLevel (8) rather then NSStatusWindowLevel (25)
- // ensures notification balloons on top of regular windows, but below
- // popup menus which are at NSPopUpMenuWindowLevel (101) and Spotlight
- // drop-out, which is at NSStatusWindowLevel-2 (23) for OSX 10.6/7.
- // See http://crbug.com/59878.
- if (self) {
- [self setLevel:NSModalPanelWindowLevel];
- [self setOpaque:NO];
- [self setBackgroundColor:[NSColor clearColor]];
- }
- return self;
-}
-
-- (BOOL)canBecomeMainWindow {
- return NO;
-}
-@end
-
-@implementation BalloonShelfViewCocoa
-- (void)drawRect:(NSRect)rect {
- NSBezierPath* path =
- [NSBezierPath gtm_bezierPathWithRoundRect:[self bounds]
- topLeftCornerRadius:kRoundedCornerSize
- topRightCornerRadius:kRoundedCornerSize
- bottomLeftCornerRadius:0.0
- bottomRightCornerRadius:0.0];
-
- [[NSColor colorWithCalibratedWhite:0.957 alpha:1.0] set];
- [path fill];
-
- [[NSColor colorWithCalibratedWhite:0.8 alpha:1.0] set];
- NSPoint origin = [self bounds].origin;
- [NSBezierPath strokeLineFromPoint:origin
- toPoint:NSMakePoint(origin.x + NSWidth([self bounds]), origin.y)];
-}
-@end
-
-@implementation BalloonContentViewCocoa
-- (void)drawRect:(NSRect)rect {
- rect = NSInsetRect([self bounds], 0.5, 0.5);
- NSBezierPath* path =
- [NSBezierPath gtm_bezierPathWithRoundRect:rect
- topLeftCornerRadius:0.0
- topRightCornerRadius:0.0
- bottomLeftCornerRadius:kRoundedCornerSize
- bottomRightCornerRadius:kRoundedCornerSize];
- [[NSColor whiteColor] set];
- [path setLineWidth:3];
- [path stroke];
-}
-@end
-
-@implementation BalloonOverlayViewCocoa
-
-// We do not want to bring chrome window to foreground when we click on any
-// part of the notification balloon. To do this, we first postpone the window
-// reorder here (shouldDelayWindowOrderingForEvent is called during mouseDown)
-// and then complete canceling the reorder by [NSApp preventWindowOrdering] in
-// mouseDown handler of this view.
-- (BOOL)shouldDelayWindowOrderingForEvent:(NSEvent*)theEvent {
- return YES;
-}
-
-- (void)mouseDown:(NSEvent*)event {
- [NSApp preventWindowOrdering];
- // Continue bubbling the event up the chain of responders.
- [super mouseDown:event];
-}
-
-- (BOOL)acceptsFirstMouse:(NSEvent*)event {
- return YES;
-}
-@end
diff --git a/chrome/browser/ui/cocoa/notifications/balloon_view_bridge.h b/chrome/browser/ui/cocoa/notifications/balloon_view_bridge.h
deleted file mode 100644
index f7f8f64..0000000
--- a/chrome/browser/ui/cocoa/notifications/balloon_view_bridge.h
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright (c) 2011 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.
-
-#ifndef CHROME_BROWSER_UI_COCOA_NOTIFICATIONS_BALLOON_VIEW_BRIDGE_H_
-#define CHROME_BROWSER_UI_COCOA_NOTIFICATIONS_BALLOON_VIEW_BRIDGE_H_
-
-#include "chrome/browser/notifications/balloon.h"
-
-@class BalloonController;
-class BalloonHost;
-namespace gfx {
-class Size;
-}
-
-// Bridges from the cross-platform BalloonView interface to the Cocoa
-// controller which will draw the view on screen.
-class BalloonViewBridge : public BalloonView {
- public:
- BalloonViewBridge();
- virtual ~BalloonViewBridge();
-
- // BalloonView interface.
- virtual void Show(Balloon* balloon) OVERRIDE;
- virtual void Update() OVERRIDE;
- virtual void RepositionToBalloon() OVERRIDE;
- virtual void Close(bool by_user) OVERRIDE;
- virtual gfx::Size GetSize() const OVERRIDE;
- virtual BalloonHost* GetHost() const OVERRIDE;
-
- private:
- // Weak pointer to the balloon controller which manages the UI.
- // This object cleans itself up when its windows close.
- BalloonController* controller_;
-
- DISALLOW_COPY_AND_ASSIGN(BalloonViewBridge);
-};
-
-#endif // CHROME_BROWSER_UI_COCOA_NOTIFICATIONS_BALLOON_VIEW_BRIDGE_H_
diff --git a/chrome/browser/ui/cocoa/notifications/balloon_view_bridge.mm b/chrome/browser/ui/cocoa/notifications/balloon_view_bridge.mm
deleted file mode 100644
index 802929c..0000000
--- a/chrome/browser/ui/cocoa/notifications/balloon_view_bridge.mm
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright (c) 2010 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 "chrome/browser/ui/cocoa/notifications/balloon_view_bridge.h"
-
-#include "chrome/browser/ui/cocoa/notifications/balloon_controller.h"
-#import "chrome/browser/ui/cocoa/notifications/balloon_view_host_mac.h"
-#include "ui/gfx/size.h"
-
-#import <Cocoa/Cocoa.h>
-
-BalloonViewBridge::BalloonViewBridge() :
- controller_(NULL) {
-}
-
-BalloonViewBridge::~BalloonViewBridge() {
-}
-
-void BalloonViewBridge::Close(bool by_user) {
- [controller_ closeBalloon:by_user];
-}
-
-gfx::Size BalloonViewBridge::GetSize() const {
- if (controller_)
- return gfx::Size([controller_ desiredTotalWidth],
- [controller_ desiredTotalHeight]);
- else
- return gfx::Size();
-}
-
-void BalloonViewBridge::RepositionToBalloon() {
- [controller_ repositionToBalloon];
-}
-
-void BalloonViewBridge::Show(Balloon* balloon) {
- controller_ = [[BalloonController alloc] initWithBalloon:balloon];
- [controller_ setShouldCascadeWindows:NO];
- [controller_ showWindow:nil];
-}
-
-BalloonHost* BalloonViewBridge::GetHost() const {
- return [controller_ getHost];
-}
-
-void BalloonViewBridge::Update() {
- [controller_ updateContents];
-}
diff --git a/chrome/browser/ui/cocoa/notifications/balloon_view_host_mac.h b/chrome/browser/ui/cocoa/notifications/balloon_view_host_mac.h
deleted file mode 100644
index 9e9cedc..0000000
--- a/chrome/browser/ui/cocoa/notifications/balloon_view_host_mac.h
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright (c) 2011 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.
-
-#ifndef CHROME_BROWSER_UI_COCOA_NOTIFICATIONS_BALLOON_VIEW_HOST_MAC_H_
-#define CHROME_BROWSER_UI_COCOA_NOTIFICATIONS_BALLOON_VIEW_HOST_MAC_H_
-
-#include "chrome/browser/notifications/balloon_host.h"
-
-// BalloonViewHost class is a delegate to the renderer host for the HTML
-// notification. When initialized it creates a new RenderViewHost and loads
-// the contents of the toast into it. It also handles links within the toast,
-// loading them into a new tab.
-class BalloonViewHost : public BalloonHost {
- public:
- explicit BalloonViewHost(Balloon* balloon);
-
- virtual ~BalloonViewHost();
-
- // Changes the size of the balloon.
- void UpdateActualSize(const gfx::Size& new_size);
-
- // Accessors.
- gfx::NativeView native_view() const;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(BalloonViewHost);
-};
-
-#endif // CHROME_BROWSER_UI_COCOA_NOTIFICATIONS_BALLOON_VIEW_HOST_MAC_H_
diff --git a/chrome/browser/ui/cocoa/notifications/balloon_view_host_mac.mm b/chrome/browser/ui/cocoa/notifications/balloon_view_host_mac.mm
deleted file mode 100644
index 8868d0e..0000000
--- a/chrome/browser/ui/cocoa/notifications/balloon_view_host_mac.mm
+++ /dev/null
@@ -1,46 +0,0 @@
-// 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 "chrome/browser/ui/cocoa/notifications/balloon_view_host_mac.h"
-
-#import <Cocoa/Cocoa.h>
-
-#include "content/public/browser/render_view_host.h"
-#include "content/public/browser/web_contents.h"
-#include "content/public/browser/web_contents_view.h"
-
-BalloonViewHost::BalloonViewHost(Balloon* balloon)
- : BalloonHost(balloon) {
-}
-
-BalloonViewHost::~BalloonViewHost() {
- Shutdown();
-}
-
-void BalloonViewHost::UpdateActualSize(const gfx::Size& new_size) {
- // Update the size of the web contents view.
- // The view's new top left corner should be identical to the view's old top
- // left corner.
- NSView* web_contents_view = web_contents_->GetView()->GetNativeView();
- NSRect old_wcv_frame = [web_contents_view frame];
- CGFloat new_x = old_wcv_frame.origin.x;
- CGFloat new_y =
- old_wcv_frame.origin.y + (old_wcv_frame.size.height - new_size.height());
- NSRect new_wcv_frame =
- NSMakeRect(new_x, new_y, new_size.width(), new_size.height());
- [web_contents_view setFrame:new_wcv_frame];
-
- // Update the size of the balloon view.
- NSView* view = native_view();
- NSRect frame = [view frame];
- frame.size.width = new_size.width();
- frame.size.height = new_size.height();
-
- [view setFrame:frame];
- [view setNeedsDisplay:YES];
-}
-
-gfx::NativeView BalloonViewHost::native_view() const {
- return web_contents_->GetView()->GetContentNativeView();
-}
diff --git a/chrome/browser/ui/views/notifications/OWNERS b/chrome/browser/ui/views/notifications/OWNERS
deleted file mode 100644
index aa215c7..0000000
--- a/chrome/browser/ui/views/notifications/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-stevenjb@chromium.org
diff --git a/chrome/browser/ui/views/notifications/balloon_collection_views.cc b/chrome/browser/ui/views/notifications/balloon_collection_views.cc
deleted file mode 100644
index 9f39666..0000000
--- a/chrome/browser/ui/views/notifications/balloon_collection_views.cc
+++ /dev/null
@@ -1,112 +0,0 @@
-// 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 "chrome/browser/notifications/balloon_collection_impl.h"
-
-#include "chrome/browser/notifications/balloon.h"
-#include "chrome/browser/ui/views/notifications/balloon_view_views.h"
-#include "ui/events/event_constants.h"
-#include "ui/events/event_utils.h"
-#include "ui/gfx/rect.h"
-#include "ui/gfx/screen.h"
-
-Balloon* BalloonCollectionImpl::MakeBalloon(const Notification& notification,
- Profile* profile) {
- Balloon* balloon = new Balloon(notification, profile, this);
- balloon->set_view(new BalloonViewImpl(this));
- gfx::Size size(layout_.min_balloon_width(), layout_.min_balloon_height());
- balloon->set_content_size(size);
- return balloon;
-}
-
-int BalloonCollectionImpl::Layout::InterBalloonMargin() const {
- return 3;
-}
-
-int BalloonCollectionImpl::Layout::HorizontalEdgeMargin() const {
- return 2;
-}
-
-int BalloonCollectionImpl::Layout::VerticalEdgeMargin() const {
- return 0;
-}
-
-bool BalloonCollectionImpl::Layout::NeedToMoveAboveLeftSidePanels() const {
- return placement_ == VERTICALLY_FROM_BOTTOM_LEFT;
-}
-
-bool BalloonCollectionImpl::Layout::NeedToMoveAboveRightSidePanels() const {
- return placement_ == VERTICALLY_FROM_BOTTOM_RIGHT;
-}
-
-void BalloonCollectionImpl::PositionBalloons(bool reposition) {
- PositionBalloonsInternal(reposition);
-}
-
-void BalloonCollectionImpl::WillProcessEvent(const base::NativeEvent& event) {}
-
-void BalloonCollectionImpl::DidProcessEvent(const base::NativeEvent& event) {
-#if defined(OS_WIN)
- switch (event.message) {
- case WM_MOUSEMOVE:
- case WM_MOUSELEAVE:
- case WM_NCMOUSELEAVE:
- HandleMouseMoveEvent();
- break;
- }
-#elif defined(USE_AURA)
- // This is deliberately used only in linux. For an aura build on windows, the
- // above block of code is fine.
- switch (ui::EventTypeFromNative(event)) {
- case ui::ET_MOUSE_MOVED:
- case ui::ET_MOUSE_DRAGGED:
- case ui::ET_MOUSE_EXITED:
- HandleMouseMoveEvent();
- break;
- default:
- break;
- }
-#else
- NOTIMPLEMENTED();
-#endif
-}
-
-bool BalloonCollectionImpl::IsCursorInBalloonCollection() const {
-#if defined(OS_WIN)
- gfx::Point cursor(GetMessagePos());
-#else
- // TODO(saintlou): Not sure if this is correct because on Windows at least
- // the following call is GetCursorPos() not GetMessagePos().
- // TODO(scottmg): NativeScreen might be wrong. http://crbug.com/133312
- gfx::Point cursor(gfx::Screen::GetNativeScreen()->GetCursorScreenPoint());
-#endif
- return GetBalloonsBoundingBox().Contains(cursor);
-}
-
-void BalloonCollectionImpl::SetPositionPreference(
- PositionPreference position) {
- if (position == DEFAULT_POSITION)
- position = LOWER_RIGHT;
-
- // All positioning schemes are vertical, and windows
- // uses the normal screen orientation.
- if (position == UPPER_RIGHT)
- layout_.set_placement(Layout::VERTICALLY_FROM_TOP_RIGHT);
- else if (position == UPPER_LEFT)
- layout_.set_placement(Layout::VERTICALLY_FROM_TOP_LEFT);
- else if (position == LOWER_LEFT)
- layout_.set_placement(Layout::VERTICALLY_FROM_BOTTOM_LEFT);
- else if (position == LOWER_RIGHT)
- layout_.set_placement(Layout::VERTICALLY_FROM_BOTTOM_RIGHT);
- else
- NOTREACHED();
-
- layout_.ComputeOffsetToMoveAbovePanels();
- PositionBalloons(true);
-}
-
-// static
-BalloonCollection* BalloonCollection::Create() {
- return new BalloonCollectionImpl();
-}
diff --git a/chrome/browser/ui/views/notifications/balloon_view_host.cc b/chrome/browser/ui/views/notifications/balloon_view_host.cc
deleted file mode 100644
index c107dc7..0000000
--- a/chrome/browser/ui/views/notifications/balloon_view_host.cc
+++ /dev/null
@@ -1,54 +0,0 @@
-// 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 "chrome/browser/ui/views/notifications/balloon_view_host.h"
-
-#include "chrome/browser/notifications/balloon.h"
-#include "content/public/browser/content_browser_client.h"
-#include "content/public/browser/render_view_host.h"
-#include "content/public/browser/render_widget_host_view.h"
-#include "content/public/browser/web_contents.h"
-#include "ui/views/widget/widget.h"
-
-class BalloonViewHostView : public views::NativeViewHost {
- public:
- explicit BalloonViewHostView(BalloonViewHost* host)
- : host_(host),
- initialized_(false) {
- }
-
- virtual void ViewHierarchyChanged(
- const ViewHierarchyChangedDetails& details) OVERRIDE {
- NativeViewHost::ViewHierarchyChanged(details);
- if (details.is_add && GetWidget() && !initialized_) {
- initialized_ = true;
- host_->Init(GetWidget()->GetNativeView());
- }
- }
-
- private:
- // The host owns this object.
- BalloonViewHost* host_;
-
- bool initialized_;
-};
-
-BalloonViewHost::BalloonViewHost(Balloon* balloon)
- : BalloonHost(balloon) {
- native_host_ = new BalloonViewHostView(this);
-}
-
-BalloonViewHost::~BalloonViewHost() {
- Shutdown();
-}
-
-void BalloonViewHost::Init(gfx::NativeView parent_native_view) {
- parent_native_view_ = parent_native_view;
- BalloonHost::Init();
-
- content::RenderWidgetHostView* render_widget_host_view =
- web_contents_->GetRenderViewHost()->GetView();
-
- native_host_->Attach(render_widget_host_view->GetNativeView());
-}
diff --git a/chrome/browser/ui/views/notifications/balloon_view_host.h b/chrome/browser/ui/views/notifications/balloon_view_host.h
deleted file mode 100644
index 0190f84..0000000
--- a/chrome/browser/ui/views/notifications/balloon_view_host.h
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright (c) 2011 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.
-
-#ifndef CHROME_BROWSER_UI_VIEWS_NOTIFICATIONS_BALLOON_VIEW_HOST_H_
-#define CHROME_BROWSER_UI_VIEWS_NOTIFICATIONS_BALLOON_VIEW_HOST_H_
-
-#include "chrome/browser/notifications/balloon_host.h"
-#include "ui/views/controls/native/native_view_host.h"
-
-// BalloonViewHost class is a delegate to the renderer host for the HTML
-// notification. When initialized it creates a new RenderViewHost and loads
-// the contents of the toast into it. It also handles links within the toast,
-// loading them into a new tab.
-class BalloonViewHost : public BalloonHost {
- public:
- explicit BalloonViewHost(Balloon* balloon);
-
- virtual ~BalloonViewHost();
-
- void SetPreferredSize(const gfx::Size& size) {
- native_host_->SetPreferredSize(size);
- }
-
- // Accessors.
- views::View* view() {
- return native_host_;
- }
-
- gfx::NativeView native_view() const {
- return native_host_->native_view();
- }
-
- // Initialize the view, parented to |parent|, and show it.
- void Init(gfx::NativeView parent);
-
- private:
- // The views-specific host view. Pointer owned by the views hierarchy.
- views::NativeViewHost* native_host_;
-
- // The handle to the parent view.
- gfx::NativeView parent_native_view_;
-
- DISALLOW_COPY_AND_ASSIGN(BalloonViewHost);
-};
-
-#endif // CHROME_BROWSER_UI_VIEWS_NOTIFICATIONS_BALLOON_VIEW_HOST_H_
diff --git a/chrome/browser/ui/views/notifications/balloon_view_views.cc b/chrome/browser/ui/views/notifications/balloon_view_views.cc
deleted file mode 100644
index 551a681..0000000
--- a/chrome/browser/ui/views/notifications/balloon_view_views.cc
+++ /dev/null
@@ -1,531 +0,0 @@
-// 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 "chrome/browser/ui/views/notifications/balloon_view_views.h"
-
-#include <algorithm>
-#include <vector>
-
-#include "base/bind.h"
-#include "base/message_loop/message_loop.h"
-#include "base/strings/utf_string_conversions.h"
-#include "chrome/browser/chrome_notification_types.h"
-#include "chrome/browser/notifications/balloon_collection.h"
-#include "chrome/browser/notifications/desktop_notification_service.h"
-#include "chrome/browser/notifications/notification.h"
-#include "chrome/browser/notifications/notification_options_menu_model.h"
-#include "chrome/browser/ui/views/notifications/balloon_view_host.h"
-#include "content/public/browser/notification_details.h"
-#include "content/public/browser/notification_source.h"
-#include "content/public/browser/notification_types.h"
-#include "content/public/browser/render_view_host.h"
-#include "content/public/browser/render_widget_host_view.h"
-#include "content/public/browser/web_contents.h"
-#include "grit/generated_resources.h"
-#include "grit/theme_resources.h"
-#include "ui/base/l10n/l10n_util.h"
-#include "ui/base/resource/resource_bundle.h"
-#include "ui/gfx/animation/slide_animation.h"
-#include "ui/gfx/canvas.h"
-#include "ui/gfx/native_widget_types.h"
-#include "ui/gfx/path.h"
-#include "ui/views/bubble/bubble_border.h"
-#include "ui/views/controls/button/image_button.h"
-#include "ui/views/controls/button/menu_button.h"
-#include "ui/views/controls/button/text_button.h"
-#include "ui/views/controls/label.h"
-#include "ui/views/controls/menu/menu_item_view.h"
-#include "ui/views/controls/menu/menu_runner.h"
-#include "ui/views/controls/native/native_view_host.h"
-#include "ui/views/widget/widget.h"
-
-namespace {
-
-const int kTopMargin = 2;
-const int kBottomMargin = 0;
-const int kLeftMargin = 4;
-const int kRightMargin = 4;
-
-// Margin between various shelf buttons/label and the shelf border.
-const int kShelfMargin = 2;
-
-// Spacing between the options and close buttons.
-const int kOptionsDismissSpacing = 4;
-
-// Spacing between the options button and label text.
-const int kLabelOptionsSpacing = 4;
-
-// Margin between shelf border and title label.
-const int kLabelLeftMargin = 6;
-
-// Size of the drop shadow. The shadow is provided by BubbleBorder,
-// not this class.
-const int kLeftShadowWidth = 0;
-const int kRightShadowWidth = 0;
-const int kTopShadowWidth = 0;
-const int kBottomShadowWidth = 6;
-
-// Optional animation.
-const bool kAnimateEnabled = true;
-
-// Colors
-const SkColor kControlBarBackgroundColor = SkColorSetRGB(245, 245, 245);
-const SkColor kControlBarTextColor = SkColorSetRGB(125, 125, 125);
-const SkColor kControlBarSeparatorLineColor = SkColorSetRGB(180, 180, 180);
-
-} // namespace
-
-// static
-int BalloonView::GetHorizontalMargin() {
- return kLeftMargin + kRightMargin + kLeftShadowWidth + kRightShadowWidth;
-}
-
-BalloonViewImpl::BalloonViewImpl(BalloonCollection* collection)
- : balloon_(NULL),
- collection_(collection),
- frame_container_(NULL),
- html_container_(NULL),
- close_button_(NULL),
- options_menu_button_(NULL),
- enable_web_ui_(false),
- closed_by_user_(false),
- closed_(false) {
- // We're owned by Balloon and don't want to be deleted by our parent View.
- set_owned_by_client();
-
- SetBorder(scoped_ptr<views::Border>(
- new views::BubbleBorder(views::BubbleBorder::FLOAT,
- views::BubbleBorder::NO_SHADOW,
- SK_ColorWHITE)));
-}
-
-BalloonViewImpl::~BalloonViewImpl() {
-}
-
-void BalloonViewImpl::Close(bool by_user) {
- if (closed_)
- return;
-
- closed_ = true;
- animation_->Stop();
- html_contents_->Shutdown();
- // Detach contents from the widget before they close.
- // This is necessary because a widget may be deleted
- // after this when chrome is shutting down.
- html_container_->GetRootView()->RemoveAllChildViews(true);
- html_container_->Close();
- frame_container_->GetRootView()->RemoveAllChildViews(true);
- frame_container_->Close();
- closed_by_user_ = by_user;
- // |frame_container_->::Close()| is async. When processed it'll call back to
- // DeleteDelegate() and we'll cleanup.
-}
-
-gfx::Size BalloonViewImpl::GetSize() const {
- // BalloonView has no size if it hasn't been shown yet (which is when
- // balloon_ is set).
- if (!balloon_)
- return gfx::Size(0, 0);
-
- return gfx::Size(GetTotalWidth(), GetTotalHeight());
-}
-
-BalloonHost* BalloonViewImpl::GetHost() const {
- return html_contents_.get();
-}
-
-void BalloonViewImpl::OnMenuButtonClicked(views::View* source,
- const gfx::Point& point) {
- CreateOptionsMenu();
-
- menu_runner_.reset(new views::MenuRunner(options_menu_model_.get()));
-
- gfx::Point screen_location;
- views::View::ConvertPointToScreen(options_menu_button_, &screen_location);
- if (menu_runner_->RunMenuAt(
- source->GetWidget()->GetTopLevelWidget(),
- options_menu_button_,
- gfx::Rect(screen_location, options_menu_button_->size()),
- views::MenuItemView::TOPRIGHT,
- ui::MENU_SOURCE_NONE,
- views::MenuRunner::HAS_MNEMONICS) == views::MenuRunner::MENU_DELETED)
- return;
-}
-
-void BalloonViewImpl::OnDisplayChanged() {
- collection_->DisplayChanged();
-}
-
-void BalloonViewImpl::OnWorkAreaChanged() {
- collection_->DisplayChanged();
-}
-
-void BalloonViewImpl::DeleteDelegate() {
- balloon_->OnClose(closed_by_user_);
-}
-
-void BalloonViewImpl::ButtonPressed(views::Button* sender, const ui::Event&) {
- // The only button currently is the close button.
- DCHECK_EQ(close_button_, sender);
- Close(true);
-}
-
-gfx::Size BalloonViewImpl::GetPreferredSize() {
- return gfx::Size(1000, 1000);
-}
-
-void BalloonViewImpl::SizeContentsWindow() {
- if (!html_container_ || !frame_container_)
- return;
-
- gfx::Rect contents_rect = GetContentsRectangle();
- html_container_->SetBounds(contents_rect);
- html_container_->StackAboveWidget(frame_container_);
-
- gfx::Path path;
- GetContentsMask(contents_rect, &path);
- html_container_->SetShape(path.CreateNativeRegion());
-
- close_button_->SetBoundsRect(GetCloseButtonBounds());
- options_menu_button_->SetBoundsRect(GetOptionsButtonBounds());
- source_label_->SetBoundsRect(GetLabelBounds());
-}
-
-void BalloonViewImpl::RepositionToBalloon() {
- if (closed_)
- return;
-
- DCHECK(frame_container_);
- DCHECK(html_container_);
- DCHECK(balloon_);
-
- if (!kAnimateEnabled) {
- frame_container_->SetBounds(GetBoundsForFrameContainer());
- gfx::Rect contents_rect = GetContentsRectangle();
- html_container_->SetBounds(contents_rect);
- html_contents_->SetPreferredSize(contents_rect.size());
- content::RenderWidgetHostView* view =
- html_contents_->web_contents()->GetRenderWidgetHostView();
- if (view)
- view->SetSize(contents_rect.size());
- return;
- }
-
- anim_frame_end_ = GetBoundsForFrameContainer();
- anim_frame_start_ = frame_container_->GetClientAreaBoundsInScreen();
- animation_.reset(new gfx::SlideAnimation(this));
- animation_->Show();
-}
-
-void BalloonViewImpl::Update() {
- if (closed_)
- return;
-
- // Tls might get called before html_contents_ is set in Show() if more than
- // one update with the same replace_id occurs, or if an update occurs after
- // the ballon has been closed (e.g. during shutdown) but before this has been
- // destroyed.
- if (!html_contents_.get() || !html_contents_->web_contents())
- return;
- html_contents_->web_contents()->GetController().LoadURL(
- balloon_->notification().content_url(), content::Referrer(),
- content::PAGE_TRANSITION_LINK, std::string());
-}
-
-void BalloonViewImpl::AnimationProgressed(const gfx::Animation* animation) {
- DCHECK_EQ(animation_.get(), animation);
-
- // Linear interpolation from start to end position.
- gfx::Rect frame_position(animation_->CurrentValueBetween(
- anim_frame_start_, anim_frame_end_));
- frame_container_->SetBounds(frame_position);
-
- gfx::Path path;
- gfx::Rect contents_rect = GetContentsRectangle();
- html_container_->SetBounds(contents_rect);
- GetContentsMask(contents_rect, &path);
- html_container_->SetShape(path.CreateNativeRegion());
-
- html_contents_->SetPreferredSize(contents_rect.size());
- content::RenderWidgetHostView* view =
- html_contents_->web_contents()->GetRenderWidgetHostView();
- if (view)
- view->SetSize(contents_rect.size());
-}
-
-gfx::Rect BalloonViewImpl::GetCloseButtonBounds() const {
- gfx::Rect bounds(GetContentsBounds());
- bounds.set_height(GetShelfHeight());
- const gfx::Size& pref_size(close_button_->GetPreferredSize());
- bounds.Inset(bounds.width() - kShelfMargin - pref_size.width(), 0,
- kShelfMargin, 0);
- bounds.ClampToCenteredSize(pref_size);
- return bounds;
-}
-
-gfx::Rect BalloonViewImpl::GetOptionsButtonBounds() const {
- gfx::Rect bounds(GetContentsBounds());
- bounds.set_height(GetShelfHeight());
- const gfx::Size& pref_size(options_menu_button_->GetPreferredSize());
- bounds.set_x(GetCloseButtonBounds().x() - kOptionsDismissSpacing -
- pref_size.width());
- bounds.set_width(pref_size.width());
- bounds.ClampToCenteredSize(pref_size);
- return bounds;
-}
-
-gfx::Rect BalloonViewImpl::GetLabelBounds() const {
- gfx::Rect bounds(GetContentsBounds());
- bounds.set_height(GetShelfHeight());
- gfx::Size pref_size(source_label_->GetPreferredSize());
- bounds.Inset(kLabelLeftMargin, 0, bounds.width() -
- GetOptionsButtonBounds().x() + kLabelOptionsSpacing, 0);
- pref_size.set_width(bounds.width());
- bounds.ClampToCenteredSize(pref_size);
- return bounds;
-}
-
-void BalloonViewImpl::Show(Balloon* balloon) {
- if (closed_)
- return;
-
- ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
-
- balloon_ = balloon;
-
- const base::string16 source_label_text = l10n_util::GetStringFUTF16(
- IDS_NOTIFICATION_BALLOON_SOURCE_LABEL,
- balloon->notification().display_source());
-
- source_label_ = new views::Label(source_label_text);
- AddChildView(source_label_);
- options_menu_button_ =
- new views::MenuButton(NULL, base::string16(), this, false);
- AddChildView(options_menu_button_);
- close_button_ = new views::ImageButton(this);
- close_button_->SetTooltipText(l10n_util::GetStringUTF16(
- IDS_NOTIFICATION_BALLOON_DISMISS_LABEL));
- AddChildView(close_button_);
-
- // We have to create two windows: one for the contents and one for the
- // frame. Why?
- // * The contents is an html window which cannot be a
- // layered window (because it may have child windows for instance).
- // * The frame is a layered window so that we can have nicely rounded
- // corners using alpha blending (and we may do other alpha blending
- // effects).
- // Unfortunately, layered windows cannot have child windows. (Well, they can
- // but the child windows don't render).
- //
- // We carefully keep these two windows in sync to present the illusion of
- // one window to the user.
- //
- // We don't let the OS manage the RTL layout of these widgets, because
- // this code is already taking care of correctly reversing the layout.
- html_contents_.reset(new BalloonViewHost(balloon));
- html_contents_->SetPreferredSize(gfx::Size(10000, 10000));
- if (enable_web_ui_)
- html_contents_->EnableWebUI();
-
- html_container_ = new views::Widget;
- views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP);
- html_container_->Init(params);
- html_container_->SetContentsView(html_contents_->view());
-
- frame_container_ = new views::Widget;
- params.delegate = this;
- params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW;
- params.bounds = GetBoundsForFrameContainer();
- frame_container_->Init(params);
- frame_container_->SetContentsView(this);
- frame_container_->StackAboveWidget(html_container_);
-
- // GetContentsRectangle() is calculated relative to |frame_container_|. Make
- // sure |frame_container_| has bounds before we ask for
- // GetContentsRectangle().
- html_container_->SetBounds(GetContentsRectangle());
-
- // SetAlwaysOnTop should be called after StackAboveWidget because otherwise
- // the top-most flag will be removed.
- html_container_->SetAlwaysOnTop(true);
- frame_container_->SetAlwaysOnTop(true);
-
- close_button_->SetImage(views::CustomButton::STATE_NORMAL,
- rb.GetImageSkiaNamed(IDR_CLOSE_1));
- close_button_->SetImage(views::CustomButton::STATE_HOVERED,
- rb.GetImageSkiaNamed(IDR_CLOSE_1_H));
- close_button_->SetImage(views::CustomButton::STATE_PRESSED,
- rb.GetImageSkiaNamed(IDR_CLOSE_1_P));
- close_button_->SetBoundsRect(GetCloseButtonBounds());
- close_button_->SetBackground(SK_ColorBLACK,
- rb.GetImageSkiaNamed(IDR_CLOSE_1),
- rb.GetImageSkiaNamed(IDR_CLOSE_1_MASK));
-
- options_menu_button_->SetIcon(*rb.GetImageSkiaNamed(IDR_BALLOON_WRENCH));
- options_menu_button_->SetHoverIcon(
- *rb.GetImageSkiaNamed(IDR_BALLOON_WRENCH_H));
- options_menu_button_->SetPushedIcon(*rb.GetImageSkiaNamed(
- IDR_BALLOON_WRENCH_P));
- options_menu_button_->set_alignment(views::TextButton::ALIGN_CENTER);
- options_menu_button_->SetBorder(views::Border::NullBorder());
- options_menu_button_->SetBoundsRect(GetOptionsButtonBounds());
-
- source_label_->SetFontList(rb.GetFontList(ui::ResourceBundle::SmallFont));
- source_label_->SetBackgroundColor(kControlBarBackgroundColor);
- source_label_->SetEnabledColor(kControlBarTextColor);
- source_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
- source_label_->SetBoundsRect(GetLabelBounds());
-
- SizeContentsWindow();
- html_container_->Show();
- frame_container_->Show();
-
- notification_registrar_.Add(
- this, chrome::NOTIFICATION_NOTIFY_BALLOON_DISCONNECTED,
- content::Source<Balloon>(balloon));
-}
-
-void BalloonViewImpl::CreateOptionsMenu() {
- if (options_menu_model_.get())
- return;
- options_menu_model_.reset(new NotificationOptionsMenuModel(balloon_));
-}
-
-void BalloonViewImpl::GetContentsMask(const gfx::Rect& rect,
- gfx::Path* path) const {
- // This rounds the corners, and we also cut out a circle for the close
- // button, since we can't guarantee the ordering of two top-most windows.
- SkScalar radius = SkIntToScalar(views::BubbleBorder::GetCornerRadius());
- SkScalar spline_radius = radius -
- SkScalarMul(radius, (SK_ScalarSqrt2 - SK_Scalar1) * 4 / 3);
- SkScalar left = SkIntToScalar(0);
- SkScalar top = SkIntToScalar(0);
- SkScalar right = SkIntToScalar(rect.width());
- SkScalar bottom = SkIntToScalar(rect.height());
-
- path->moveTo(left, top);
- path->lineTo(right, top);
- path->lineTo(right, bottom - radius);
- path->cubicTo(right, bottom - spline_radius,
- right - spline_radius, bottom,
- right - radius, bottom);
- path->lineTo(left + radius, bottom);
- path->cubicTo(left + spline_radius, bottom,
- left, bottom - spline_radius,
- left, bottom - radius);
- path->lineTo(left, top);
- path->close();
-}
-
-void BalloonViewImpl::GetFrameMask(const gfx::Rect& rect,
- gfx::Path* path) const {
- SkScalar radius = SkIntToScalar(views::BubbleBorder::GetCornerRadius());
- SkScalar spline_radius = radius -
- SkScalarMul(radius, (SK_ScalarSqrt2 - SK_Scalar1) * 4 / 3);
- SkScalar left = SkIntToScalar(rect.x());
- SkScalar top = SkIntToScalar(rect.y());
- SkScalar right = SkIntToScalar(rect.right());
- SkScalar bottom = SkIntToScalar(rect.bottom());
-
- path->moveTo(left, bottom);
- path->lineTo(left, top + radius);
- path->cubicTo(left, top + spline_radius,
- left + spline_radius, top,
- left + radius, top);
- path->lineTo(right - radius, top);
- path->cubicTo(right - spline_radius, top,
- right, top + spline_radius,
- right, top + radius);
- path->lineTo(right, bottom);
- path->lineTo(left, bottom);
- path->close();
-}
-
-gfx::Point BalloonViewImpl::GetContentsOffset() const {
- return gfx::Point(kLeftShadowWidth + kLeftMargin,
- kTopShadowWidth + kTopMargin);
-}
-
-gfx::Rect BalloonViewImpl::GetBoundsForFrameContainer() const {
- return gfx::Rect(balloon_->GetPosition().x(), balloon_->GetPosition().y(),
- GetTotalWidth(), GetTotalHeight());
-}
-
-int BalloonViewImpl::GetShelfHeight() const {
- // TODO(johnnyg): add scaling here.
- int max_button_height = std::max(std::max(
- close_button_->GetPreferredSize().height(),
- options_menu_button_->GetPreferredSize().height()),
- source_label_->GetPreferredSize().height());
- return max_button_height + kShelfMargin * 2;
-}
-
-int BalloonViewImpl::GetBalloonFrameHeight() const {
- return GetTotalHeight() - GetShelfHeight();
-}
-
-int BalloonViewImpl::GetTotalWidth() const {
- return balloon_->content_size().width() +
- kLeftMargin + kRightMargin + kLeftShadowWidth + kRightShadowWidth;
-}
-
-int BalloonViewImpl::GetTotalHeight() const {
- return balloon_->content_size().height() +
- kTopMargin + kBottomMargin + kTopShadowWidth + kBottomShadowWidth +
- GetShelfHeight();
-}
-
-gfx::Rect BalloonViewImpl::GetContentsRectangle() const {
- if (!frame_container_)
- return gfx::Rect();
-
- gfx::Size content_size = balloon_->content_size();
- gfx::Point offset = GetContentsOffset();
- gfx::Rect frame_rect = frame_container_->GetWindowBoundsInScreen();
- return gfx::Rect(frame_rect.x() + offset.x(),
- frame_rect.y() + GetShelfHeight() + offset.y(),
- content_size.width(),
- content_size.height());
-}
-
-void BalloonViewImpl::OnPaint(gfx::Canvas* canvas) {
- DCHECK(canvas);
- // Paint the menu bar area white, with proper rounded corners.
- gfx::Path path;
- gfx::Rect rect = GetContentsBounds();
- rect.set_height(GetShelfHeight());
- GetFrameMask(rect, &path);
-
- SkPaint paint;
- paint.setAntiAlias(true);
- paint.setColor(kControlBarBackgroundColor);
- canvas->DrawPath(path, paint);
-
- // Draw a 1-pixel gray line between the content and the menu bar.
- int line_width = GetTotalWidth() - kLeftMargin - kRightMargin;
- canvas->FillRect(gfx::Rect(kLeftMargin, rect.bottom(), line_width, 1),
- kControlBarSeparatorLineColor);
- View::OnPaint(canvas);
- OnPaintBorder(canvas);
-}
-
-void BalloonViewImpl::OnBoundsChanged(const gfx::Rect& previous_bounds) {
- SizeContentsWindow();
-}
-
-void BalloonViewImpl::Observe(int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) {
- if (type != chrome::NOTIFICATION_NOTIFY_BALLOON_DISCONNECTED) {
- NOTREACHED();
- return;
- }
-
- // If the renderer process attached to this balloon is disconnected
- // (e.g., because of a crash), we want to close the balloon.
- notification_registrar_.Remove(
- this, chrome::NOTIFICATION_NOTIFY_BALLOON_DISCONNECTED,
- content::Source<Balloon>(balloon_));
- Close(false);
-}
diff --git a/chrome/browser/ui/views/notifications/balloon_view_views.h b/chrome/browser/ui/views/notifications/balloon_view_views.h
deleted file mode 100644
index 9802aaf..0000000
--- a/chrome/browser/ui/views/notifications/balloon_view_views.h
+++ /dev/null
@@ -1,169 +0,0 @@
-// 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.
-
-#ifndef CHROME_BROWSER_UI_VIEWS_NOTIFICATIONS_BALLOON_VIEW_VIEWS_H_
-#define CHROME_BROWSER_UI_VIEWS_NOTIFICATIONS_BALLOON_VIEW_VIEWS_H_
-
-#include "base/basictypes.h"
-#include "base/memory/scoped_ptr.h"
-#include "chrome/browser/notifications/balloon.h"
-#include "content/public/browser/notification_observer.h"
-#include "content/public/browser/notification_registrar.h"
-#include "ui/gfx/animation/animation_delegate.h"
-#include "ui/gfx/rect.h"
-#include "ui/views/controls/button/button.h"
-#include "ui/views/controls/button/menu_button_listener.h"
-#include "ui/views/widget/widget_delegate.h"
-
-class BalloonCollection;
-class BalloonViewHost;
-class NotificationOptionsMenuModel;
-
-namespace gfx {
-class Path;
-class SlideAnimation;
-}
-
-namespace views {
-class ImageButton;
-class Label;
-class MenuButton;
-class MenuRunner;
-}
-
-// A balloon view is the UI component for a desktop notification toast.
-// It draws a border, and within the border an HTML renderer.
-class BalloonViewImpl : public BalloonView,
- public views::MenuButtonListener,
- public views::WidgetDelegateView,
- public views::ButtonListener,
- public content::NotificationObserver,
- public gfx::AnimationDelegate {
- public:
- explicit BalloonViewImpl(BalloonCollection* collection);
- virtual ~BalloonViewImpl();
-
- // BalloonView interface.
- virtual void Show(Balloon* balloon) OVERRIDE;
- virtual void Update() OVERRIDE;
- virtual void RepositionToBalloon() OVERRIDE;
- virtual void Close(bool by_user) OVERRIDE;
- virtual gfx::Size GetSize() const OVERRIDE;
- virtual BalloonHost* GetHost() const OVERRIDE;
-
- void set_enable_web_ui(bool enable) { enable_web_ui_ = enable; }
-
- private:
- // views::View interface.
- virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
- virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE;
- virtual gfx::Size GetPreferredSize() OVERRIDE;
-
- // views::MenuButtonListener interface.
- virtual void OnMenuButtonClicked(views::View* source,
- const gfx::Point& point) OVERRIDE;
-
- // views::WidgetDelegate interface.
- virtual void OnDisplayChanged() OVERRIDE;
- virtual void OnWorkAreaChanged() OVERRIDE;
- virtual void DeleteDelegate() OVERRIDE;
-
- // views::ButtonListener interface.
- virtual void ButtonPressed(views::Button* sender,
- const ui::Event&) OVERRIDE;
-
- // content::NotificationObserver interface.
- virtual void Observe(int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) OVERRIDE;
-
- // gfx::AnimationDelegate interface.
- virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE;
-
- // Initializes the options menu.
- void CreateOptionsMenu();
-
- // Masks the contents to fit within the frame.
- void GetContentsMask(const gfx::Rect& contents_rect, gfx::Path* path) const;
-
- // Masks the frame for the rounded corners of the shadow-bubble.
- void GetFrameMask(const gfx::Rect&, gfx::Path* path) const;
-
- // Adjust the contents window size to be appropriate for the frame.
- void SizeContentsWindow();
-
- // The height of the balloon's shelf.
- // The shelf is where is close button is located.
- int GetShelfHeight() const;
-
- // The height of the part of the frame around the balloon.
- int GetBalloonFrameHeight() const;
-
- int GetTotalWidth() const;
- int GetTotalHeight() const;
-
- gfx::Rect GetCloseButtonBounds() const;
- gfx::Rect GetOptionsButtonBounds() const;
- gfx::Rect GetLabelBounds() const;
-
- // Where the balloon contents should be placed with respect to the top left
- // of the frame.
- gfx::Point GetContentsOffset() const;
-
- // Where the balloon contents should be in screen coordinates.
- gfx::Rect GetContentsRectangle() const;
-
- // Returns the bounds for the frame container.
- gfx::Rect GetBoundsForFrameContainer() const;
-
- // Non-owned pointer to the balloon which owns this object.
- Balloon* balloon_;
-
- // Non-owned pointer to the balloon collection this is a part of.
- BalloonCollection* collection_;
-
- // The window that contains the frame of the notification.
- // Pointer owned by the View subclass.
- views::Widget* frame_container_;
-
- // The window that contains the contents of the notification.
- // Pointer owned by the View subclass.
- views::Widget* html_container_;
-
- // The renderer of the HTML contents.
- scoped_ptr<BalloonViewHost> html_contents_;
-
- // Pointer to sub-view is owned by the View sub-class.
- views::ImageButton* close_button_;
-
- // Pointer to sub-view is owned by View class.
- views::Label* source_label_;
-
- // An animation to move the balloon on the screen as its position changes.
- scoped_ptr<gfx::SlideAnimation> animation_;
- gfx::Rect anim_frame_start_;
- gfx::Rect anim_frame_end_;
-
- // The options menu.
- scoped_ptr<NotificationOptionsMenuModel> options_menu_model_;
- scoped_ptr<views::MenuRunner> menu_runner_;
- views::MenuButton* options_menu_button_;
-
- content::NotificationRegistrar notification_registrar_;
-
- // Set to true if this is browser generate web UI.
- bool enable_web_ui_;
-
- // Most recent value passed to Close().
- bool closed_by_user_;
-
- // Has Close() been invoked? Use to ensure we don't attempt to do anything
- // once Close() has been invoked. This is important as Close() destroys state
- // such that other BalloonView methods may crash if used after Close().
- bool closed_;
-
- DISALLOW_COPY_AND_ASSIGN(BalloonViewImpl);
-};
-
-#endif // CHROME_BROWSER_UI_VIEWS_NOTIFICATIONS_BALLOON_VIEW_VIEWS_H_
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index 0c24c94..cc6cdfe 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -2481,8 +2481,6 @@
'browser/task_manager/extension_information.h',
'browser/task_manager/guest_information.cc',
'browser/task_manager/guest_information.h',
- 'browser/task_manager/notification_resource_provider.cc',
- 'browser/task_manager/notification_resource_provider.h',
'browser/task_manager/panel_information.cc',
'browser/task_manager/panel_information.h',
'browser/task_manager/printing_information.cc',
@@ -3004,18 +3002,6 @@
'browser/icon_loader_linux.cc',
'browser/icon_manager_linux.cc',
'browser/idle_linux.cc',
- 'browser/notifications/balloon_collection.cc',
- 'browser/notifications/balloon_collection.h',
- 'browser/notifications/balloon_collection_base.cc',
- 'browser/notifications/balloon_collection_base.h',
- 'browser/notifications/balloon_collection_impl.cc',
- 'browser/notifications/balloon_collection_impl.h',
- 'browser/notifications/balloon_host.cc',
- 'browser/notifications/balloon_host.h',
- 'browser/notifications/balloon_notification_ui_manager.cc',
- 'browser/notifications/balloon_notification_ui_manager.h',
- 'browser/notifications/notification_options_menu_model.cc',
- 'browser/notifications/notification_options_menu_model.h',
'browser/password_manager/native_backend_gnome_x.cc',
'browser/password_manager/native_backend_gnome_x.h',
'browser/password_manager/native_backend_kwallet_x.cc',
@@ -3049,8 +3035,6 @@
'browser/sync/sync_global_error.h',
'browser/sync/sync_global_error_factory.cc',
'browser/sync/sync_global_error_factory.h',
- 'browser/task_manager/notification_resource_provider.cc',
- 'browser/task_manager/notification_resource_provider.h',
'browser/themes/theme_service_aurax11.cc',
'browser/themes/theme_service_aurax11.h',
'browser/upgrade_detector_impl.cc',
@@ -3166,6 +3150,23 @@
},
}],
],
+ }, {
+ 'sources!': [
+ 'browser/notifications/balloon_collection.cc',
+ 'browser/notifications/balloon_collection.h',
+ 'browser/notifications/balloon_collection_base.cc',
+ 'browser/notifications/balloon_collection_base.h',
+ 'browser/notifications/balloon_collection_impl.cc',
+ 'browser/notifications/balloon_collection_impl.h',
+ 'browser/notifications/balloon_host.cc',
+ 'browser/notifications/balloon_host.h',
+ 'browser/notifications/balloon_notification_ui_manager.cc',
+ 'browser/notifications/balloon_notification_ui_manager.h',
+ 'browser/notifications/notification_options_menu_model.cc',
+ 'browser/notifications/notification_options_menu_model.h',
+ 'browser/task_manager/notification_resource_provider.cc',
+ 'browser/task_manager/notification_resource_provider.h',
+ ]
}],
['input_speech==0', {
'sources/': [
diff --git a/chrome/chrome_browser_ui.gypi b/chrome/chrome_browser_ui.gypi
index 2d386ef..14ada75 100644
--- a/chrome/chrome_browser_ui.gypi
+++ b/chrome/chrome_browser_ui.gypi
@@ -930,15 +930,6 @@
'browser/ui/cocoa/multi_key_equivalent_button.mm',
'browser/ui/cocoa/new_tab_button.h',
'browser/ui/cocoa/new_tab_button.mm',
- 'browser/ui/cocoa/notifications/balloon_collection_cocoa.mm',
- 'browser/ui/cocoa/notifications/balloon_controller.h',
- 'browser/ui/cocoa/notifications/balloon_controller.mm',
- 'browser/ui/cocoa/notifications/balloon_view.h',
- 'browser/ui/cocoa/notifications/balloon_view.mm',
- 'browser/ui/cocoa/notifications/balloon_view_bridge.h',
- 'browser/ui/cocoa/notifications/balloon_view_bridge.mm',
- 'browser/ui/cocoa/notifications/balloon_view_host_mac.h',
- 'browser/ui/cocoa/notifications/balloon_view_host_mac.mm',
'browser/ui/cocoa/notifications/message_center_tray_bridge.h',
'browser/ui/cocoa/notifications/message_center_tray_bridge.mm',
'browser/ui/cocoa/nsmenuitem_additions.h',
@@ -2060,11 +2051,6 @@
'browser/ui/views/message_center/web_notification_tray.h',
'browser/ui/views/message_center/web_notification_tray.cc',
'browser/ui/views/message_center/web_notification_tray_win.cc',
- 'browser/ui/views/notifications/balloon_collection_views.cc',
- 'browser/ui/views/notifications/balloon_view_host.cc',
- 'browser/ui/views/notifications/balloon_view_host.h',
- 'browser/ui/views/notifications/balloon_view_views.cc',
- 'browser/ui/views/notifications/balloon_view_views.h',
'browser/ui/views/omnibox/omnibox_popup_contents_view.cc',
'browser/ui/views/omnibox/omnibox_popup_contents_view.h',
'browser/ui/views/omnibox/omnibox_result_view.cc',
@@ -2880,10 +2866,6 @@
'browser/ui/views/frame/native_browser_frame_factory_desktop_ash.cc',
'browser/ui/views/javascript_app_modal_event_blocker_x11.cc',
'browser/ui/views/javascript_app_modal_event_blocker_x11.h',
- 'browser/ui/views/notifications/balloon_view_host.cc',
- 'browser/ui/views/notifications/balloon_view_host.h',
- 'browser/ui/views/notifications/balloon_view_views.cc',
- 'browser/ui/views/notifications/balloon_view_views.h',
'browser/ui/views/screen_capture_notification_ui_views.cc',
'browser/ui/views/tabs/window_finder_x11.cc',
'browser/ui/webui/help/version_updater_basic.cc',
@@ -3357,7 +3339,6 @@
['toolkit_uses_gtk==1', {
'sources/': [
['exclude', '^browser/ui/toolbar/bookmark_sub_menu_model.cc'],
- ['exclude', '^browser/ui/views/notifications/balloon_collection_views.cc'],
],
}],
# x11 build
diff --git a/chrome/chrome_nibs.gypi b/chrome/chrome_nibs.gypi
index 551841e..2cc0dea 100644
--- a/chrome/chrome_nibs.gypi
+++ b/chrome/chrome_nibs.gypi
@@ -59,7 +59,6 @@
'app/nibs/GlobalErrorBubble.xib',
'app/nibs/HungRendererDialog.xib',
'app/nibs/InfoBar.xib',
- 'app/nibs/Notification.xib',
'app/nibs/Panel.xib',
'app/nibs/SadTab.xib',
], # mac_untranslated_xibs
diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi
index 68faf5c..355ce27 100644
--- a/chrome/chrome_tests.gypi
+++ b/chrome/chrome_tests.gypi
@@ -75,7 +75,6 @@
'browser/mouseleave_browsertest.cc',
'browser/notifications/desktop_notifications_unittest.cc',
'browser/notifications/desktop_notifications_unittest.h',
- 'browser/notifications/notification_browsertest.cc',
'browser/password_manager/password_generation_interactive_uitest.cc',
'browser/renderer_context_menu/render_view_context_menu_browsertest_util.cc',
'browser/renderer_context_menu/render_view_context_menu_browsertest_util.h',
@@ -164,6 +163,12 @@
'sources!': [
'browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc',
],
+ }, {
+ 'sources!': [
+ 'browser/notifications/desktop_notifications_unittest.cc',
+ 'browser/notifications/desktop_notifications_unittest.h',
+ 'browser/notifications/notification_browsertest.cc',
+ ]
}],
['OS=="linux" and use_aura==1', {
# TODO(gbillock): aura linux does not support the automation for
@@ -214,8 +219,6 @@
'sources!': [
# TODO(port): These tests fail because they don't have a Screen,
# but expect one.
- 'browser/notifications/desktop_notifications_unittest.cc',
- 'browser/notifications/desktop_notifications_unittest.h',
# TODO(port): I have no idea about the crashes in here; there's
# nothing obviously wrong. It doesn't run on gtk today, either.
'browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc',
@@ -326,9 +329,6 @@
],
'sources!': [
# chromeos does not use cross-platform panels
- 'browser/notifications/desktop_notifications_unittest.cc',
- 'browser/notifications/desktop_notifications_unittest.h',
- 'browser/notifications/notification_browsertest.cc',
'browser/ui/panels/detached_panel_browsertest.cc',
'browser/ui/panels/docked_panel_browsertest.cc',
'browser/ui/panels/panel_browsertest.cc',
diff --git a/chrome/chrome_tests_unit.gypi b/chrome/chrome_tests_unit.gypi
index dc10136..a7fc63b 100644
--- a/chrome/chrome_tests_unit.gypi
+++ b/chrome/chrome_tests_unit.gypi
@@ -1613,7 +1613,6 @@
'browser/ui/cocoa/location_bar/selected_keyword_decoration_unittest.mm',
'browser/ui/cocoa/media_picker/desktop_media_picker_controller_unittest.mm',
'browser/ui/cocoa/menu_button_unittest.mm',
- 'browser/ui/cocoa/notifications/balloon_controller_unittest.mm',
'browser/ui/cocoa/notifications/message_center_tray_bridge_unittest.mm',
'browser/ui/cocoa/nsmenuitem_additions_unittest.mm',
'browser/ui/cocoa/nsview_additions_unittest.mm',