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

Side by Side Diff: chrome/browser/cocoa/browser_window_controller.mm

Issue 1540009: [Mac] Move star button into page-actions area of omnibox. (Closed)
Patch Set: Why did the trybot fail? I can't see anything. Created 10 years, 8 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 unified diff | Download patch
OLDNEW
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 1350 matching lines...) Expand 10 before | Expand all | Expand 10 after
1361 tabStripViewWindowBounds = 1361 tabStripViewWindowBounds =
1362 [tabStripView convertRect:tabStripViewWindowBounds 1362 [tabStripView convertRect:tabStripViewWindowBounds
1363 toView:windowChromeView]; 1363 toView:windowChromeView];
1364 NSPoint phase = NSMakePoint(NSMinX(tabStripViewWindowBounds) 1364 NSPoint phase = NSMakePoint(NSMinX(tabStripViewWindowBounds)
1365 + kPatternHorizontalOffset, 1365 + kPatternHorizontalOffset,
1366 NSMinY(tabStripViewWindowBounds) 1366 NSMinY(tabStripViewWindowBounds)
1367 + [TabStripController defaultTabHeight]); 1367 + [TabStripController defaultTabHeight]);
1368 return phase; 1368 return phase;
1369 } 1369 }
1370 1370
1371 - (NSPoint)topLeftForBubble { 1371 - (NSPoint)topRightForBubble {
1372 NSRect rect = [toolbarController_ starButtonInWindowCoordinates]; 1372 NSRect rect = [toolbarController_ starIconInWindowCoordinates];
1373 NSPoint p = NSMakePoint(NSMinX(rect), NSMinY(rect)); // bottom left 1373 NSPoint p = NSMakePoint(NSMaxX(rect), NSMinY(rect)); // bottom right
1374 1374
1375 // Adjust top-left based on our knowledge of how the view looks. 1375 // Adjust top-right based on our knowledge of how the view looks.
1376 p.x -= 2; 1376 p.x += 31;
1377 p.y += 7; 1377 p.y += 5;
1378 1378
1379 return p; 1379 return p;
1380 } 1380 }
1381 1381
1382 // Show the bookmark bubble (e.g. user just clicked on the STAR). 1382 // Show the bookmark bubble (e.g. user just clicked on the STAR).
1383 - (void)showBookmarkBubbleForURL:(const GURL&)url 1383 - (void)showBookmarkBubbleForURL:(const GURL&)url
1384 alreadyBookmarked:(BOOL)alreadyMarked { 1384 alreadyBookmarked:(BOOL)alreadyMarked {
1385 if (!bookmarkBubbleController_) { 1385 if (!bookmarkBubbleController_) {
1386 BookmarkModel* model = browser_->profile()->GetBookmarkModel(); 1386 BookmarkModel* model = browser_->profile()->GetBookmarkModel();
1387 const BookmarkNode* node = model->GetMostRecentlyAddedNodeForURL(url); 1387 const BookmarkNode* node = model->GetMostRecentlyAddedNodeForURL(url);
1388 NSPoint topLeft = [self topLeftForBubble]; 1388 NSPoint topRight = [self topRightForBubble];
1389 bookmarkBubbleController_ = 1389 bookmarkBubbleController_ =
1390 [[BookmarkBubbleController alloc] initWithParentWindow:[self window] 1390 [[BookmarkBubbleController alloc] initWithParentWindow:[self window]
1391 topLeftForBubble:topLeft 1391 topRightForBubble:topRight
1392 model:model 1392 model:model
1393 node:node 1393 node:node
1394 alreadyBookmarked:alreadyMarked]; 1394 alreadyBookmarked:alreadyMarked];
1395 [bookmarkBubbleController_ showWindow:self]; 1395 [bookmarkBubbleController_ showWindow:self];
1396 NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; 1396 NSNotificationCenter* center = [NSNotificationCenter defaultCenter];
1397 [center addObserver:self 1397 [center addObserver:self
1398 selector:@selector(bubbleWindowWillClose:) 1398 selector:@selector(bubbleWindowWillClose:)
1399 name:NSWindowWillCloseNotification 1399 name:NSWindowWillCloseNotification
1400 object:[bookmarkBubbleController_ window]]; 1400 object:[bookmarkBubbleController_ window]];
1401 } 1401 }
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
1843 1843
1844 - (BOOL)supportsBookmarkBar { 1844 - (BOOL)supportsBookmarkBar {
1845 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; 1845 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR];
1846 } 1846 }
1847 1847
1848 - (BOOL)isNormalWindow { 1848 - (BOOL)isNormalWindow {
1849 return browser_->type() == Browser::TYPE_NORMAL; 1849 return browser_->type() == Browser::TYPE_NORMAL;
1850 } 1850 }
1851 1851
1852 @end // @implementation BrowserWindowController(WindowType) 1852 @end // @implementation BrowserWindowController(WindowType)
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/browser_window_controller.h ('k') | chrome/browser/cocoa/browser_window_controller_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698