| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/browser_window_controller.h" | 5 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 #include <numeric> | 8 #include <numeric> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 1153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1164 continue; | 1164 continue; |
| 1165 | 1165 |
| 1166 // Convert |view|'s frame (which starts in the source tab strip's | 1166 // Convert |view|'s frame (which starts in the source tab strip's |
| 1167 // coordinate system) to the coordinate system of the destination tab | 1167 // coordinate system) to the coordinate system of the destination tab |
| 1168 // strip. This needs to be done before being detached so the window | 1168 // strip. This needs to be done before being detached so the window |
| 1169 // transforms can be performed. | 1169 // transforms can be performed. |
| 1170 NSRect destinationFrame = [view frame]; | 1170 NSRect destinationFrame = [view frame]; |
| 1171 NSPoint tabOrigin = destinationFrame.origin; | 1171 NSPoint tabOrigin = destinationFrame.origin; |
| 1172 tabOrigin = [[dragController tabStripView] convertPoint:tabOrigin | 1172 tabOrigin = [[dragController tabStripView] convertPoint:tabOrigin |
| 1173 toView:nil]; | 1173 toView:nil]; |
| 1174 tabOrigin = [[dragController window] convertBaseToScreen:tabOrigin]; | 1174 tabOrigin = ui::ConvertPointFromWindowToScreen([dragController window], |
| 1175 tabOrigin = [[self window] convertScreenToBase:tabOrigin]; | 1175 tabOrigin); |
| 1176 tabOrigin = ui::ConvertPointFromScreenToWindow([self window], tabOrigin); |
| 1176 tabOrigin = [[self tabStripView] convertPoint:tabOrigin fromView:nil]; | 1177 tabOrigin = [[self tabStripView] convertPoint:tabOrigin fromView:nil]; |
| 1177 destinationFrame.origin = tabOrigin; | 1178 destinationFrame.origin = tabOrigin; |
| 1178 | 1179 |
| 1179 // Before the tab is detached from its originating tab strip, store the | 1180 // Before the tab is detached from its originating tab strip, store the |
| 1180 // pinned state so that it can be maintained between the windows. | 1181 // pinned state so that it can be maintained between the windows. |
| 1181 bool isPinned = dragBWC->browser_->tab_strip_model()->IsTabPinned(index); | 1182 bool isPinned = dragBWC->browser_->tab_strip_model()->IsTabPinned(index); |
| 1182 | 1183 |
| 1183 // Now that we have enough information about the tab, we can remove it | 1184 // Now that we have enough information about the tab, we can remove it |
| 1184 // from the dragging window. We need to do this *before* we add it to the | 1185 // from the dragging window. We need to do this *before* we add it to the |
| 1185 // new window as this will remove the WebContents' delegate. | 1186 // new window as this will remove the WebContents' delegate. |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1552 // Show the bookmark bubble (e.g. user just clicked on the STAR). | 1553 // Show the bookmark bubble (e.g. user just clicked on the STAR). |
| 1553 - (void)showBookmarkBubbleForURL:(const GURL&)url | 1554 - (void)showBookmarkBubbleForURL:(const GURL&)url |
| 1554 alreadyBookmarked:(BOOL)alreadyMarked { | 1555 alreadyBookmarked:(BOOL)alreadyMarked { |
| 1555 if (bookmarkBubbleObserver_.get()) | 1556 if (bookmarkBubbleObserver_.get()) |
| 1556 return; | 1557 return; |
| 1557 | 1558 |
| 1558 bookmarkBubbleObserver_.reset(new BookmarkBubbleObserverCocoa(self)); | 1559 bookmarkBubbleObserver_.reset(new BookmarkBubbleObserverCocoa(self)); |
| 1559 | 1560 |
| 1560 if (chrome::ToolkitViewsDialogsEnabled()) { | 1561 if (chrome::ToolkitViewsDialogsEnabled()) { |
| 1561 chrome::ShowBookmarkBubbleViewsAtPoint( | 1562 chrome::ShowBookmarkBubbleViewsAtPoint( |
| 1562 gfx::ScreenPointFromNSPoint( | 1563 gfx::ScreenPointFromNSPoint(ui::ConvertPointFromWindowToScreen( |
| 1563 [[self window] convertBaseToScreen:[self bookmarkBubblePoint]]), | 1564 [self window], [self bookmarkBubblePoint])), |
| 1564 [[self window] contentView], bookmarkBubbleObserver_.get(), | 1565 [[self window] contentView], bookmarkBubbleObserver_.get(), |
| 1565 browser_.get(), url, alreadyMarked); | 1566 browser_.get(), url, alreadyMarked); |
| 1566 } else { | 1567 } else { |
| 1567 BookmarkModel* model = | 1568 BookmarkModel* model = |
| 1568 BookmarkModelFactory::GetForProfile(browser_->profile()); | 1569 BookmarkModelFactory::GetForProfile(browser_->profile()); |
| 1569 bookmarks::ManagedBookmarkService* managed = | 1570 bookmarks::ManagedBookmarkService* managed = |
| 1570 ManagedBookmarkServiceFactory::GetForProfile(browser_->profile()); | 1571 ManagedBookmarkServiceFactory::GetForProfile(browser_->profile()); |
| 1571 const BookmarkNode* node = model->GetMostRecentlyAddedUserNodeForURL(url); | 1572 const BookmarkNode* node = model->GetMostRecentlyAddedUserNodeForURL(url); |
| 1572 bookmarkBubbleController_ = [[BookmarkBubbleController alloc] | 1573 bookmarkBubbleController_ = [[BookmarkBubbleController alloc] |
| 1573 initWithParentWindow:[self window] | 1574 initWithParentWindow:[self window] |
| (...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2095 | 2096 |
| 2096 - (BOOL)supportsBookmarkBar { | 2097 - (BOOL)supportsBookmarkBar { |
| 2097 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; | 2098 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; |
| 2098 } | 2099 } |
| 2099 | 2100 |
| 2100 - (BOOL)isTabbedWindow { | 2101 - (BOOL)isTabbedWindow { |
| 2101 return browser_->is_type_tabbed(); | 2102 return browser_->is_type_tabbed(); |
| 2102 } | 2103 } |
| 2103 | 2104 |
| 2104 @end // @implementation BrowserWindowController(WindowType) | 2105 @end // @implementation BrowserWindowController(WindowType) |
| OLD | NEW |