summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-05 14:25:30 +0000
committerthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-05 14:25:30 +0000
commitf5214846d509a74b9899786b648a61a67a312918 (patch)
treed78332223aa6655367d5ea771276fea9b9b39227
parent04e06c5b3260d4070a42caafec38c4010f5a9543 (diff)
downloadchromium_src-f5214846d509a74b9899786b648a61a67a312918.zip
chromium_src-f5214846d509a74b9899786b648a61a67a312918.tar.gz
chromium_src-f5214846d509a74b9899786b648a61a67a312918.tar.bz2
Mac: Implement geolocation exceptions dialog.
xib changes: Content settings window: Enable & hook up "exceptions" button. The dialog is not "live" (i.e. if it's open while settings are deleted through the bubble, the window is only updated after closing & reopening it). It's not possible to do any editing in the window, only deleting. This matches windows/linux. http://imgur.com/q7qMK BUG=39818 TEST=Go to a few geolocation pages, click allow/deny. Then go to content settings->locations->exceptions, the visited pages should be listed. Review URL: http://codereview.chromium.org/1566015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43610 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/app/nibs/ContentSettings.xib18
-rw-r--r--chrome/app/nibs/GeolocationExceptionsWindow.xib730
-rw-r--r--chrome/browser/cocoa/content_exceptions_window_controller.h4
-rw-r--r--chrome/browser/cocoa/content_exceptions_window_controller.mm10
-rw-r--r--chrome/browser/cocoa/content_exceptions_window_controller_unittest.mm2
-rw-r--r--chrome/browser/cocoa/content_settings_dialog_controller.mm6
-rw-r--r--chrome/browser/cocoa/cookies_window_controller.h2
-rw-r--r--chrome/browser/cocoa/geolocation_exceptions_window_controller.h36
-rw-r--r--chrome/browser/cocoa/geolocation_exceptions_window_controller.mm211
-rw-r--r--chrome/browser/cocoa/geolocation_exceptions_window_controller_unittest.mm59
-rw-r--r--chrome/browser/cocoa/keyword_editor_cocoa_controller.h4
-rwxr-xr-xchrome/browser/geolocation/geolocation_content_settings_map.cc4
-rwxr-xr-xchrome/chrome_browser.gypi3
-rw-r--r--chrome/chrome_dll.gypi1
-rw-r--r--chrome/chrome_tests.gypi1
15 files changed, 1068 insertions, 23 deletions
diff --git a/chrome/app/nibs/ContentSettings.xib b/chrome/app/nibs/ContentSettings.xib
index f339394..7ec8a56 100644
--- a/chrome/app/nibs/ContentSettings.xib
+++ b/chrome/app/nibs/ContentSettings.xib
@@ -8,7 +8,7 @@
<string key="IBDocument.HIToolboxVersion">353.00</string>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="120"/>
+ <integer value="2"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -1931,7 +1931,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<reference key="NSSuperview" ref="1023784233"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="302650296">
- <int key="NSCellFlags">604110336</int>
+ <int key="NSCellFlags">67239424</int>
<int key="NSCellFlags2">134217728</int>
<string key="NSContents">^IDS_COOKIES_EXCEPTIONS_BUTTON</string>
<reference key="NSSupport" ref="793851927"/>
@@ -2256,6 +2256,14 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
</object>
<int key="connectionID">133</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">showGeolocationExceptions:</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="393910995"/>
+ </object>
+ <int key="connectionID">134</int>
+ </object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@@ -3013,9 +3021,9 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{154, 430}, {570, 352}}</string>
+ <string>{{295, 402}, {570, 352}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{154, 430}, {570, 352}}</string>
+ <string>{{295, 402}, {570, 352}}</string>
<reference ref="6"/>
<string>{196, 240}</string>
<string>{{357, 418}, {480, 270}}</string>
@@ -3122,7 +3130,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">133</int>
+ <int key="maxID">134</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
diff --git a/chrome/app/nibs/GeolocationExceptionsWindow.xib b/chrome/app/nibs/GeolocationExceptionsWindow.xib
new file mode 100644
index 0000000..cc8a7ef
--- /dev/null
+++ b/chrome/app/nibs/GeolocationExceptionsWindow.xib
@@ -0,0 +1,730 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.03">
+ <data>
+ <int key="IBDocument.SystemTarget">1050</int>
+ <string key="IBDocument.SystemVersion">9L31a</string>
+ <string key="IBDocument.InterfaceBuilderVersion">677</string>
+ <string key="IBDocument.AppKitVersion">949.54</string>
+ <string key="IBDocument.HIToolboxVersion">353.00</string>
+ <object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <integer value="2"/>
+ </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">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ </object>
+ <object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSCustomObject" id="1001">
+ <string key="NSClassName">GeolocationExceptionsWindowController</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="1005">
+ <int key="NSWindowStyleMask">15</int>
+ <int key="NSWindowBacking">2</int>
+ <string key="NSWindowRect">{{477, 301}, {480, 285}}</string>
+ <int key="NSWTFlags">536870912</int>
+ <string key="NSWindowTitle">^IDS_GEOLOCATION_EXCEPTION_TITLE</string>
+ <string key="NSWindowClass">NSWindow</string>
+ <nil key="NSViewClass"/>
+ <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string>
+ <string key="NSWindowContentMinSize">{200, 100}</string>
+ <object class="NSView" key="NSWindowView" id="1006">
+ <reference key="NSNextResponder"/>
+ <int key="NSvFlags">256</int>
+ <object class="NSMutableArray" key="NSSubviews">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSScrollView" id="832680793">
+ <reference key="NSNextResponder" ref="1006"/>
+ <int key="NSvFlags">274</int>
+ <object class="NSMutableArray" key="NSSubviews">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSClipView" id="854753160">
+ <reference key="NSNextResponder" ref="832680793"/>
+ <int key="NSvFlags">2304</int>
+ <object class="NSMutableArray" key="NSSubviews">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSTableView" id="178750169">
+ <reference key="NSNextResponder" ref="854753160"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrameSize">{480, 233}</string>
+ <reference key="NSSuperview" ref="854753160"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSTableHeaderView" key="NSHeaderView" id="1052514209">
+ <reference key="NSNextResponder" ref="522115304"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrameSize">{480, 17}</string>
+ <reference key="NSSuperview" ref="522115304"/>
+ <reference key="NSTableView" ref="178750169"/>
+ </object>
+ <object class="_NSCornerView" key="NSCornerView" id="274818157">
+ <reference key="NSNextResponder" ref="832680793"/>
+ <int key="NSvFlags">-2147483392</int>
+ <string key="NSFrame">{{-26, 0}, {16, 17}}</string>
+ <reference key="NSSuperview" ref="832680793"/>
+ </object>
+ <object class="NSMutableArray" key="NSTableColumns">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSTableColumn" id="20203331">
+ <string key="NSIdentifier">hostname</string>
+ <double key="NSWidth">3.020000e+02</double>
+ <double key="NSMinWidth">4.000000e+01</double>
+ <double key="NSMaxWidth">1.000000e+03</double>
+ <object class="NSTableHeaderCell" key="NSHeaderCell">
+ <int key="NSCellFlags">75628096</int>
+ <int key="NSCellFlags2">2048</int>
+ <string key="NSContents">^IDS_EXCEPTIONS_HOSTNAME_HEADER</string>
+ <object class="NSFont" key="NSSupport" id="26">
+ <string key="NSName">LucidaGrande</string>
+ <double key="NSSize">1.100000e+01</double>
+ <int key="NSfFlags">3100</int>
+ </object>
+ <object class="NSColor" key="NSBackgroundColor" id="531830935">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MC4zMzMzMzI5OQA</bytes>
+ </object>
+ <object class="NSColor" key="NSTextColor" id="1021472174">
+ <int key="NSColorSpace">6</int>
+ <string key="NSCatalogName">System</string>
+ <string key="NSColorName">headerTextColor</string>
+ <object class="NSColor" key="NSColor" id="688302513">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MAA</bytes>
+ </object>
+ </object>
+ </object>
+ <object class="NSTextFieldCell" key="NSDataCell" id="988046756">
+ <int key="NSCellFlags">337772096</int>
+ <int key="NSCellFlags2">2048</int>
+ <string key="NSContents">Text Cell</string>
+ <object class="NSFont" key="NSSupport" id="22228631">
+ <string key="NSName">LucidaGrande</string>
+ <double key="NSSize">1.300000e+01</double>
+ <int key="NSfFlags">1044</int>
+ </object>
+ <reference key="NSControlView" ref="178750169"/>
+ <object class="NSColor" key="NSBackgroundColor" id="241443011">
+ <int key="NSColorSpace">6</int>
+ <string key="NSCatalogName">System</string>
+ <string key="NSColorName">controlBackgroundColor</string>
+ <object class="NSColor" key="NSColor" id="142733695">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MC42NjY2NjY2OQA</bytes>
+ </object>
+ </object>
+ <object class="NSColor" key="NSTextColor" id="730223351">
+ <int key="NSColorSpace">6</int>
+ <string key="NSCatalogName">System</string>
+ <string key="NSColorName">controlTextColor</string>
+ <reference key="NSColor" ref="688302513"/>
+ </object>
+ </object>
+ <int key="NSResizingMask">3</int>
+ <bool key="NSIsResizeable">YES</bool>
+ <bool key="NSIsEditable">YES</bool>
+ <reference key="NSTableView" ref="178750169"/>
+ </object>
+ <object class="NSTableColumn" id="332085935">
+ <string key="NSIdentifier">action</string>
+ <double key="NSWidth">1.720000e+02</double>
+ <double key="NSMinWidth">4.000000e+01</double>
+ <double key="NSMaxWidth">1.000000e+03</double>
+ <object class="NSTableHeaderCell" key="NSHeaderCell">
+ <int key="NSCellFlags">75628096</int>
+ <int key="NSCellFlags2">2048</int>
+ <string key="NSContents">^IDS_EXCEPTIONS_ACTION_HEADER</string>
+ <reference key="NSSupport" ref="26"/>
+ <reference key="NSBackgroundColor" ref="531830935"/>
+ <reference key="NSTextColor" ref="1021472174"/>
+ </object>
+ <object class="NSTextFieldCell" key="NSDataCell" id="839692131">
+ <int key="NSCellFlags">67239488</int>
+ <int key="NSCellFlags2">272761856</int>
+ <string key="NSContents">Text</string>
+ <reference key="NSSupport" ref="26"/>
+ <reference key="NSControlView" ref="178750169"/>
+ <object class="NSColor" key="NSBackgroundColor">
+ <int key="NSColorSpace">6</int>
+ <string key="NSCatalogName">System</string>
+ <string key="NSColorName">controlColor</string>
+ <reference key="NSColor" ref="142733695"/>
+ </object>
+ <reference key="NSTextColor" ref="730223351"/>
+ </object>
+ <int key="NSResizingMask">3</int>
+ <bool key="NSIsResizeable">YES</bool>
+ <bool key="NSIsEditable">YES</bool>
+ <reference key="NSTableView" ref="178750169"/>
+ </object>
+ </object>
+ <double key="NSIntercellSpacingWidth">3.000000e+00</double>
+ <double key="NSIntercellSpacingHeight">2.000000e+00</double>
+ <object class="NSColor" key="NSBackgroundColor">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MQA</bytes>
+ </object>
+ <object class="NSColor" key="NSGridColor">
+ <int key="NSColorSpace">6</int>
+ <string key="NSCatalogName">System</string>
+ <string key="NSColorName">gridColor</string>
+ <object class="NSColor" key="NSColor">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MC41AA</bytes>
+ </object>
+ </object>
+ <double key="NSRowHeight">1.700000e+01</double>
+ <int key="NSTvFlags">1379958784</int>
+ <int key="NSColumnAutoresizingStyle">1</int>
+ <int key="NSDraggingSourceMaskForLocal">15</int>
+ <int key="NSDraggingSourceMaskForNonLocal">0</int>
+ <bool key="NSAllowsTypeSelect">YES</bool>
+ </object>
+ </object>
+ <string key="NSFrame">{{1, 17}, {480, 233}}</string>
+ <reference key="NSSuperview" ref="832680793"/>
+ <reference key="NSNextKeyView" ref="178750169"/>
+ <reference key="NSDocView" ref="178750169"/>
+ <reference key="NSBGColor" ref="241443011"/>
+ <int key="NScvFlags">4</int>
+ </object>
+ <object class="NSScroller" id="984908608">
+ <reference key="NSNextResponder" ref="832680793"/>
+ <int key="NSvFlags">-2147483392</int>
+ <string key="NSFrame">{{466, 17}, {15, 218}}</string>
+ <reference key="NSSuperview" ref="832680793"/>
+ <reference key="NSTarget" ref="832680793"/>
+ <string key="NSAction">_doScroller:</string>
+ <double key="NSCurValue">1.000000e+00</double>
+ <double key="NSPercent">9.356223e-01</double>
+ </object>
+ <object class="NSScroller" id="689783017">
+ <reference key="NSNextResponder" ref="832680793"/>
+ <int key="NSvFlags">-2147483392</int>
+ <string key="NSFrame">{{1, 235}, {465, 15}}</string>
+ <reference key="NSSuperview" ref="832680793"/>
+ <int key="NSsFlags">1</int>
+ <reference key="NSTarget" ref="832680793"/>
+ <string key="NSAction">_doScroller:</string>
+ <double key="NSPercent">9.979210e-01</double>
+ </object>
+ <object class="NSClipView" id="522115304">
+ <reference key="NSNextResponder" ref="832680793"/>
+ <int key="NSvFlags">2304</int>
+ <object class="NSMutableArray" key="NSSubviews">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="1052514209"/>
+ </object>
+ <string key="NSFrame">{{1, 0}, {480, 17}}</string>
+ <reference key="NSSuperview" ref="832680793"/>
+ <reference key="NSNextKeyView" ref="1052514209"/>
+ <reference key="NSDocView" ref="1052514209"/>
+ <reference key="NSBGColor" ref="241443011"/>
+ <int key="NScvFlags">4</int>
+ </object>
+ <reference ref="274818157"/>
+ </object>
+ <string key="NSFrame">{{-1, 35}, {482, 251}}</string>
+ <reference key="NSSuperview" ref="1006"/>
+ <reference key="NSNextKeyView" ref="854753160"/>
+ <int key="NSsFlags">562</int>
+ <reference key="NSVScroller" ref="984908608"/>
+ <reference key="NSHScroller" ref="689783017"/>
+ <reference key="NSContentView" ref="854753160"/>
+ <reference key="NSHeaderClipView" ref="522115304"/>
+ <reference key="NSCornerView" ref="274818157"/>
+ <bytes key="NSScrollAmts">QSAAAEEgAABBmAAAQZgAAA</bytes>
+ </object>
+ <object class="NSButton" id="297568762">
+ <reference key="NSNextResponder" ref="1006"/>
+ <int key="NSvFlags">292</int>
+ <string key="NSFrame">{{7, 5}, {25, 25}}</string>
+ <reference key="NSSuperview" ref="1006"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="655968889">
+ <int key="NSCellFlags">-2080244224</int>
+ <int key="NSCellFlags2">134217728</int>
+ <string key="NSContents"/>
+ <reference key="NSSupport" ref="22228631"/>
+ <reference key="NSControlView" ref="297568762"/>
+ <int key="NSButtonFlags">-2033958657</int>
+ <int key="NSButtonFlags2">163</int>
+ <object class="NSCustomResource" key="NSNormalImage">
+ <string key="NSClassName">NSImage</string>
+ <string key="NSResourceName">NSRemoveTemplate</string>
+ </object>
+ <string key="NSAlternateContents"/>
+ <string key="NSKeyEquivalent"/>
+ <int key="NSPeriodicDelay">400</int>
+ <int key="NSPeriodicInterval">75</int>
+ </object>
+ </object>
+ <object class="NSButton" id="882966747">
+ <reference key="NSNextResponder" ref="1006"/>
+ <int key="NSvFlags">292</int>
+ <string key="NSFrame">{{40, 5}, {96, 25}}</string>
+ <reference key="NSSuperview" ref="1006"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="1032008525">
+ <int key="NSCellFlags">-2080244224</int>
+ <int key="NSCellFlags2">134217728</int>
+ <string key="NSContents">^IDS_EXCEPTIONS_REMOVEALL_BUTTON</string>
+ <reference key="NSSupport" ref="22228631"/>
+ <reference key="NSControlView" ref="882966747"/>
+ <int key="NSButtonFlags">-2038152961</int>
+ <int key="NSButtonFlags2">163</int>
+ <string key="NSAlternateContents"/>
+ <string key="NSKeyEquivalent"/>
+ <int key="NSPeriodicDelay">400</int>
+ <int key="NSPeriodicInterval">75</int>
+ </object>
+ </object>
+ </object>
+ <string key="NSFrameSize">{480, 285}</string>
+ <reference key="NSSuperview"/>
+ </object>
+ <string key="NSScreenRect">{{0, 0}, {1440, 878}}</string>
+ <string key="NSMinSize">{200, 122}</string>
+ <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string>
+ </object>
+ <object class="NSCustomObject" id="792052397">
+ <string key="NSClassName">ChromeUILocalizer</string>
+ </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">window</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="1005"/>
+ </object>
+ <int key="connectionID">3</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">delegate</string>
+ <reference key="source" ref="1005"/>
+ <reference key="destination" ref="1001"/>
+ </object>
+ <int key="connectionID">4</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">owner_</string>
+ <reference key="source" ref="792052397"/>
+ <reference key="destination" ref="1001"/>
+ </object>
+ <int key="connectionID">21</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">tableView_</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="178750169"/>
+ </object>
+ <int key="connectionID">25</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">dataSource</string>
+ <reference key="source" ref="178750169"/>
+ <reference key="destination" ref="1001"/>
+ </object>
+ <int key="connectionID">26</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">delegate</string>
+ <reference key="source" ref="178750169"/>
+ <reference key="destination" ref="1001"/>
+ </object>
+ <int key="connectionID">27</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">removeException:</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="297568762"/>
+ </object>
+ <int key="connectionID">34</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">removeAllExceptions:</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="882966747"/>
+ </object>
+ <int key="connectionID">35</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">removeButton_</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="297568762"/>
+ </object>
+ <int key="connectionID">36</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">removeAllButton_</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="882966747"/>
+ </object>
+ <int key="connectionID">37</int>
+ </object>
+ </object>
+ <object class="IBMutableOrderedSet" key="objectRecords">
+ <object class="NSArray" key="orderedObjects">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBObjectRecord">
+ <int key="objectID">0</int>
+ <object class="NSArray" key="object" id="13599172">
+ <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="13599172"/>
+ <string type="base64-UTF8" key="objectName">RmlsZSdzIE93bmVyA</string>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">-1</int>
+ <reference key="object" ref="1003"/>
+ <reference key="parent" ref="13599172"/>
+ <string key="objectName">First Responder</string>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">-3</int>
+ <reference key="object" ref="1004"/>
+ <reference key="parent" ref="13599172"/>
+ <string key="objectName">Application</string>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">1</int>
+ <reference key="object" ref="1005"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="1006"/>
+ </object>
+ <reference key="parent" ref="13599172"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">2</int>
+ <reference key="object" ref="1006"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="832680793"/>
+ <reference ref="297568762"/>
+ <reference ref="882966747"/>
+ </object>
+ <reference key="parent" ref="1005"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">5</int>
+ <reference key="object" ref="832680793"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="984908608"/>
+ <reference ref="689783017"/>
+ <reference ref="178750169"/>
+ <reference ref="1052514209"/>
+ </object>
+ <reference key="parent" ref="1006"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">6</int>
+ <reference key="object" ref="984908608"/>
+ <reference key="parent" ref="832680793"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">7</int>
+ <reference key="object" ref="689783017"/>
+ <reference key="parent" ref="832680793"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">8</int>
+ <reference key="object" ref="178750169"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="20203331"/>
+ <reference ref="332085935"/>
+ </object>
+ <reference key="parent" ref="832680793"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">9</int>
+ <reference key="object" ref="1052514209"/>
+ <reference key="parent" ref="832680793"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">10</int>
+ <reference key="object" ref="20203331"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="988046756"/>
+ </object>
+ <reference key="parent" ref="178750169"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">11</int>
+ <reference key="object" ref="332085935"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="839692131"/>
+ </object>
+ <reference key="parent" ref="178750169"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">13</int>
+ <reference key="object" ref="988046756"/>
+ <reference key="parent" ref="20203331"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">16</int>
+ <reference key="object" ref="297568762"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="655968889"/>
+ </object>
+ <reference key="parent" ref="1006"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">17</int>
+ <reference key="object" ref="655968889"/>
+ <reference key="parent" ref="297568762"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">18</int>
+ <reference key="object" ref="882966747"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="1032008525"/>
+ </object>
+ <reference key="parent" ref="1006"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">19</int>
+ <reference key="object" ref="1032008525"/>
+ <reference key="parent" ref="882966747"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">20</int>
+ <reference key="object" ref="792052397"/>
+ <reference key="parent" ref="13599172"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">38</int>
+ <reference key="object" ref="839692131"/>
+ <reference key="parent" ref="332085935"/>
+ </object>
+ </object>
+ </object>
+ <object class="NSMutableDictionary" key="flattenedProperties">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSMutableArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>-1.IBPluginDependency</string>
+ <string>-2.IBPluginDependency</string>
+ <string>-3.IBPluginDependency</string>
+ <string>1.IBEditorWindowLastContentRect</string>
+ <string>1.IBPluginDependency</string>
+ <string>1.IBWindowTemplateEditedContentRect</string>
+ <string>1.NSWindowTemplate.visibleAtLaunch</string>
+ <string>1.WindowOrigin</string>
+ <string>1.editorWindowContentRectSynchronizationRect</string>
+ <string>1.windowTemplate.hasMinSize</string>
+ <string>1.windowTemplate.minSize</string>
+ <string>10.IBPluginDependency</string>
+ <string>11.IBPluginDependency</string>
+ <string>13.IBPluginDependency</string>
+ <string>16.IBPluginDependency</string>
+ <string>17.IBPluginDependency</string>
+ <string>18.IBPluginDependency</string>
+ <string>19.IBPluginDependency</string>
+ <string>2.IBPluginDependency</string>
+ <string>20.IBPluginDependency</string>
+ <string>38.IBPluginDependency</string>
+ <string>5.IBPluginDependency</string>
+ <string>6.IBPluginDependency</string>
+ <string>7.IBPluginDependency</string>
+ <string>8.IBPluginDependency</string>
+ <string>9.IBPluginDependency</string>
+ </object>
+ <object class="NSMutableArray" 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>{{128, 406}, {480, 285}}</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>{{128, 406}, {480, 285}}</string>
+ <integer value="1"/>
+ <string>{196, 240}</string>
+ <string>{{357, 418}, {480, 270}}</string>
+ <boolean value="YES"/>
+ <string>{200, 100}</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>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>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>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ </object>
+ <nil key="activeLocalization"/>
+ <object class="NSMutableDictionary" key="localizations">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ </object>
+ <nil key="sourceID"/>
+ <int key="maxID">38</int>
+ </object>
+ <object class="IBClassDescriber" key="IBDocument.Classes">
+ <object class="NSMutableArray" key="referencedPartialClassDescriptions">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBPartialClassDescription">
+ <string key="className">ChromeUILocalizer</string>
+ <string key="superclassName">GTMUILocalizer</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">browser/cocoa/ui_localizer.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">GTMUILocalizer</string>
+ <string key="superclassName">NSObject</string>
+ <object class="NSMutableDictionary" key="outlets">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSMutableArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>otherObjectToLocalize_</string>
+ <string>owner_</string>
+ <string>yetAnotherObjectToLocalize_</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ </object>
+ </object>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">../third_party/GTM/AppKit/GTMUILocalizer.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">GeolocationExceptionsWindowController</string>
+ <string key="superclassName">NSWindowController</string>
+ <object class="NSMutableDictionary" key="actions">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSMutableArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>cancel:</string>
+ <string>removeAllExceptions:</string>
+ <string>removeException:</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ </object>
+ </object>
+ <object class="NSMutableDictionary" key="outlets">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSMutableArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>removeAllButton_</string>
+ <string>removeButton_</string>
+ <string>tableView_</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>NSButton</string>
+ <string>NSButton</string>
+ <string>NSTableView</string>
+ </object>
+ </object>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">browser/cocoa/geolocation_exceptions_window_controller.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">browser/cocoa/status_bubble_mac.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">browser/cocoa/tab_strip_model_observer_bridge.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSWindow</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">browser/cocoa/chrome_browser_window.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSWindow</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">browser/cocoa/themed_window.h</string>
+ </object>
+ </object>
+ </object>
+ </object>
+ <int key="IBDocument.localizationMode">0</int>
+ <string key="IBDocument.LastKnownRelativeProjectPath">../../chrome.xcodeproj</string>
+ <int key="IBDocument.defaultPropertyAccessControl">3</int>
+ </data>
+</archive>
diff --git a/chrome/browser/cocoa/content_exceptions_window_controller.h b/chrome/browser/cocoa/content_exceptions_window_controller.h
index c1afacc8..c3344ca 100644
--- a/chrome/browser/cocoa/content_exceptions_window_controller.h
+++ b/chrome/browser/cocoa/content_exceptions_window_controller.h
@@ -17,8 +17,8 @@ class UpdatingContentSettingsObserver;
// Controller for the content exception dialogs.
@interface ContentExceptionsWindowController : NSWindowController
<NSWindowDelegate,
- NSTableViewDataSource,
- NSTableViewDelegate> {
+ NSTableViewDataSource,
+ NSTableViewDelegate> {
@private
IBOutlet NSTableView* tableView_;
IBOutlet NSButton* addButton_;
diff --git a/chrome/browser/cocoa/content_exceptions_window_controller.mm b/chrome/browser/cocoa/content_exceptions_window_controller.mm
index 4749d18..6c2c7c8 100644
--- a/chrome/browser/cocoa/content_exceptions_window_controller.mm
+++ b/chrome/browser/cocoa/content_exceptions_window_controller.mm
@@ -16,12 +16,6 @@
#include "net/base/net_util.h"
#include "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h"
-namespace {
-
-const CGFloat kButtonBarHeight = 35.0;
-
-} // namespace
-
@interface ContentExceptionsWindowController (Private)
- (id)initWithType:(ContentSettingsType)settingsType
settingsMap:(HostContentSettingsMap*)settingsMap;
@@ -127,6 +121,8 @@ NSString* GetWindowTitle(ContentSettingsType settingsType) {
return @"";
}
+const CGFloat kButtonBarHeight = 35.0;
+
// The settings shown in the combobox if showAsk_ is false;
const ContentSetting kNoAskSettings[] = { CONTENT_SETTING_ALLOW,
CONTENT_SETTING_BLOCK };
@@ -442,7 +438,7 @@ static ContentExceptionsWindowController*
if (!updatesEnabled_)
return;
- // Tthe model caches its data, meaning we need to recreate it on every change.
+ // The model caches its data, meaning we need to recreate it on every change.
model_.reset(new ContentExceptionsTableModel(settingsMap_, settingsType_));
[tableView_ reloadData];
diff --git a/chrome/browser/cocoa/content_exceptions_window_controller_unittest.mm b/chrome/browser/cocoa/content_exceptions_window_controller_unittest.mm
index 7361da4..09a1646 100644
--- a/chrome/browser/cocoa/content_exceptions_window_controller_unittest.mm
+++ b/chrome/browser/cocoa/content_exceptions_window_controller_unittest.mm
@@ -10,8 +10,6 @@
#include "base/ref_counted.h"
#include "chrome/browser/cocoa/browser_test_helper.h"
#include "chrome/browser/cocoa/cocoa_test_helper.h"
-#include "googleurl/src/gurl.h"
-#include "net/url_request/url_request_context.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h"
diff --git a/chrome/browser/cocoa/content_settings_dialog_controller.mm b/chrome/browser/cocoa/content_settings_dialog_controller.mm
index b1786e8..c3b50d8 100644
--- a/chrome/browser/cocoa/content_settings_dialog_controller.mm
+++ b/chrome/browser/cocoa/content_settings_dialog_controller.mm
@@ -12,6 +12,7 @@
#include "chrome/browser/browser_window.h"
#import "chrome/browser/cocoa/content_exceptions_window_controller.h"
#import "chrome/browser/cocoa/cookies_window_controller.h"
+#import "chrome/browser/cocoa/geolocation_exceptions_window_controller.h"
#import "chrome/browser/geolocation/geolocation_content_settings_map.h"
#import "chrome/browser/host_content_settings_map.h"
#include "chrome/browser/pref_service.h"
@@ -270,8 +271,9 @@ class PrefObserverBridge : public NotificationObserver {
}
- (IBAction)showGeolocationExceptions:(id)sender {
- // TODO(thakis): Implement.
- NOTIMPLEMENTED();
+ GeolocationContentSettingsMap* settingsMap =
+ profile_->GetGeolocationContentSettingsMap();
+ [GeolocationExceptionsWindowController showWindowWithSettingsMap:settingsMap];
}
- (void)showExceptionsForType:(ContentSettingsType)settingsType {
diff --git a/chrome/browser/cocoa/cookies_window_controller.h b/chrome/browser/cocoa/cookies_window_controller.h
index 38e6061..0bb275d 100644
--- a/chrome/browser/cocoa/cookies_window_controller.h
+++ b/chrome/browser/cocoa/cookies_window_controller.h
@@ -84,7 +84,7 @@ class CookiesTreeModelObserverBridge : public CookiesTreeModel::Observer {
// bridge (see above).
@interface CookiesWindowController : NSWindowController
<NSOutlineViewDelegate,
- NSWindowDelegate> {
+ NSWindowDelegate> {
@private
// Platform-independent model and C++/Obj-C bridge components.
scoped_ptr<CookiesTreeModel> treeModel_;
diff --git a/chrome/browser/cocoa/geolocation_exceptions_window_controller.h b/chrome/browser/cocoa/geolocation_exceptions_window_controller.h
new file mode 100644
index 0000000..9de67a1
--- /dev/null
+++ b/chrome/browser/cocoa/geolocation_exceptions_window_controller.h
@@ -0,0 +1,36 @@
+// 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.
+
+#import <Cocoa/Cocoa.h>
+
+#include "base/cocoa_protocols_mac.h"
+#include "base/scoped_ptr.h"
+#include "chrome/browser/geolocation/geolocation_content_settings_map.h"
+
+class GeolocationContentSettingsTableModel;
+class GeolocationObserverBridge;
+
+// Controller for the geolocation exception dialog.
+@interface GeolocationExceptionsWindowController : NSWindowController
+ <NSWindowDelegate,
+ NSTableViewDataSource,
+ NSTableViewDelegate> {
+ @private
+ IBOutlet NSTableView* tableView_;
+ IBOutlet NSButton* removeButton_;
+ IBOutlet NSButton* removeAllButton_;
+
+ GeolocationContentSettingsMap* settingsMap_; // weak
+ scoped_ptr<GeolocationContentSettingsTableModel> model_;
+ scoped_ptr<GeolocationObserverBridge> tableObserver_;
+}
+
+// Shows or makes frontmost the geolocation exceptions window.
+// Changes made by the user in the window are persisted in |settingsMap|.
++ (id)showWindowWithSettingsMap:(GeolocationContentSettingsMap*)settingsMap;
+
+- (IBAction)removeException:(id)sender;
+- (IBAction)removeAllExceptions:(id)sender;
+
+@end
diff --git a/chrome/browser/cocoa/geolocation_exceptions_window_controller.mm b/chrome/browser/cocoa/geolocation_exceptions_window_controller.mm
new file mode 100644
index 0000000..5b32fcb
--- /dev/null
+++ b/chrome/browser/cocoa/geolocation_exceptions_window_controller.mm
@@ -0,0 +1,211 @@
+// 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.
+
+#import "chrome/browser/cocoa/geolocation_exceptions_window_controller.h"
+
+#include <set>
+
+#include "app/l10n_util_mac.h"
+#include "app/table_model_observer.h"
+#import "base/mac_util.h"
+#import "base/scoped_nsobject.h"
+#include "base/sys_string_conversions.h"
+#include "chrome/browser/geolocation/geolocation_content_settings_map.h"
+#include "chrome/browser/geolocation/geolocation_content_settings_table_model.h"
+#include "grit/generated_resources.h"
+#include "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h"
+
+@interface GeolocationExceptionsWindowController (Private)
+- (id)initWithSettingsMap:(GeolocationContentSettingsMap*)settingsMap;
+- (void)selectedRemovableIndices:(std::set<int>*)indices;
+- (int)countSelectedRemovable;
+- (void)adjustEditingButtons;
+- (void)modelDidChange;
+@end
+
+// Observer for the geolocation table model.
+class GeolocationObserverBridge : public TableModelObserver {
+ public:
+ GeolocationObserverBridge(GeolocationExceptionsWindowController* controller)
+ : controller_(controller) {}
+ virtual ~GeolocationObserverBridge() {}
+
+ virtual void OnModelChanged() {
+ [controller_ modelDidChange];
+ }
+ virtual void OnItemsChanged(int start, int length) {
+ [controller_ modelDidChange];
+ }
+ virtual void OnItemsAdded(int start, int length) {
+ [controller_ modelDidChange];
+ }
+ virtual void OnItemsRemoved(int start, int length) {
+ [controller_ modelDidChange];
+ }
+
+ private:
+ GeolocationExceptionsWindowController* controller_; // weak
+};
+
+namespace {
+
+const CGFloat kButtonBarHeight = 35.0;
+
+GeolocationExceptionsWindowController* g_exceptionWindow = nil;
+
+} // namespace
+
+@implementation GeolocationExceptionsWindowController
+
++ (id)showWindowWithSettingsMap:(GeolocationContentSettingsMap*)settingsMap {
+ if (!g_exceptionWindow) {
+ g_exceptionWindow = [[GeolocationExceptionsWindowController alloc]
+ initWithSettingsMap:settingsMap];
+ }
+ [g_exceptionWindow showWindow:nil];
+ return g_exceptionWindow;
+}
+
+- (id)initWithSettingsMap:(GeolocationContentSettingsMap*)settingsMap {
+ NSString* nibpath =
+ [mac_util::MainAppBundle() pathForResource:@"GeolocationExceptionsWindow"
+ ofType:@"nib"];
+ if ((self = [super initWithWindowNibPath:nibpath owner:self])) {
+ settingsMap_ = settingsMap;
+ model_.reset(new GeolocationContentSettingsTableModel(settingsMap_));
+ tableObserver_.reset(new GeolocationObserverBridge(self));
+
+ // TODO(thakis): autoremember window rect.
+ // TODO(thakis): sorting support.
+ }
+ return self;
+}
+
+- (void)awakeFromNib {
+ DCHECK([self window]);
+ DCHECK_EQ(self, [[self window] delegate]);
+ DCHECK(tableView_);
+ DCHECK_EQ(self, [tableView_ dataSource]);
+ DCHECK_EQ(self, [tableView_ delegate]);
+
+ // Make sure the button fits its label, but keep it the same height as the
+ // other two buttons.
+ [GTMUILocalizerAndLayoutTweaker sizeToFitView:removeAllButton_];
+ NSSize size = [removeAllButton_ frame].size;
+ size.height = NSHeight([removeButton_ frame]);
+ [removeAllButton_ setFrameSize:size];
+
+ [self adjustEditingButtons];
+
+ // Give the button bar on the bottom of the window the "iTunes/iChat" look.
+ [[self window] setAutorecalculatesContentBorderThickness:NO
+ forEdge:NSMinYEdge];
+ [[self window] setContentBorderThickness:kButtonBarHeight
+ forEdge:NSMinYEdge];
+}
+
+- (void)windowWillClose:(NSNotification*)notification {
+ // Without this, some of the unit tests fail on 10.6:
+ [tableView_ setDataSource:nil];
+
+ g_exceptionWindow = nil;
+ [self autorelease];
+}
+
+// Let esc close the window.
+- (void)cancel:(id)sender {
+ [self close];
+}
+
+- (void)keyDown:(NSEvent*)event {
+ NSString* chars = [event charactersIgnoringModifiers];
+ if ([chars length] == 1) {
+ switch ([chars characterAtIndex:0]) {
+ case NSDeleteCharacter:
+ case NSDeleteFunctionKey:
+ // Delete deletes.
+ if ([[tableView_ selectedRowIndexes] count] > 0)
+ [self removeException:self];
+ return;
+ }
+ }
+ [super keyDown:event];
+}
+
+- (IBAction)removeException:(id)sender {
+ std::set<int> indices;
+ [self selectedRemovableIndices:&indices];
+
+ for (std::set<int>::reverse_iterator i = indices.rbegin();
+ i != indices.rend(); ++i) {
+ model_->RemoveException(*i);
+ }
+}
+
+- (IBAction)removeAllExceptions:(id)sender {
+ model_->RemoveAll();
+}
+
+// Table View Data Source -----------------------------------------------------
+
+- (NSInteger)numberOfRowsInTableView:(NSTableView*)table {
+ return model_->RowCount();
+}
+
+- (id)tableView:(NSTableView*)tv
+ objectValueForTableColumn:(NSTableColumn*)tableColumn
+ row:(NSInteger)row {
+ NSObject* result = nil;
+ NSString* identifier = [tableColumn identifier];
+ if ([identifier isEqualToString:@"hostname"]) {
+ std::wstring host = model_->GetText(row, IDS_EXCEPTIONS_HOSTNAME_HEADER);
+ result = base::SysWideToNSString(host);
+ } else if ([identifier isEqualToString:@"action"]) {
+ std::wstring action = model_->GetText(row, IDS_EXCEPTIONS_ACTION_HEADER);
+ result = base::SysWideToNSString(action);
+ } else {
+ NOTREACHED();
+ }
+ return result;
+}
+
+// Table View Delegate --------------------------------------------------------
+
+// When the selection in the table view changes, we need to adjust buttons.
+- (void)tableViewSelectionDidChange:(NSNotification*)notification {
+ [self adjustEditingButtons];
+}
+
+// Private --------------------------------------------------------------------
+
+// Returns the indices of all selected rows that are removable.
+- (void)selectedRemovableIndices:(std::set<int>*)indices {
+ NSIndexSet* selection = [tableView_ selectedRowIndexes];
+ for (NSUInteger index = [selection lastIndex]; index != NSNotFound;
+ index = [selection indexLessThanIndex:index]) {
+ if (model_->CanRemoveException(index))
+ indices->insert(index);
+ }
+}
+
+// Returns how many of the selected rows are removable.
+- (int)countSelectedRemovable {
+ std::set<int> indices;
+ [self selectedRemovableIndices:&indices];
+ return indices.size();
+}
+
+// This method appropriately sets the enabled states on the table's editing
+// buttons.
+- (void)adjustEditingButtons {
+ [removeButton_ setEnabled:([self countSelectedRemovable] > 0)];
+ [removeAllButton_ setEnabled:([tableView_ numberOfRows] > 0)];
+}
+
+- (void)modelDidChange {
+ [tableView_ reloadData];
+ [self adjustEditingButtons];
+}
+
+@end
diff --git a/chrome/browser/cocoa/geolocation_exceptions_window_controller_unittest.mm b/chrome/browser/cocoa/geolocation_exceptions_window_controller_unittest.mm
new file mode 100644
index 0000000..88aeca0
--- /dev/null
+++ b/chrome/browser/cocoa/geolocation_exceptions_window_controller_unittest.mm
@@ -0,0 +1,59 @@
+// 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.
+
+#import "chrome/browser/cocoa/geolocation_exceptions_window_controller.h"
+
+#import <Cocoa/Cocoa.h>
+
+#import "base/scoped_nsobject.h"
+#include "base/ref_counted.h"
+#include "chrome/browser/cocoa/browser_test_helper.h"
+#include "chrome/browser/cocoa/cocoa_test_helper.h"
+#include "testing/gtest/include/gtest/gtest.h"
+#include "testing/platform_test.h"
+
+namespace {
+
+class GeolocationExceptionsWindowControllerTest : public CocoaTest {
+ public:
+ virtual void SetUp() {
+ CocoaTest::SetUp();
+ TestingProfile* profile = browser_helper_.profile();
+ settingsMap_ = new GeolocationContentSettingsMap(profile);
+ }
+
+ GeolocationExceptionsWindowController* GetController() {
+ return [GeolocationExceptionsWindowController
+ showWindowWithSettingsMap:settingsMap_.get()];
+ }
+
+ void ClickRemoveAll(GeolocationExceptionsWindowController* controller) {
+ [controller removeAllExceptions:nil];
+ }
+
+ protected:
+ BrowserTestHelper browser_helper_;
+ scoped_refptr<GeolocationContentSettingsMap> settingsMap_;
+};
+
+TEST_F(GeolocationExceptionsWindowControllerTest, Construction) {
+ GeolocationExceptionsWindowController* controller =
+ [GeolocationExceptionsWindowController
+ showWindowWithSettingsMap:settingsMap_.get()];
+ [controller close]; // Should autorelease.
+}
+
+TEST_F(GeolocationExceptionsWindowControllerTest, AddExistingEditAdd) {
+ settingsMap_->SetContentSetting(
+ GURL("http://myhost"), GURL(), CONTENT_SETTING_BLOCK);
+
+ GeolocationExceptionsWindowController* controller = GetController();
+ ClickRemoveAll(controller);
+
+ [controller close];
+
+ EXPECT_EQ(0u, settingsMap_->GetAllOriginsSettings().size());
+}
+
+} // namespace
diff --git a/chrome/browser/cocoa/keyword_editor_cocoa_controller.h b/chrome/browser/cocoa/keyword_editor_cocoa_controller.h
index 73aed70..d6192f2 100644
--- a/chrome/browser/cocoa/keyword_editor_cocoa_controller.h
+++ b/chrome/browser/cocoa/keyword_editor_cocoa_controller.h
@@ -66,8 +66,8 @@ class KeywordEditorModelObserver : public TemplateURLModelObserver,
@interface KeywordEditorCocoaController : NSWindowController
<NSWindowDelegate,
- NSTableViewDataSource,
- NSTableViewDelegate> {
+ NSTableViewDataSource,
+ NSTableViewDelegate> {
IBOutlet NSTableView* tableView_;
IBOutlet NSButton* addButton_;
IBOutlet NSButton* removeButton_;
diff --git a/chrome/browser/geolocation/geolocation_content_settings_map.cc b/chrome/browser/geolocation/geolocation_content_settings_map.cc
index 9a07651..5570801 100755
--- a/chrome/browser/geolocation/geolocation_content_settings_map.cc
+++ b/chrome/browser/geolocation/geolocation_content_settings_map.cc
@@ -116,8 +116,8 @@ void GeolocationContentSettingsMap::SetContentSetting(
const GURL& embedding_url,
ContentSetting setting) {
DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
- DCHECK(requesting_url.is_valid() &&
- (embedding_url.is_valid() || embedding_url.is_empty()));
+ DCHECK(requesting_url.is_valid());
+ DCHECK(embedding_url.is_valid() || embedding_url.is_empty());
GURL requesting_origin(requesting_url.GetOrigin());
GURL embedding_origin(embedding_url.GetOrigin());
DCHECK(requesting_origin.is_valid() &&
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index 032d0e4..05c0718 100755
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -664,6 +664,8 @@
'browser/cocoa/fullscreen_controller.mm',
'browser/cocoa/fullscreen_window.h',
'browser/cocoa/fullscreen_window.mm',
+ 'browser/cocoa/geolocation_exceptions_window_controller.h',
+ 'browser/cocoa/geolocation_exceptions_window_controller.mm',
'browser/cocoa/gradient_button_cell.h',
'browser/cocoa/gradient_button_cell.mm',
'browser/cocoa/history_menu_bridge.h',
@@ -2632,6 +2634,7 @@
'app/nibs/ExtensionInstallPromptNoWarnings.xib',
'app/nibs/FirstRunDialog.xib',
'app/nibs/FontLanguageSettings.xib',
+ 'app/nibs/GeolocationExceptionsWindow.xib',
'app/nibs/HttpAuthLoginSheet.xib',
'app/nibs/HungRendererDialog.xib',
'app/nibs/ImportSettingsDialog.xib',
diff --git a/chrome/chrome_dll.gypi b/chrome/chrome_dll.gypi
index 9b5d695..025b12c 100644
--- a/chrome/chrome_dll.gypi
+++ b/chrome/chrome_dll.gypi
@@ -214,6 +214,7 @@
'app/nibs/FindBar.xib',
'app/nibs/FirstRunDialog.xib',
'app/nibs/FontLanguageSettings.xib',
+ 'app/nibs/GeolocationExceptionsWindow.xib',
'app/nibs/HungRendererDialog.xib',
'app/nibs/HttpAuthLoginSheet.xib',
'app/nibs/ImportSettingsDialog.xib',
diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi
index 954182f..63870bb 100644
--- a/chrome/chrome_tests.gypi
+++ b/chrome/chrome_tests.gypi
@@ -674,6 +674,7 @@
'browser/cocoa/focus_tracker_unittest.mm',
'browser/cocoa/font_language_settings_controller_unittest.mm',
'browser/cocoa/fullscreen_window_unittest.mm',
+ 'browser/cocoa/geolocation_exceptions_window_controller_unittest.mm',
'browser/cocoa/html_dialog_window_controller_unittest.mm',
'browser/cocoa/hung_renderer_controller_unittest.mm',
'browser/cocoa/import_settings_dialog_unittest.mm',