OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" | 5 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" |
6 | 6 |
7 #import <QuartzCore/QuartzCore.h> | 7 #import <QuartzCore/QuartzCore.h> |
8 | 8 |
9 #include <cmath> | 9 #include <cmath> |
10 #include <limits> | 10 #include <limits> |
(...skipping 2041 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2052 // the next iteration.) | 2052 // the next iteration.) |
2053 i++; | 2053 i++; |
2054 } | 2054 } |
2055 | 2055 |
2056 // If we've made it here, we want to append a new tab to the end. | 2056 // If we've made it here, we want to append a new tab to the end. |
2057 *index = -1; | 2057 *index = -1; |
2058 *disposition = WindowOpenDisposition::NEW_FOREGROUND_TAB; | 2058 *disposition = WindowOpenDisposition::NEW_FOREGROUND_TAB; |
2059 } | 2059 } |
2060 | 2060 |
2061 - (void)openURL:(GURL*)url inView:(NSView*)view at:(NSPoint)point { | 2061 - (void)openURL:(GURL*)url inView:(NSView*)view at:(NSPoint)point { |
| 2062 // Security: Block JavaScript to prevent self-XSS. |
| 2063 if (url->SchemeIs(url::kJavaScriptScheme)) |
| 2064 return; |
| 2065 |
2062 // Get the index and disposition. | 2066 // Get the index and disposition. |
2063 NSInteger index; | 2067 NSInteger index; |
2064 WindowOpenDisposition disposition; | 2068 WindowOpenDisposition disposition; |
2065 [self droppingURLsAt:point | 2069 [self droppingURLsAt:point |
2066 givesIndex:&index | 2070 givesIndex:&index |
2067 disposition:&disposition]; | 2071 disposition:&disposition]; |
2068 | 2072 |
2069 // Either insert a new tab or open in a current tab. | 2073 // Either insert a new tab or open in a current tab. |
2070 switch (disposition) { | 2074 switch (disposition) { |
2071 case WindowOpenDisposition::NEW_FOREGROUND_TAB: { | 2075 case WindowOpenDisposition::NEW_FOREGROUND_TAB: { |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2333 for (int i = 0; i < tabStripModel_->count(); i++) { | 2337 for (int i = 0; i < tabStripModel_->count(); i++) { |
2334 [self updateIconsForContents:tabStripModel_->GetWebContentsAt(i) atIndex:i]; | 2338 [self updateIconsForContents:tabStripModel_->GetWebContentsAt(i) atIndex:i]; |
2335 } | 2339 } |
2336 } | 2340 } |
2337 | 2341 |
2338 - (void)setVisualEffectsDisabledForFullscreen:(BOOL)fullscreen { | 2342 - (void)setVisualEffectsDisabledForFullscreen:(BOOL)fullscreen { |
2339 [tabStripView_ setVisualEffectsDisabledForFullscreen:fullscreen]; | 2343 [tabStripView_ setVisualEffectsDisabledForFullscreen:fullscreen]; |
2340 } | 2344 } |
2341 | 2345 |
2342 @end | 2346 @end |
OLD | NEW |