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

Side by Side Diff: chrome/browser/ui/cocoa/bookmarks/bookmark_bubble_controller.mm

Issue 1775223002: Prepare chrome/ for compilation with OS X 10.7 deployment target. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Compile errors. Fix null-window error. Created 4 years, 9 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) 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/bookmarks/bookmark_bubble_controller.h" 5 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bubble_controller.h"
6 6
7 #include "base/mac/bundle_locations.h" 7 #include "base/mac/bundle_locations.h"
8 #include "base/strings/sys_string_conversions.h" 8 #include "base/strings/sys_string_conversions.h"
9 #include "chrome/browser/ui/bookmarks/bookmark_bubble_observer.h" 9 #include "chrome/browser/ui/bookmarks/bookmark_bubble_observer.h"
10 #include "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
11 #include "chrome/browser/ui/browser_finder.h" 11 #include "chrome/browser/ui/browser_finder.h"
12 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button.h" 12 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button.h"
13 #import "chrome/browser/ui/cocoa/browser_window_controller.h" 13 #import "chrome/browser/ui/cocoa/browser_window_controller.h"
14 #import "chrome/browser/ui/cocoa/bubble_sync_promo_controller.h" 14 #import "chrome/browser/ui/cocoa/bubble_sync_promo_controller.h"
15 #import "chrome/browser/ui/cocoa/info_bubble_view.h" 15 #import "chrome/browser/ui/cocoa/info_bubble_view.h"
16 #include "chrome/browser/ui/sync/sync_promo_ui.h" 16 #include "chrome/browser/ui/sync/sync_promo_ui.h"
17 #include "chrome/grit/chromium_strings.h" 17 #include "chrome/grit/chromium_strings.h"
18 #include "chrome/grit/generated_resources.h" 18 #include "chrome/grit/generated_resources.h"
19 #include "components/bookmarks/browser/bookmark_model.h" 19 #include "components/bookmarks/browser/bookmark_model.h"
20 #include "components/bookmarks/browser/bookmark_utils.h" 20 #include "components/bookmarks/browser/bookmark_utils.h"
21 #include "components/bookmarks/managed/managed_bookmark_service.h" 21 #include "components/bookmarks/managed/managed_bookmark_service.h"
22 #include "components/signin/core/browser/signin_metrics.h" 22 #include "components/signin/core/browser/signin_metrics.h"
23 #include "content/public/browser/notification_observer.h" 23 #include "content/public/browser/notification_observer.h"
24 #include "content/public/browser/notification_registrar.h" 24 #include "content/public/browser/notification_registrar.h"
25 #include "content/public/browser/notification_service.h" 25 #include "content/public/browser/notification_service.h"
26 #include "content/public/browser/user_metrics.h" 26 #include "content/public/browser/user_metrics.h"
27 #include "ui/base/cocoa/cocoa_base_utils.h"
27 #include "ui/base/l10n/l10n_util_mac.h" 28 #include "ui/base/l10n/l10n_util_mac.h"
28 29
29 using base::UserMetricsAction; 30 using base::UserMetricsAction;
30 using bookmarks::BookmarkModel; 31 using bookmarks::BookmarkModel;
31 using bookmarks::BookmarkNode; 32 using bookmarks::BookmarkNode;
32 33
33 @interface BookmarkBubbleController (PrivateAPI) 34 @interface BookmarkBubbleController (PrivateAPI)
34 - (void)updateBookmarkNode; 35 - (void)updateBookmarkNode;
35 - (void)fillInFolderList; 36 - (void)fillInFolderList;
36 @end 37 @end
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 BrowserWindowController* bwc = 138 BrowserWindowController* bwc =
138 [BrowserWindowController browserWindowControllerForWindow:parentWindow]; 139 [BrowserWindowController browserWindowControllerForWindow:parentWindow];
139 140
140 InfoBubbleView* bubble = self.bubble; 141 InfoBubbleView* bubble = self.bubble;
141 [bubble setArrowLocation:info_bubble::kTopRight]; 142 [bubble setArrowLocation:info_bubble::kTopRight];
142 143
143 // Insure decent positioning even in the absence of a browser controller, 144 // Insure decent positioning even in the absence of a browser controller,
144 // which will occur for some unit tests. 145 // which will occur for some unit tests.
145 NSPoint arrowTip = bwc ? [bwc bookmarkBubblePoint] : 146 NSPoint arrowTip = bwc ? [bwc bookmarkBubblePoint] :
146 NSMakePoint([window frame].size.width, [window frame].size.height); 147 NSMakePoint([window frame].size.width, [window frame].size.height);
147 arrowTip = [parentWindow convertBaseToScreen:arrowTip]; 148 arrowTip = ui::ConvertPointFromWindowToScreen(parentWindow, arrowTip);
148 NSPoint bubbleArrowTip = [bubble arrowTip]; 149 NSPoint bubbleArrowTip = [bubble arrowTip];
149 bubbleArrowTip = [bubble convertPoint:bubbleArrowTip toView:nil]; 150 bubbleArrowTip = [bubble convertPoint:bubbleArrowTip toView:nil];
150 arrowTip.y -= bubbleArrowTip.y; 151 arrowTip.y -= bubbleArrowTip.y;
151 arrowTip.x -= bubbleArrowTip.x; 152 arrowTip.x -= bubbleArrowTip.x;
152 [window setFrameOrigin:arrowTip]; 153 [window setFrameOrigin:arrowTip];
153 154
154 // Default is IDS_BOOKMARK_BUBBLE_PAGE_BOOKMARK; "Bookmark". 155 // Default is IDS_BOOKMARK_BUBBLE_PAGE_BOOKMARK; "Bookmark".
155 // If adding for the 1st time the string becomes "Bookmark Added!" 156 // If adding for the 1st time the string becomes "Bookmark Added!"
156 if (!alreadyBookmarked_) { 157 if (!alreadyBookmarked_) {
157 NSString* title = 158 NSString* title =
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 NSInteger idx = [menu indexOfItemWithRepresentedObject:parentValue]; 362 NSInteger idx = [menu indexOfItemWithRepresentedObject:parentValue];
362 DCHECK(idx != -1); 363 DCHECK(idx != -1);
363 [folderPopUpButton_ selectItemAtIndex:idx]; 364 [folderPopUpButton_ selectItemAtIndex:idx];
364 } 365 }
365 366
366 - (NSPopUpButton*)folderPopUpButton { 367 - (NSPopUpButton*)folderPopUpButton {
367 return folderPopUpButton_; 368 return folderPopUpButton_;
368 } 369 }
369 370
370 @end // implementation BookmarkBubbleController(ExposedForUnitTesting) 371 @end // implementation BookmarkBubbleController(ExposedForUnitTesting)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698