| 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 2271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2282 forButtonState:image_button_cell::kHoverStateBackground]; | 2282 forButtonState:image_button_cell::kHoverStateBackground]; |
| 2283 } else { | 2283 } else { |
| 2284 [[newTabButton_ cell] setImage:nil | 2284 [[newTabButton_ cell] setImage:nil |
| 2285 forButtonState:image_button_cell::kDefaultStateBackground]; | 2285 forButtonState:image_button_cell::kDefaultStateBackground]; |
| 2286 [[newTabButton_ cell] setImage:nil | 2286 [[newTabButton_ cell] setImage:nil |
| 2287 forButtonState:image_button_cell::kHoverStateBackground]; | 2287 forButtonState:image_button_cell::kHoverStateBackground]; |
| 2288 } | 2288 } |
| 2289 } | 2289 } |
| 2290 | 2290 |
| 2291 @end | 2291 @end |
| 2292 | |
| 2293 NSView* GetSheetParentViewForWebContents(WebContents* web_contents) { | |
| 2294 // View hierarchy of the contents view: | |
| 2295 // NSView -- switchView, same for all tabs | |
| 2296 // +- NSView -- TabContentsController's view | |
| 2297 // +- WebContentsViewCocoa | |
| 2298 // | |
| 2299 // Changing it? Do not forget to modify | |
| 2300 // -[TabStripController swapInTabAtIndex:] too. | |
| 2301 return [web_contents->GetNativeView() superview]; | |
| 2302 } | |
| 2303 | |
| 2304 NSRect GetSheetParentBoundsForParentView(NSView* view) { | |
| 2305 // If the devtools view is open, it shrinks the size of the WebContents, so go | |
| 2306 // up the hierarchy to the devtools container view to avoid that. Note that | |
| 2307 // the devtools view is always in the hierarchy even if it is not open or it | |
| 2308 // is detached. | |
| 2309 NSView* devtools_view = [[[view superview] superview] superview]; | |
| 2310 if (devtools_view) { | |
| 2311 return [devtools_view convertRect:[devtools_view bounds] toView:nil]; | |
| 2312 } else { | |
| 2313 return [view convertRect:[view bounds] toView:nil]; | |
| 2314 } | |
| 2315 } | |
| OLD | NEW |