Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(402)

Unified Diff: chrome/browser/ui/cocoa/browser_window_controller.mm

Issue 9265018: Change grow box computation back to a method on BrowserWindow (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nits Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/cocoa/browser_window_controller.h ('k') | chrome/browser/ui/cocoa/dev_tools_controller.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/browser_window_controller.mm
diff --git a/chrome/browser/ui/cocoa/browser_window_controller.mm b/chrome/browser/ui/cocoa/browser_window_controller.mm
index 153649281015f9b9c5bd835b8356361eee82579d..fe3a45e613d77714e39bcc298a5a01dc971d117e 100644
--- a/chrome/browser/ui/cocoa/browser_window_controller.mm
+++ b/chrome/browser/ui/cocoa/browser_window_controller.mm
@@ -286,8 +286,7 @@ enum {
// Create a sub-controller for the docked devTools and add its view to the
// hierarchy.
- devToolsController_.reset(
- [[DevToolsController alloc] initWithDelegate:self]);
+ devToolsController_.reset([[DevToolsController alloc] init]);
[[devToolsController_ view] setFrame:[[self tabContentArea] bounds]];
[[self tabContentArea] addSubview:[devToolsController_ view]];
@@ -520,7 +519,6 @@ enum {
- (void)updateDevToolsForContents:(WebContents*)contents {
[devToolsController_ updateDevToolsForWebContents:contents
withProfile:browser_->profile()];
- [devToolsController_ ensureContentsVisible];
}
- (void)setDevToolsDockToRight:(bool)dock_to_right {
@@ -1141,6 +1139,24 @@ enum {
[toolbarController_ setStarredState:isStarred];
}
+// Return the rect, in WebKit coordinates (flipped), of the window's grow box
+// in the coordinate system of the content area of the currently selected tab.
+// |windowGrowBox| needs to be in the window's coordinate system.
+- (NSRect)selectedTabGrowBoxRect {
+ NSWindow* window = [self window];
+ if (![window respondsToSelector:@selector(_growBoxRect)])
+ return NSZeroRect;
+
+ // Before we return a rect, we need to convert it from window coordinates
+ // to tab content area coordinates and flip the coordinate system.
+ NSRect growBoxRect =
+ [[self tabContentArea] convertRect:[window _growBoxRect] fromView:nil];
+ growBoxRect.origin.y =
+ [[self tabContentArea] frame].size.height - growBoxRect.size.height -
+ growBoxRect.origin.y;
+ return growBoxRect;
+}
+
// Accept tabs from a BrowserWindowController with the same Profile.
- (BOOL)canReceiveFrom:(TabWindowController*)source {
if (![source isKindOfClass:[BrowserWindowController class]]) {
@@ -1455,47 +1471,6 @@ enum {
return [self supportsWindowFeature:Browser::FEATURE_TABSTRIP];
}
-// TabContentsControllerDelegate protocol.
-- (void)tabContentsViewFrameWillChange:(TabContentsController*)source
- frameRect:(NSRect)frameRect {
- WebContents* contents = [source webContents];
- RenderWidgetHostView* render_widget_host_view = contents ?
- contents->GetRenderWidgetHostView() : NULL;
- if (!render_widget_host_view)
- return;
-
- gfx::Rect reserved_rect;
-
- NSWindow* window = [self window];
- if ([window respondsToSelector:@selector(_growBoxRect)]) {
- NSView* view = [source view];
- if (view && [view superview]) {
- NSRect windowGrowBoxRect = [window _growBoxRect];
- NSRect viewRect = [[view superview] convertRect:frameRect toView:nil];
- NSRect growBoxRect = NSIntersectionRect(windowGrowBoxRect, viewRect);
- if (!NSIsEmptyRect(growBoxRect)) {
- // Before we return a rect, we need to convert it from window
- // coordinates to content area coordinates and flip the coordinate
- // system.
- // Superview is used here because, first, it's a frame rect, so it is
- // specified in the parent's coordinates and, second, view is not
- // positioned yet.
- growBoxRect = [[view superview] convertRect:growBoxRect fromView:nil];
- growBoxRect.origin.y =
- NSHeight(frameRect) - NSHeight(growBoxRect);
- growBoxRect =
- NSOffsetRect(growBoxRect, -frameRect.origin.x, -frameRect.origin.y);
-
- reserved_rect =
- gfx::Rect(growBoxRect.origin.x, growBoxRect.origin.y,
- growBoxRect.size.width, growBoxRect.size.height);
- }
- }
- }
-
- render_widget_host_view->set_reserved_contents_rect(reserved_rect);
-}
-
// TabStripControllerDelegate protocol.
- (void)onActivateTabWithContents:(WebContents*)contents {
// Update various elements that are interested in knowing the current
@@ -1518,9 +1493,6 @@ enum {
TabContentsWrapper::GetCurrentWrapperForContents(contents);
// Without the .get(), xcode fails.
[infoBarContainerController_.get() changeTabContents:wrapper];
-
- // Update devTools contents after size for all views is set.
- [devToolsController_ ensureContentsVisible];
}
- (void)onReplaceTabWithContents:(WebContents*)contents {
« no previous file with comments | « chrome/browser/ui/cocoa/browser_window_controller.h ('k') | chrome/browser/ui/cocoa/dev_tools_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698