OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/cocoa/browser_window_controller.h" | 5 #import "chrome/browser/cocoa/browser_window_controller.h" |
6 | 6 |
7 #include <Carbon/Carbon.h> | 7 #include <Carbon/Carbon.h> |
8 | 8 |
9 #include "app/l10n_util_mac.h" | 9 #include "app/l10n_util_mac.h" |
10 #include "base/mac_util.h" | 10 #include "base/mac_util.h" |
(...skipping 1354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1365 tabStripViewWindowBounds = | 1365 tabStripViewWindowBounds = |
1366 [tabStripView convertRect:tabStripViewWindowBounds | 1366 [tabStripView convertRect:tabStripViewWindowBounds |
1367 toView:windowChromeView]; | 1367 toView:windowChromeView]; |
1368 NSPoint phase = NSMakePoint(NSMinX(tabStripViewWindowBounds) | 1368 NSPoint phase = NSMakePoint(NSMinX(tabStripViewWindowBounds) |
1369 + kPatternHorizontalOffset, | 1369 + kPatternHorizontalOffset, |
1370 NSMinY(tabStripViewWindowBounds) | 1370 NSMinY(tabStripViewWindowBounds) |
1371 + [TabStripController defaultTabHeight]); | 1371 + [TabStripController defaultTabHeight]); |
1372 return phase; | 1372 return phase; |
1373 } | 1373 } |
1374 | 1374 |
1375 - (NSPoint)topRightForBubble { | 1375 - (NSPoint)pointForBubbleArrowTip { |
1376 NSRect rect = [toolbarController_ starIconInWindowCoordinates]; | 1376 NSRect rect = [toolbarController_ starIconInWindowCoordinates]; |
1377 NSPoint p = NSMakePoint(NSMaxX(rect), NSMinY(rect)); // bottom right | 1377 // Determine the point of the arrow of the bubble window. |
1378 | 1378 NSPoint p = rect.origin; |
1379 // Adjust top-right based on our knowledge of how the view looks. | 1379 p.x += (NSWidth(rect) / 2.0) + 1.0; // Star is not exactly in center. |
1380 p.x += 31; | 1380 p.y += 4; |
1381 p.y += 5; | |
1382 | |
1383 return p; | 1381 return p; |
1384 } | 1382 } |
1385 | 1383 |
1386 // Show the bookmark bubble (e.g. user just clicked on the STAR). | 1384 // Show the bookmark bubble (e.g. user just clicked on the STAR). |
1387 - (void)showBookmarkBubbleForURL:(const GURL&)url | 1385 - (void)showBookmarkBubbleForURL:(const GURL&)url |
1388 alreadyBookmarked:(BOOL)alreadyMarked { | 1386 alreadyBookmarked:(BOOL)alreadyMarked { |
1389 if (!bookmarkBubbleController_) { | 1387 if (!bookmarkBubbleController_) { |
1390 BookmarkModel* model = browser_->profile()->GetBookmarkModel(); | 1388 BookmarkModel* model = browser_->profile()->GetBookmarkModel(); |
1391 const BookmarkNode* node = model->GetMostRecentlyAddedNodeForURL(url); | 1389 const BookmarkNode* node = model->GetMostRecentlyAddedNodeForURL(url); |
1392 bookmarkBubbleController_ = | 1390 bookmarkBubbleController_ = |
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1845 | 1843 |
1846 - (BOOL)supportsBookmarkBar { | 1844 - (BOOL)supportsBookmarkBar { |
1847 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; | 1845 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; |
1848 } | 1846 } |
1849 | 1847 |
1850 - (BOOL)isNormalWindow { | 1848 - (BOOL)isNormalWindow { |
1851 return browser_->type() == Browser::TYPE_NORMAL; | 1849 return browser_->type() == Browser::TYPE_NORMAL; |
1852 } | 1850 } |
1853 | 1851 |
1854 @end // @implementation BrowserWindowController(WindowType) | 1852 @end // @implementation BrowserWindowController(WindowType) |
OLD | NEW |