summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorerikchen <erikchen@chromium.org>2016-03-10 21:39:05 -0800
committerCommit bot <commit-bot@chromium.org>2016-03-11 05:41:12 +0000
commitb39bbac875e4ee4f041058b95b03d4c2cc95c501 (patch)
tree53e943d2db1c170010b8856f19a4f6be0e7cf537
parent407315bae282036f7e5893c84569bb6ee6fc8c78 (diff)
downloadchromium_src-b39bbac875e4ee4f041058b95b03d4c2cc95c501.zip
chromium_src-b39bbac875e4ee4f041058b95b03d4c2cc95c501.tar.gz
chromium_src-b39bbac875e4ee4f041058b95b03d4c2cc95c501.tar.bz2
Prepare chrome/ for compilation with OS X 10.7 deployment target.
Replaced deprecated methods convertBaseToScreen: and convertBaseFromScreen: with ConvertPointFromWindowToScreen and ConvertPointFromScreenToWindow. BUG=592663 Review URL: https://codereview.chromium.org/1775223002 Cr-Commit-Position: refs/heads/master@{#380540}
-rw-r--r--chrome/browser/ui/cocoa/app_menu/menu_tracked_button.mm4
-rw-r--r--chrome/browser/ui/cocoa/autofill/autofill_details_container.mm5
-rw-r--r--chrome/browser/ui/cocoa/autofill/autofill_section_container.mm4
-rw-r--r--chrome/browser/ui/cocoa/autofill/autofill_tooltip_controller.mm5
-rw-r--r--chrome/browser/ui/cocoa/autofill/new_credit_card_bubble_cocoa.mm6
-rw-r--r--chrome/browser/ui/cocoa/autofill/save_card_bubble_view_bridge.mm5
-rw-r--r--chrome/browser/ui/cocoa/base_bubble_controller.mm3
-rw-r--r--chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.mm34
-rw-r--r--chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller_unittest.mm9
-rw-r--r--chrome/browser/ui/cocoa/bookmarks/bookmark_bubble_controller.mm3
-rw-r--r--chrome/browser/ui/cocoa/bookmarks/bookmark_button.mm3
-rw-r--r--chrome/browser/ui/cocoa/browser/exclusive_access_controller_views.mm4
-rw-r--r--chrome/browser/ui/cocoa/browser_window_controller.mm9
-rw-r--r--chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_controller.mm3
-rw-r--r--chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_controller_unittest.mm3
-rw-r--r--chrome/browser/ui/cocoa/download/download_started_animation_mac.mm3
-rw-r--r--chrome/browser/ui/cocoa/extensions/browser_action_button_interactive_uitest.mm3
-rw-r--r--chrome/browser/ui/cocoa/extensions/browser_actions_controller.mm3
-rw-r--r--chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller.mm5
-rw-r--r--chrome/browser/ui/cocoa/extensions/extension_message_bubble_browsertest_mac.mm7
-rw-r--r--chrome/browser/ui/cocoa/extensions/extension_popup_controller.mm3
-rw-r--r--chrome/browser/ui/cocoa/framed_browser_window.mm3
-rw-r--r--chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_unittest.mm4
-rw-r--r--chrome/browser/ui/cocoa/location_bar/content_setting_decoration.mm3
-rw-r--r--chrome/browser/ui/cocoa/location_bar/zoom_decoration.mm3
-rw-r--r--chrome/browser/ui/cocoa/omnibox/omnibox_popup_view_mac.mm6
-rw-r--r--chrome/browser/ui/cocoa/one_click_signin_bubble_controller.mm3
-rw-r--r--chrome/browser/ui/cocoa/panels/panel_titlebar_view_cocoa.mm17
-rw-r--r--chrome/browser/ui/cocoa/passwords/passwords_bubble_controller.mm4
-rw-r--r--chrome/browser/ui/cocoa/profiles/avatar_base_controller.mm3
-rw-r--r--chrome/browser/ui/cocoa/status_bubble_mac.mm6
-rw-r--r--chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm7
-rw-r--r--chrome/browser/ui/cocoa/tabs/tab_strip_drag_controller.mm9
-rw-r--r--chrome/browser/ui/cocoa/translate/translate_bubble_controller.mm4
-rw-r--r--chrome/browser/ui/cocoa/validation_message_bubble_cocoa.mm3
-rw-r--r--chrome/browser/ui/cocoa/website_settings/chooser_bubble_ui_cocoa.mm4
-rw-r--r--chrome/browser/ui/cocoa/website_settings/permission_bubble_controller.mm4
-rw-r--r--chrome/browser/ui/cocoa/website_settings/permission_bubble_controller_unittest.mm5
-rw-r--r--chrome/browser/ui/cocoa/website_settings/website_settings_bubble_controller.mm3
-rw-r--r--chrome/test/base/interactive_test_utils_cocoa.mm3
40 files changed, 134 insertions, 84 deletions
diff --git a/chrome/browser/ui/cocoa/app_menu/menu_tracked_button.mm b/chrome/browser/ui/cocoa/app_menu/menu_tracked_button.mm
index 40dfcb4..0570c66 100644
--- a/chrome/browser/ui/cocoa/app_menu/menu_tracked_button.mm
+++ b/chrome/browser/ui/cocoa/app_menu/menu_tracked_button.mm
@@ -4,6 +4,8 @@
#import "chrome/browser/ui/cocoa/app_menu/menu_tracked_button.h"
+#include "ui/base/cocoa/cocoa_base_utils.h"
+
@interface MenuTrackedButton (Private)
- (void)doHighlight:(BOOL)highlight;
- (void)checkMouseInRect;
@@ -84,7 +86,7 @@
// exit mouse events and thus polling is necessary.
- (void)checkMouseInRect {
NSPoint point = [NSEvent mouseLocation];
- point = [[self window] convertScreenToBase:point];
+ point = ui::ConvertPointFromScreenToWindow([self window], point);
point = [self convertPoint:point fromView:nil];
if (!NSPointInRect(point, [self insetBounds])) {
[self doHighlight:NO];
diff --git a/chrome/browser/ui/cocoa/autofill/autofill_details_container.mm b/chrome/browser/ui/cocoa/autofill/autofill_details_container.mm
index af7d072..88b426a 100644
--- a/chrome/browser/ui/cocoa/autofill/autofill_details_container.mm
+++ b/chrome/browser/ui/cocoa/autofill/autofill_details_container.mm
@@ -11,6 +11,7 @@
#import "chrome/browser/ui/cocoa/autofill/autofill_bubble_controller.h"
#import "chrome/browser/ui/cocoa/autofill/autofill_section_container.h"
#import "chrome/browser/ui/cocoa/info_bubble_view.h"
+#include "ui/base/cocoa/cocoa_base_utils.h"
typedef BOOL (^FieldFilterBlock)(NSView<AutofillInputField>*);
@@ -215,8 +216,8 @@ typedef BOOL (^FieldFilterBlock)(NSView<AutofillInputField>*);
[[errorBubbleController_ bubble] setAlignment:
info_bubble::kAlignLeftEdgeToAnchorEdge];
}
- [errorBubbleController_ setAnchorPoint:
- [parentWindow convertBaseToScreen:anchorPoint]];
+ [errorBubbleController_ setAnchorPoint:ui::ConvertPointFromWindowToScreen(
+ parentWindow, anchorPoint)];
errorBubbleAnchorView_ = field;
[errorBubbleController_ showWindow:self];
diff --git a/chrome/browser/ui/cocoa/autofill/autofill_section_container.mm b/chrome/browser/ui/cocoa/autofill/autofill_section_container.mm
index 432582e..320cc9d 100644
--- a/chrome/browser/ui/cocoa/autofill/autofill_section_container.mm
+++ b/chrome/browser/ui/cocoa/autofill/autofill_section_container.mm
@@ -9,6 +9,7 @@
#include <algorithm>
#include "base/mac/foundation_util.h"
+#include "base/mac/sdk_forward_declarations.h"
#include "base/strings/sys_string_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/ui/autofill/autofill_dialog_view_delegate.h"
@@ -405,8 +406,7 @@ bool ShouldOverwriteComboboxes(autofill::DialogSection section,
// Get the frame rectangle for the designated field, in screen coordinates.
NSRect textFrameInScreen = [field convertRect:[field bounds] toView:nil];
- textFrameInScreen.origin =
- [[field window] convertBaseToScreen:textFrameInScreen.origin];
+ textFrameInScreen = [[field window] convertRectToScreen:textFrameInScreen];
// And adjust for gfx::Rect being flipped compared to OSX coordinates.
NSScreen* screen = [[NSScreen screens] firstObject];
diff --git a/chrome/browser/ui/cocoa/autofill/autofill_tooltip_controller.mm b/chrome/browser/ui/cocoa/autofill/autofill_tooltip_controller.mm
index b2a66dc..d16b635 100644
--- a/chrome/browser/ui/cocoa/autofill/autofill_tooltip_controller.mm
+++ b/chrome/browser/ui/cocoa/autofill/autofill_tooltip_controller.mm
@@ -7,6 +7,7 @@
#include "base/mac/foundation_util.h"
#import "chrome/browser/ui/cocoa/autofill/autofill_bubble_controller.h"
#import "ui/base/cocoa/base_view.h"
+#include "ui/base/cocoa/cocoa_base_utils.h"
#import "ui/base/cocoa/hover_image_button.h"
// Delay time before tooltip shows/hides.
@@ -164,8 +165,8 @@ CGFloat kTooltipInset = 10;
// Compute anchor point (in window coords - views might be flipped).
NSRect viewRect = [view_ convertRect:[view_ bounds] toView:nil];
NSPoint anchorPoint = NSMakePoint(NSMidX(viewRect), NSMinY(viewRect));
- [bubbleController_ setAnchorPoint:
- [[[self view] window] convertBaseToScreen:anchorPoint]];
+ [bubbleController_ setAnchorPoint:ui::ConvertPointFromWindowToScreen(
+ [[self view] window], anchorPoint)];
[bubbleController_ showWindow:self];
}
diff --git a/chrome/browser/ui/cocoa/autofill/new_credit_card_bubble_cocoa.mm b/chrome/browser/ui/cocoa/autofill/new_credit_card_bubble_cocoa.mm
index 3c8c92b..c072c34 100644
--- a/chrome/browser/ui/cocoa/autofill/new_credit_card_bubble_cocoa.mm
+++ b/chrome/browser/ui/cocoa/autofill/new_credit_card_bubble_cocoa.mm
@@ -17,6 +17,7 @@
#import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h"
#include "content/public/browser/web_contents.h"
#include "skia/ext/skia_utils_mac.h"
+#include "ui/base/cocoa/cocoa_base_utils.h"
#import "ui/base/cocoa/controls/hyperlink_button_cell.h"
#include "ui/base/cocoa/window_size_constants.h"
#include "ui/native_theme/native_theme.h"
@@ -235,9 +236,8 @@ void NewCreditCardBubbleCocoa::Show() {
anchor_point.y = NSMaxY([anchor_view bounds]) - anchor_point.y;
anchor_point = [anchor_view convertPoint:anchor_point toView:nil];
- NSRect frame = NSZeroRect;
- frame.origin = anchor_point;
- anchor_point = [parent_window convertBaseToScreen:anchor_point];
+ anchor_point =
+ ui::ConvertPointFromWindowToScreen(parent_window, anchor_point);
[bubbleController_ showAtAnchor:anchor_point];
}
diff --git a/chrome/browser/ui/cocoa/autofill/save_card_bubble_view_bridge.mm b/chrome/browser/ui/cocoa/autofill/save_card_bubble_view_bridge.mm
index 969b3db..46bf2f6 100644
--- a/chrome/browser/ui/cocoa/autofill/save_card_bubble_view_bridge.mm
+++ b/chrome/browser/ui/cocoa/autofill/save_card_bubble_view_bridge.mm
@@ -14,6 +14,7 @@
#import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h"
#include "grit/components_strings.h"
#include "skia/ext/skia_utils_mac.h"
+#include "ui/base/cocoa/cocoa_base_utils.h"
#import "ui/base/cocoa/controls/hyperlink_text_view.h"
#import "ui/base/cocoa/window_size_constants.h"
#include "ui/base/l10n/l10n_util.h"
@@ -198,8 +199,8 @@ void SaveCardBubbleViewBridge::Hide() {
NSPoint anchorPoint =
[[browserWindowController toolbarController] saveCreditCardBubblePoint];
- anchorPoint =
- [[browserWindowController window] convertBaseToScreen:anchorPoint];
+ anchorPoint = ui::ConvertPointFromWindowToScreen(
+ [browserWindowController window], anchorPoint);
if ((self = [super initWithWindow:window
parentWindow:[browserWindowController window]
diff --git a/chrome/browser/ui/cocoa/base_bubble_controller.mm b/chrome/browser/ui/cocoa/base_bubble_controller.mm
index a252997..3d84e03 100644
--- a/chrome/browser/ui/cocoa/base_bubble_controller.mm
+++ b/chrome/browser/ui/cocoa/base_bubble_controller.mm
@@ -16,6 +16,7 @@
#import "chrome/browser/ui/cocoa/info_bubble_window.h"
#import "chrome/browser/ui/cocoa/tabs/tab_strip_model_observer_bridge.h"
#include "components/bubble/bubble_controller.h"
+#include "ui/base/cocoa/cocoa_base_utils.h"
@interface BaseBubbleController (Private)
- (void)registerForNotifications;
@@ -68,7 +69,7 @@
NSRect bounds = [view convertRect:[view bounds] toView:nil];
NSPoint anchor = NSMakePoint(NSMinX(bounds) + offset.x,
NSMinY(bounds) + offset.y);
- anchor = [window convertBaseToScreen:anchor];
+ anchor = ui::ConvertPointFromWindowToScreen(window, anchor);
return [self initWithWindowNibPath:nibPath
parentWindow:window
anchoredAt:anchor];
diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.mm
index f0b85f5..704dcbe 100644
--- a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.mm
+++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.mm
@@ -7,6 +7,7 @@
#include <stddef.h>
#include "base/mac/bundle_locations.h"
+#include "base/mac/sdk_forward_declarations.h"
#include "base/strings/sys_string_conversions.h"
#import "chrome/browser/bookmarks/bookmark_model_factory.h"
#import "chrome/browser/bookmarks/managed_bookmark_service_factory.h"
@@ -23,6 +24,7 @@
#include "components/bookmarks/browser/bookmark_model.h"
#include "components/bookmarks/browser/bookmark_node_data.h"
#import "components/bookmarks/managed/managed_bookmark_service.h"
+#include "ui/base/cocoa/cocoa_base_utils.h"
#include "ui/base/theme_provider.h"
using bookmarks::BookmarkModel;
@@ -496,14 +498,12 @@ NSRect GetFirstButtonFrameForHeight(CGFloat height) {
// popping up from the bookmark bar itself. In this case, start
// BELOW the parent button. Our left is the button left; our top
// is bottom of button's parent view.
- NSPoint buttonBottomLeftInScreen =
- [[parentButton_ window]
- convertBaseToScreen:[parentButton_
- convertPoint:NSZeroPoint toView:nil]];
- NSPoint bookmarkBarBottomLeftInScreen =
- [[parentButton_ window]
- convertBaseToScreen:[[parentButton_ superview]
- convertPoint:NSZeroPoint toView:nil]];
+ NSPoint buttonBottomLeftInScreen = ui::ConvertPointFromWindowToScreen(
+ [parentButton_ window],
+ [parentButton_ convertPoint:NSZeroPoint toView:nil]);
+ NSPoint bookmarkBarBottomLeftInScreen = ui::ConvertPointFromWindowToScreen(
+ [parentButton_ window],
+ [[parentButton_ superview] convertPoint:NSZeroPoint toView:nil]);
newWindowTopLeft = NSMakePoint(
buttonBottomLeftInScreen.x + bookmarks::kBookmarkBarButtonOffset,
bookmarkBarBottomLeftInScreen.y + bookmarks::kBookmarkBarMenuOffset);
@@ -538,9 +538,9 @@ NSRect GetFirstButtonFrameForHeight(CGFloat height) {
NSPoint topOfWindow = NSMakePoint(0,
NSMaxY([parentButton_ frame]) -
bookmarks::kBookmarkVerticalPadding);
- topOfWindow = [[parentButton_ window]
- convertBaseToScreen:[[parentButton_ superview]
- convertPoint:topOfWindow toView:nil]];
+ topOfWindow = ui::ConvertPointFromWindowToScreen(
+ [parentButton_ window],
+ [[parentButton_ superview] convertPoint:topOfWindow toView:nil]);
newWindowTopLeft.y = topOfWindow.y +
2 * bookmarks::kBookmarkVerticalPadding;
}
@@ -1040,8 +1040,8 @@ NSRect GetFirstButtonFrameForHeight(CGFloat height) {
NSButton* button = parentButton_.get();
NSRect parentButtonGlobalFrame =
[button convertRect:[button bounds] toView:nil];
- parentButtonGlobalFrame.origin =
- [[button window] convertBaseToScreen:parentButtonGlobalFrame.origin];
+ parentButtonGlobalFrame =
+ [[button window] convertRectToScreen:parentButtonGlobalFrame];
for (NSScreen* screen in [NSScreen screens]) {
if (NSIntersectsRect([screen frame], parentButtonGlobalFrame))
return screen;
@@ -1064,19 +1064,19 @@ NSRect GetFirstButtonFrameForHeight(CGFloat height) {
// Note [theEvent window] may not be our window, as we also get these messages
// forwarded from BookmarkButton's mouse tracking loop.
- (void)mouseMovedOrDragged:(NSEvent*)theEvent {
- NSPoint eventScreenLocation =
- [[theEvent window] convertBaseToScreen:[theEvent locationInWindow]];
+ NSPoint eventScreenLocation = ui::ConvertPointFromWindowToScreen(
+ [theEvent window], [theEvent locationInWindow]);
// Base hot spot calculations on the positions of the scroll arrow views.
NSRect testRect = [scrollDownArrowView_ frame];
NSPoint testPoint = [visibleView_ convertPoint:testRect.origin
toView:nil];
- testPoint = [[self window] convertBaseToScreen:testPoint];
+ testPoint = ui::ConvertPointFromWindowToScreen([self window], testPoint);
CGFloat closeToTopOfScreen = testPoint.y;
testRect = [scrollUpArrowView_ frame];
testPoint = [visibleView_ convertPoint:testRect.origin toView:nil];
- testPoint = [[self window] convertBaseToScreen:testPoint];
+ testPoint = ui::ConvertPointFromWindowToScreen([self window], testPoint);
CGFloat closeToBottomOfScreen = testPoint.y + testRect.size.height;
if (eventScreenLocation.y <= closeToBottomOfScreen &&
![scrollUpArrowView_ isHidden]) {
diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller_unittest.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller_unittest.mm
index e516532..fa15a13 100644
--- a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller_unittest.mm
+++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller_unittest.mm
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <cmath>
+
#include "base/mac/scoped_nsobject.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/bookmarks/bookmark_model_factory.h"
@@ -20,8 +22,7 @@
#import "testing/gtest_mac.h"
#include "testing/platform_test.h"
#include "ui/base/cocoa/animation_utils.h"
-
-#include <cmath>
+#include "ui/base/cocoa/cocoa_base_utils.h"
using base::ASCIIToUTF16;
using bookmarks::BookmarkModel;
@@ -269,8 +270,8 @@ TEST_F(BookmarkBarFolderControllerTest, BasicPosition) {
NSPoint buttonOriginInWindow =
[parentButton convertRect:[parentButton bounds]
toView:nil].origin;
- NSPoint buttonOriginInScreen =
- [[parentButton window] convertBaseToScreen:buttonOriginInWindow];
+ NSPoint buttonOriginInScreen = ui::ConvertPointFromWindowToScreen(
+ [parentButton window], buttonOriginInWindow);
// Within margin
EXPECT_LE(std::abs(pt.x - buttonOriginInScreen.x),
bookmarks::kBookmarkMenuOverlap + 1);
diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_bubble_controller.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_bubble_controller.mm
index f78e17a..53df21e 100644
--- a/chrome/browser/ui/cocoa/bookmarks/bookmark_bubble_controller.mm
+++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_bubble_controller.mm
@@ -24,6 +24,7 @@
#include "content/public/browser/notification_registrar.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/user_metrics.h"
+#include "ui/base/cocoa/cocoa_base_utils.h"
#include "ui/base/l10n/l10n_util_mac.h"
using base::UserMetricsAction;
@@ -144,7 +145,7 @@ using bookmarks::BookmarkNode;
// which will occur for some unit tests.
NSPoint arrowTip = bwc ? [bwc bookmarkBubblePoint] :
NSMakePoint([window frame].size.width, [window frame].size.height);
- arrowTip = [parentWindow convertBaseToScreen:arrowTip];
+ arrowTip = ui::ConvertPointFromWindowToScreen(parentWindow, arrowTip);
NSPoint bubbleArrowTip = [bubble arrowTip];
bubbleArrowTip = [bubble convertPoint:bubbleArrowTip toView:nil];
arrowTip.y -= bubbleArrowTip.y;
diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_button.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_button.mm
index bb689e5..6eea936 100644
--- a/chrome/browser/ui/cocoa/bookmarks/bookmark_button.mm
+++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_button.mm
@@ -15,6 +15,7 @@
#import "chrome/browser/ui/cocoa/view_id_util.h"
#include "components/bookmarks/browser/bookmark_model.h"
#include "content/public/browser/user_metrics.h"
+#include "ui/base/cocoa/cocoa_base_utils.h"
#import "ui/base/cocoa/nsview_additions.h"
#include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h"
@@ -109,7 +110,7 @@ BookmarkButton* gDraggedButton = nil; // Weak
NSRect bounds = [self bounds];
point = NSMakePoint(NSMidX(bounds), NSMidY(bounds));
point = [self convertPoint:point toView:nil];
- point = [[self window] convertBaseToScreen:point];
+ point = ui::ConvertPointFromWindowToScreen([self window], point);
}
return point;
diff --git a/chrome/browser/ui/cocoa/browser/exclusive_access_controller_views.mm b/chrome/browser/ui/cocoa/browser/exclusive_access_controller_views.mm
index 3873c46..50a20aa 100644
--- a/chrome/browser/ui/cocoa/browser/exclusive_access_controller_views.mm
+++ b/chrome/browser/ui/cocoa/browser/exclusive_access_controller_views.mm
@@ -15,6 +15,7 @@
#include "chrome/browser/ui/views/exclusive_access_bubble_views.h"
#include "chrome/common/pref_names.h"
#include "components/prefs/pref_service.h"
+#include "ui/base/cocoa/cocoa_base_utils.h"
#import "ui/gfx/mac/coordinate_conversion.h"
ExclusiveAccessController::ExclusiveAccessController(
@@ -167,7 +168,8 @@ gfx::NativeView ExclusiveAccessController::GetBubbleParentView() const {
gfx::Point ExclusiveAccessController::GetCursorPointInParent() const {
NSWindow* window = [controller_ window];
- NSPoint location = [window convertScreenToBase:[NSEvent mouseLocation]];
+ NSPoint location =
+ ui::ConvertPointFromScreenToWindow(window, [NSEvent mouseLocation]);
return gfx::Point(location.x,
NSHeight([[window contentView] frame]) - location.y);
}
diff --git a/chrome/browser/ui/cocoa/browser_window_controller.mm b/chrome/browser/ui/cocoa/browser_window_controller.mm
index 7fd16e9..c660dfd 100644
--- a/chrome/browser/ui/cocoa/browser_window_controller.mm
+++ b/chrome/browser/ui/cocoa/browser_window_controller.mm
@@ -1171,8 +1171,9 @@ void SetUpBrowserWindowCommandHandler(NSWindow* window) {
NSPoint tabOrigin = destinationFrame.origin;
tabOrigin = [[dragController tabStripView] convertPoint:tabOrigin
toView:nil];
- tabOrigin = [[dragController window] convertBaseToScreen:tabOrigin];
- tabOrigin = [[self window] convertScreenToBase:tabOrigin];
+ tabOrigin = ui::ConvertPointFromWindowToScreen([dragController window],
+ tabOrigin);
+ tabOrigin = ui::ConvertPointFromScreenToWindow([self window], tabOrigin);
tabOrigin = [[self tabStripView] convertPoint:tabOrigin fromView:nil];
destinationFrame.origin = tabOrigin;
@@ -1559,8 +1560,8 @@ void SetUpBrowserWindowCommandHandler(NSWindow* window) {
if (chrome::ToolkitViewsDialogsEnabled()) {
chrome::ShowBookmarkBubbleViewsAtPoint(
- gfx::ScreenPointFromNSPoint(
- [[self window] convertBaseToScreen:[self bookmarkBubblePoint]]),
+ gfx::ScreenPointFromNSPoint(ui::ConvertPointFromWindowToScreen(
+ [self window], [self bookmarkBubblePoint])),
[[self window] contentView], bookmarkBubbleObserver_.get(),
browser_.get(), url, alreadyMarked);
} else {
diff --git a/chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_controller.mm b/chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_controller.mm
index db2d495..ec7db25 100644
--- a/chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_controller.mm
+++ b/chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_controller.mm
@@ -7,6 +7,7 @@
#include <map>
#include "base/logging.h"
+#include "base/mac/sdk_forward_declarations.h"
#import "chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet.h"
#include "chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_info.h"
#import "chrome/browser/ui/cocoa/web_contents_modal_dialog_host_cocoa.h"
@@ -317,7 +318,7 @@ NSRect GetSheetParentBoundsForParentView(NSView* view) {
viewFrame.size.height += NSMinY(customSheetFrame) - NSMinY(sheetFrame);
}
- viewFrame.origin = [[parentView window] convertBaseToScreen:viewFrame.origin];
+ viewFrame = [[parentView window] convertRectToScreen:viewFrame];
return viewFrame;
}
diff --git a/chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_controller_unittest.mm b/chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_controller_unittest.mm
index 6566d21..5c0b0d5 100644
--- a/chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_controller_unittest.mm
+++ b/chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_controller_unittest.mm
@@ -6,6 +6,7 @@
#include <stddef.h>
+#include "base/mac/sdk_forward_declarations.h"
#include "base/macros.h"
#import "chrome/browser/ui/cocoa/cocoa_test_helper.h"
#import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_sheet.h"
@@ -159,7 +160,7 @@ class ConstrainedWindowSheetControllerTest : public CocoaTest {
NSRect GetViewFrameInScreenCoordinates(NSView* view) {
NSRect rect = [view convertRect:[view bounds] toView:nil];
- rect.origin = [[view window] convertBaseToScreen:rect.origin];
+ rect = [[view window] convertRectToScreen:rect];
return rect;
}
diff --git a/chrome/browser/ui/cocoa/download/download_started_animation_mac.mm b/chrome/browser/ui/cocoa/download/download_started_animation_mac.mm
index f477255..ef99973 100644
--- a/chrome/browser/ui/cocoa/download/download_started_animation_mac.mm
+++ b/chrome/browser/ui/cocoa/download/download_started_animation_mac.mm
@@ -17,6 +17,7 @@
#include "grit/theme_resources.h"
#import "third_party/google_toolbox_for_mac/src/AppKit/GTMNSAnimation+Duration.h"
#include "third_party/skia/include/utils/mac/SkCGUtils.h"
+#include "ui/base/cocoa/cocoa_base_utils.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/image/image.h"
@@ -68,7 +69,7 @@ class DownloadAnimationWebObserver;
NSPoint origin = [tabContentsView frame].origin;
origin = [tabContentsView convertPoint:origin toView:nil];
- origin = [parentWindow convertBaseToScreen:origin];
+ origin = ui::ConvertPointFromWindowToScreen(parentWindow, origin);
// Create the animation object to assist in animating and fading.
CGFloat animationHeight = MIN(bounds.height(), 4 * imageHeight);
diff --git a/chrome/browser/ui/cocoa/extensions/browser_action_button_interactive_uitest.mm b/chrome/browser/ui/cocoa/extensions/browser_action_button_interactive_uitest.mm
index 6e59f9a..03717c0 100644
--- a/chrome/browser/ui/cocoa/extensions/browser_action_button_interactive_uitest.mm
+++ b/chrome/browser/ui/cocoa/extensions/browser_action_button_interactive_uitest.mm
@@ -30,6 +30,7 @@
#include "chrome/browser/ui/toolbar/toolbar_actions_model.h"
#include "chrome/test/base/interactive_test_utils.h"
#include "extensions/common/feature_switch.h"
+#include "ui/base/cocoa/cocoa_base_utils.h"
#import "ui/events/test/cocoa_test_event_utils.h"
namespace {
@@ -75,7 +76,7 @@ NSPoint GetCenterPoint(NSView* view) {
NSRect bounds = [view bounds];
NSPoint center = NSMakePoint(NSMidX(bounds), NSMidY(bounds));
center = [view convertPoint:center toView:nil];
- center = [window convertBaseToScreen:center];
+ center = ui::ConvertPointFromWindowToScreen(window, center);
return NSMakePoint(center.x, [screen frame].size.height - center.y);
}
diff --git a/chrome/browser/ui/cocoa/extensions/browser_actions_controller.mm b/chrome/browser/ui/cocoa/extensions/browser_actions_controller.mm
index 118e94a..3f97173 100644
--- a/chrome/browser/ui/cocoa/extensions/browser_actions_controller.mm
+++ b/chrome/browser/ui/cocoa/extensions/browser_actions_controller.mm
@@ -31,6 +31,7 @@
#include "grit/theme_resources.h"
#import "third_party/google_toolbox_for_mac/src/AppKit/GTMNSAnimation+Duration.h"
#include "ui/base/cocoa/appkit_utils.h"
+#include "ui/base/cocoa/cocoa_base_utils.h"
#include "ui/base/material_design/material_design_controller.h"
NSString* const kBrowserActionVisibilityChangedNotification =
@@ -1048,7 +1049,7 @@ void ToolbarActionsBarBridge::ShowExtensionMessageBubble(
NSPoint anchor = [self popupPointForView:anchorView
withBounds:[anchorView bounds]];
- anchor = [[containerView_ window] convertBaseToScreen:anchor];
+ anchor = ui::ConvertPointFromWindowToScreen([containerView_ window], anchor);
activeBubble_ = [[ToolbarActionsBarBubbleMac alloc]
initWithParentWindow:[containerView_ window]
anchorPoint:anchor
diff --git a/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller.mm b/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller.mm
index 537389e..f36c90c 100644
--- a/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller.mm
+++ b/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller.mm
@@ -48,6 +48,7 @@
#import "skia/ext/skia_utils_mac.h"
#import "third_party/google_toolbox_for_mac/src/AppKit/GTMUILocalizerAndLayoutTweaker.h"
#include "third_party/skia/include/core/SkBitmap.h"
+#include "ui/base/cocoa/cocoa_base_utils.h"
#import "ui/base/cocoa/controls/hyperlink_text_view.h"
#include "ui/base/l10n/l10n_util.h"
@@ -588,8 +589,8 @@ scoped_ptr<BubbleUi> ExtensionInstalledBubble::BuildBubbleUi() {
}
- (void)updateAnchorPosition {
- self.anchorPoint =
- [self.parentWindow convertBaseToScreen:[self calculateArrowPoint]];
+ self.anchorPoint = ui::ConvertPointFromWindowToScreen(
+ self.parentWindow, [self calculateArrowPoint]);
}
- (IBAction)onManageShortcutClicked:(id)sender {
diff --git a/chrome/browser/ui/cocoa/extensions/extension_message_bubble_browsertest_mac.mm b/chrome/browser/ui/cocoa/extensions/extension_message_bubble_browsertest_mac.mm
index 66ff65c..f599771 100644
--- a/chrome/browser/ui/cocoa/extensions/extension_message_bubble_browsertest_mac.mm
+++ b/chrome/browser/ui/cocoa/extensions/extension_message_bubble_browsertest_mac.mm
@@ -10,6 +10,7 @@
#import "chrome/browser/ui/cocoa/extensions/toolbar_actions_bar_bubble_mac.h"
#import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h"
#include "chrome/browser/ui/extensions/extension_message_bubble_browsertest.h"
+#include "ui/base/cocoa/cocoa_base_utils.h"
namespace {
@@ -39,9 +40,11 @@ void CheckBubbleAndReferenceView(ToolbarActionsBarBubbleMac* bubble,
CGFloat refLowY = [expectedReferenceView isFlipped] ?
NSMaxY(referenceFrame) : NSMinY(referenceFrame);
NSPoint refLowerLeft = NSMakePoint(NSMinX(referenceFrame), refLowY);
- NSPoint refLowerLeftInScreen = [window convertBaseToScreen:refLowerLeft];
+ NSPoint refLowerLeftInScreen =
+ ui::ConvertPointFromWindowToScreen(window, refLowerLeft);
NSPoint refLowerRight = NSMakePoint(NSMaxX(referenceFrame), refLowY);
- NSPoint refLowerRightInScreen = [window convertBaseToScreen:refLowerRight];
+ NSPoint refLowerRightInScreen =
+ ui::ConvertPointFromWindowToScreen(window, refLowerRight);
// The bubble should be below the reference view, but not too far below.
EXPECT_LE(NSMaxY(bubbleFrame), refLowerLeftInScreen.y);
diff --git a/chrome/browser/ui/cocoa/extensions/extension_popup_controller.mm b/chrome/browser/ui/cocoa/extensions/extension_popup_controller.mm
index b192160..a714d48 100644
--- a/chrome/browser/ui/cocoa/extensions/extension_popup_controller.mm
+++ b/chrome/browser/ui/cocoa/extensions/extension_popup_controller.mm
@@ -23,6 +23,7 @@
#include "content/public/browser/notification_details.h"
#include "content/public/browser/notification_source.h"
#include "extensions/browser/notification_types.h"
+#include "ui/base/cocoa/cocoa_base_utils.h"
#include "ui/base/cocoa/window_size_constants.h"
using content::BrowserContext;
@@ -176,7 +177,7 @@ class ExtensionPopupNotificationBridge : public content::NotificationObserver {
if (!window.get())
return nil;
- anchoredAt = [parentWindow convertBaseToScreen:anchoredAt];
+ anchoredAt = ui::ConvertPointFromWindowToScreen(parentWindow, anchoredAt);
if ((self = [super initWithWindow:window
parentWindow:parentWindow
anchoredAt:anchoredAt])) {
diff --git a/chrome/browser/ui/cocoa/framed_browser_window.mm b/chrome/browser/ui/cocoa/framed_browser_window.mm
index 0b1c319..4dd7685 100644
--- a/chrome/browser/ui/cocoa/framed_browser_window.mm
+++ b/chrome/browser/ui/cocoa/framed_browser_window.mm
@@ -17,6 +17,7 @@
#import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h"
#import "chrome/browser/ui/cocoa/themed_window.h"
#include "grit/theme_resources.h"
+#include "ui/base/cocoa/cocoa_base_utils.h"
#include "ui/base/cocoa/nsgraphics_context_additions.h"
#import "ui/base/cocoa/nsview_additions.h"
#include "ui/base/material_design/material_design_controller.h"
@@ -167,7 +168,7 @@ const CGFloat kWindowGradientHeight = 24.0;
// The tab strip view covers our window buttons. So we add hit testing here
// to find them properly and return them to the accessibility system.
- (id)accessibilityHitTest:(NSPoint)point {
- NSPoint windowPoint = [self convertScreenToBase:point];
+ NSPoint windowPoint = ui::ConvertPointFromScreenToWindow(self, point);
NSControl* controls[] = { closeButton_, zoomButton_, miniaturizeButton_ };
id value = nil;
for (size_t i = 0; i < sizeof(controls) / sizeof(controls[0]); ++i) {
diff --git a/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_unittest.mm b/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_unittest.mm
index 59608c9..ebd04cf 100644
--- a/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_unittest.mm
+++ b/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_unittest.mm
@@ -18,6 +18,7 @@
#include "testing/gtest/include/gtest/gtest.h"
#import "testing/gtest_mac.h"
#include "testing/platform_test.h"
+#include "ui/base/cocoa/cocoa_base_utils.h"
using ::testing::A;
using ::testing::InSequence;
@@ -50,7 +51,8 @@ NSEvent* Event(NSView* view, const NSPoint point, const NSEventType type,
const NSUInteger clickCount) {
NSWindow* window([view window]);
const NSPoint locationInWindow([view convertPoint:point toView:nil]);
- const NSPoint location([window convertBaseToScreen:locationInWindow]);
+ const NSPoint location =
+ ui::ConvertPointFromWindowToScreen(window, locationInWindow);
return [NSEvent mouseEventWithType:type
location:location
modifierFlags:0
diff --git a/chrome/browser/ui/cocoa/location_bar/content_setting_decoration.mm b/chrome/browser/ui/cocoa/location_bar/content_setting_decoration.mm
index e737e90..2541cc0 100644
--- a/chrome/browser/ui/cocoa/location_bar/content_setting_decoration.mm
+++ b/chrome/browser/ui/cocoa/location_bar/content_setting_decoration.mm
@@ -22,6 +22,7 @@
#include "content/public/browser/web_contents.h"
#include "grit/theme_resources.h"
#include "ui/base/cocoa/appkit_utils.h"
+#include "ui/base/cocoa/cocoa_base_utils.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/gfx/image/image.h"
#include "ui/gfx/mac/coordinate_conversion.h"
@@ -268,7 +269,7 @@ bool ContentSettingDecoration::OnMousePressed(NSRect frame, NSPoint location) {
AutocompleteTextField* field = owner_->GetAutocompleteTextField();
NSPoint anchor = GetBubblePointInFrame(frame);
anchor = [field convertPoint:anchor toView:nil];
- anchor = [[field window] convertBaseToScreen:anchor];
+ anchor = ui::ConvertPointFromWindowToScreen([field window], anchor);
// Open bubble.
ContentSettingBubbleModel* model =
diff --git a/chrome/browser/ui/cocoa/location_bar/zoom_decoration.mm b/chrome/browser/ui/cocoa/location_bar/zoom_decoration.mm
index 659f2a6..08d012f 100644
--- a/chrome/browser/ui/cocoa/location_bar/zoom_decoration.mm
+++ b/chrome/browser/ui/cocoa/location_bar/zoom_decoration.mm
@@ -14,6 +14,7 @@
#include "chrome/grit/generated_resources.h"
#include "components/ui/zoom/zoom_controller.h"
#include "grit/theme_resources.h"
+#include "ui/base/cocoa/cocoa_base_utils.h"
#include "ui/base/l10n/l10n_util_mac.h"
ZoomDecoration::ZoomDecoration(LocationBarViewMac* owner)
@@ -70,7 +71,7 @@ void ZoomDecoration::ShowBubble(BOOL auto_close) {
// Find point for bubble's arrow in screen coordinates.
NSPoint anchor = GetBubblePointInFrame(frame);
anchor = [field convertPoint:anchor toView:nil];
- anchor = [[field window] convertBaseToScreen:anchor];
+ anchor = ui::ConvertPointFromWindowToScreen([field window], anchor);
bubble_ = [[ZoomBubbleController alloc] initWithParentWindow:[field window]
delegate:this];
diff --git a/chrome/browser/ui/cocoa/omnibox/omnibox_popup_view_mac.mm b/chrome/browser/ui/cocoa/omnibox/omnibox_popup_view_mac.mm
index b4249c1..f8a10b8 100644
--- a/chrome/browser/ui/cocoa/omnibox/omnibox_popup_view_mac.mm
+++ b/chrome/browser/ui/cocoa/omnibox/omnibox_popup_view_mac.mm
@@ -202,9 +202,11 @@ void OmniboxPopupViewMac::PositionPopup(const CGFloat matrixHeight) {
popup_frame.size.height += [OmniboxPopupTopSeparatorView preferredHeight];
popup_frame.size.height += [OmniboxPopupBottomSeparatorView preferredHeight];
popup_frame.origin.y -= NSHeight(popup_frame);
+
// Shift to screen coordinates.
- popup_frame.origin =
- [[controller window] convertBaseToScreen:popup_frame.origin];
+ if ([controller window]) {
+ popup_frame = [[controller window] convertRectToScreen:popup_frame];
+ }
// Top separator.
NSRect top_separator_frame = NSZeroRect;
diff --git a/chrome/browser/ui/cocoa/one_click_signin_bubble_controller.mm b/chrome/browser/ui/cocoa/one_click_signin_bubble_controller.mm
index 5acb2d8..582a2a2 100644
--- a/chrome/browser/ui/cocoa/one_click_signin_bubble_controller.mm
+++ b/chrome/browser/ui/cocoa/one_click_signin_bubble_controller.mm
@@ -9,6 +9,7 @@
#import "chrome/browser/ui/cocoa/info_bubble_window.h"
#import "chrome/browser/ui/cocoa/one_click_signin_view_controller.h"
#import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h"
+#include "ui/base/cocoa/cocoa_base_utils.h"
namespace {
@@ -41,7 +42,7 @@ void PerformClose(OneClickSigninBubbleController* controller) {
const NSRect bounds = [appMenuButton bounds];
NSPoint anchorPoint = NSMakePoint(NSMidX(bounds), NSMaxY(bounds));
anchorPoint = [appMenuButton convertPoint:anchorPoint toView:nil];
- anchorPoint = [parentWindow convertBaseToScreen:anchorPoint];
+ anchorPoint = ui::ConvertPointFromWindowToScreen(parentWindow, anchorPoint);
// Create an empty window into which content is placed.
NSRect viewBounds = [[viewController_ view] bounds];
diff --git a/chrome/browser/ui/cocoa/panels/panel_titlebar_view_cocoa.mm b/chrome/browser/ui/cocoa/panels/panel_titlebar_view_cocoa.mm
index f82f3f6..c7a9665 100644
--- a/chrome/browser/ui/cocoa/panels/panel_titlebar_view_cocoa.mm
+++ b/chrome/browser/ui/cocoa/panels/panel_titlebar_view_cocoa.mm
@@ -14,6 +14,7 @@
#include "grit/theme_resources.h"
#import "third_party/google_toolbox_for_mac/src/AppKit/GTMNSBezierPath+RoundRect.h"
#import "third_party/google_toolbox_for_mac/src/AppKit/GTMNSColor+Luminance.h"
+#include "ui/base/cocoa/cocoa_base_utils.h"
#import "ui/base/cocoa/hover_image_button.h"
#import "ui/base/cocoa/nsview_additions.h"
#include "ui/base/l10n/l10n_util_mac.h"
@@ -418,8 +419,8 @@ static NSEvent* MakeMouseEvent(NSEventType type,
}
- (void)dragStarted:(NSPoint)initialMouseLocation {
- NSPoint initialMouseLocationScreen =
- [[self window] convertBaseToScreen:initialMouseLocation];
+ NSPoint initialMouseLocationScreen = ui::ConvertPointFromWindowToScreen(
+ [self window], initialMouseLocation);
[controller_ startDrag:initialMouseLocationScreen];
}
@@ -428,8 +429,8 @@ static NSEvent* MakeMouseEvent(NSEventType type,
}
- (void)dragProgress:(NSPoint)mouseLocation {
- NSPoint mouseLocationScreen =
- [[self window] convertBaseToScreen:mouseLocation];
+ NSPoint mouseLocationScreen = ui::ConvertPointFromWindowToScreen(
+ [self window], mouseLocation);
[controller_ drag:mouseLocationScreen];
}
@@ -530,8 +531,8 @@ static NSEvent* MakeMouseEvent(NSEventType type,
dragController_.reset([[TestDragController alloc] initWithClient:self]);
// Convert from Cocoa's screen coordinates to base coordinates since the mouse
// event takes base (NSWindow) coordinates.
- NSPoint mouseLocationWindow =
- [[self window] convertScreenToBase:mouseLocation];
+ NSPoint mouseLocationWindow = ui::ConvertPointFromScreenToWindow(
+ [self window], mouseLocation);
NSEvent* event = MakeMouseEvent(NSLeftMouseDown, mouseLocationWindow,
modifierFlags, 0);
[self mouseDown:event];
@@ -545,8 +546,8 @@ static NSEvent* MakeMouseEvent(NSEventType type,
- (void)dragTitlebar:(NSPoint)mouseLocation {
// Convert from Cocoa's screen coordinates to base coordinates since the mouse
// event takes base (NSWindow) coordinates.
- NSPoint mouseLocationWindow =
- [[self window] convertScreenToBase:mouseLocation];
+ NSPoint mouseLocationWindow = ui::ConvertPointFromScreenToWindow(
+ [self window], mouseLocation);
NSEvent* event =
MakeMouseEvent(NSLeftMouseDragged, mouseLocationWindow, 0, 0);
[self mouseDragged:event];
diff --git a/chrome/browser/ui/cocoa/passwords/passwords_bubble_controller.mm b/chrome/browser/ui/cocoa/passwords/passwords_bubble_controller.mm
index b9139d2..4afa92b 100644
--- a/chrome/browser/ui/cocoa/passwords/passwords_bubble_controller.mm
+++ b/chrome/browser/ui/cocoa/passwords/passwords_bubble_controller.mm
@@ -15,6 +15,7 @@
#import "chrome/browser/ui/cocoa/passwords/manage_passwords_view_controller.h"
#import "chrome/browser/ui/cocoa/passwords/save_pending_password_view_controller.h"
#import "chrome/browser/ui/cocoa/passwords/update_pending_password_view_controller.h"
+#include "ui/base/cocoa/cocoa_base_utils.h"
#include "ui/base/cocoa/window_size_constants.h"
@interface ManagePasswordsBubbleController ()
@@ -115,7 +116,8 @@
[[self bubble] setArrowLocation:arrow];
// Update the anchor point.
- anchorPoint = [[self parentWindow] convertBaseToScreen:anchorPoint];
+ anchorPoint =
+ ui::ConvertPointFromWindowToScreen([self parentWindow], anchorPoint);
[self setAnchorPoint:anchorPoint];
// Update the frame.
diff --git a/chrome/browser/ui/cocoa/profiles/avatar_base_controller.mm b/chrome/browser/ui/cocoa/profiles/avatar_base_controller.mm
index e333694..ef503f0 100644
--- a/chrome/browser/ui/cocoa/profiles/avatar_base_controller.mm
+++ b/chrome/browser/ui/cocoa/profiles/avatar_base_controller.mm
@@ -24,6 +24,7 @@
#import "chrome/browser/ui/cocoa/profiles/profile_chooser_controller.h"
#include "components/signin/core/browser/signin_error_controller.h"
#include "components/signin/core/common/profile_management_switches.h"
+#include "ui/base/cocoa/cocoa_base_utils.h"
// Space between the avatar icon and the avatar menu bubble.
const CGFloat kMenuYOffsetAdjust = 1.0;
@@ -179,7 +180,7 @@ class ProfileAttributesUpdateObserver
NSPoint point = NSMakePoint(anchorX,
NSMaxY([anchor bounds]) + kMenuYOffsetAdjust);
point = [anchor convertPoint:point toView:nil];
- point = [[anchor window] convertBaseToScreen:point];
+ point = ui::ConvertPointFromWindowToScreen([anchor window], point);
// |menuController_| will automatically release itself on close.
profiles::BubbleViewMode viewMode;
diff --git a/chrome/browser/ui/cocoa/status_bubble_mac.mm b/chrome/browser/ui/cocoa/status_bubble_mac.mm
index 503a070..653e333 100644
--- a/chrome/browser/ui/cocoa/status_bubble_mac.mm
+++ b/chrome/browser/ui/cocoa/status_bubble_mac.mm
@@ -22,6 +22,7 @@
#import "third_party/google_toolbox_for_mac/src/AppKit/GTMNSAnimation+Duration.h"
#import "third_party/google_toolbox_for_mac/src/AppKit/GTMNSBezierPath+RoundRect.h"
#import "third_party/google_toolbox_for_mac/src/AppKit/GTMNSColor+Luminance.h"
+#include "ui/base/cocoa/cocoa_base_utils.h"
#include "ui/base/cocoa/window_size_constants.h"
#include "ui/gfx/font_list.h"
#include "ui/gfx/geometry/point.h"
@@ -363,7 +364,8 @@ void StatusBubbleMac::SetFrameAvoidingMouse(
// To start, assume default positioning in the lower left corner.
// The window_frame position is in global (screen) coordinates.
- window_frame.origin = [parent_ convertBaseToScreen:base_rect.origin];
+ window_frame.origin =
+ ui::ConvertPointFromWindowToScreen(parent_, base_rect.origin);
// Get the cursor position relative to the top right corner of the bubble.
gfx::Point relative_pos(mouse_pos.x() - NSMaxX(window_frame),
@@ -811,7 +813,7 @@ NSRect StatusBubbleMac::CalculateWindowFrame(bool expanded_width) {
NSRect screenRect;
if ([delegate_ respondsToSelector:@selector(statusBubbleBaseFrame)]) {
screenRect = [delegate_ statusBubbleBaseFrame];
- screenRect.origin = [parent_ convertBaseToScreen:screenRect.origin];
+ screenRect = [parent_ convertRectToScreen:screenRect];
} else {
screenRect = [parent_ frame];
}
diff --git a/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm b/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm
index c5a6261..69eabbc 100644
--- a/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm
+++ b/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm
@@ -62,6 +62,7 @@
#include "skia/ext/skia_utils_mac.h"
#import "third_party/google_toolbox_for_mac/src/AppKit/GTMNSAnimation+Duration.h"
#include "ui/base/cocoa/animation_utils.h"
+#include "ui/base/cocoa/cocoa_base_utils.h"
#import "ui/base/cocoa/tracking_area.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/material_design/material_design_controller.h"
@@ -270,7 +271,8 @@ private:
- (void)trackClickForWindowMove:(NSEvent*)event {
NSWindow* window = [self window];
NSPoint frameOrigin = [window frame].origin;
- NSPoint lastEventLoc = [window convertBaseToScreen:[event locationInWindow]];
+ NSPoint lastEventLoc =
+ ui::ConvertPointFromWindowToScreen(window, [event locationInWindow]);
while ((event = [NSApp nextEventMatchingMask:
NSLeftMouseDownMask|NSLeftMouseDraggedMask|NSLeftMouseUpMask
untilDate:[NSDate distantFuture]
@@ -279,7 +281,8 @@ private:
[event type] != NSLeftMouseUp) {
base::mac::ScopedNSAutoreleasePool pool;
- NSPoint now = [window convertBaseToScreen:[event locationInWindow]];
+ NSPoint now =
+ ui::ConvertPointFromWindowToScreen(window, [event locationInWindow]);
frameOrigin.x += now.x - lastEventLoc.x;
frameOrigin.y += now.y - lastEventLoc.y;
[window setFrameOrigin:frameOrigin];
diff --git a/chrome/browser/ui/cocoa/tabs/tab_strip_drag_controller.mm b/chrome/browser/ui/cocoa/tabs/tab_strip_drag_controller.mm
index eb8de39..dd32269 100644
--- a/chrome/browser/ui/cocoa/tabs/tab_strip_drag_controller.mm
+++ b/chrome/browser/ui/cocoa/tabs/tab_strip_drag_controller.mm
@@ -14,6 +14,7 @@
#import "chrome/browser/ui/cocoa/tabs/tab_strip_view.h"
#import "chrome/browser/ui/cocoa/tabs/tab_view.h"
#import "chrome/browser/ui/cocoa/tabs/tab_window_controller.h"
+#include "ui/base/cocoa/cocoa_base_utils.h"
#include "ui/gfx/mac/scoped_cocoa_disable_screen_updates.h"
const CGFloat kTearDistance = 36.0;
@@ -23,7 +24,8 @@ const NSTimeInterval kTearDuration = 0.333;
static BOOL PointIsInsideView(NSPoint screenPoint, NSView* view) {
if ([view window] == nil)
return NO;
- NSPoint windowPoint = [[view window] convertScreenToBase:screenPoint];
+ NSPoint windowPoint =
+ ui::ConvertPointFromScreenToWindow([view window], screenPoint);
NSPoint viewPoint = [view convertPoint:windowPoint fromView:nil];
return [view mouse:viewPoint inRect:[view bounds]];
}
@@ -383,9 +385,8 @@ static BOOL PointIsInsideView(NSPoint screenPoint, NSView* view) {
for (NSView* tabView in [draggedController_ tabViews]) {
tabFrame = NSUnionRect(tabFrame, [tabView frame]);
}
- tabFrame.origin = [dragWindow_ convertBaseToScreen:tabFrame.origin];
- tabFrame.origin = [[targetController_ window]
- convertScreenToBase:tabFrame.origin];
+ tabFrame = [dragWindow_ convertRectToScreen:tabFrame];
+ tabFrame = [[targetController_ window] convertRectFromScreen:tabFrame];
tabFrame = [[targetController_ tabStripView]
convertRect:tabFrame fromView:nil];
[targetController_ insertPlaceholderForTab:[draggedTab_ tabView]
diff --git a/chrome/browser/ui/cocoa/translate/translate_bubble_controller.mm b/chrome/browser/ui/cocoa/translate/translate_bubble_controller.mm
index 975b0b3..ada04dd 100644
--- a/chrome/browser/ui/cocoa/translate/translate_bubble_controller.mm
+++ b/chrome/browser/ui/cocoa/translate/translate_bubble_controller.mm
@@ -21,6 +21,7 @@
#include "components/translate/core/browser/translate_ui_delegate.h"
#include "content/public/browser/browser_context.h"
#include "grit/components_strings.h"
+#include "ui/base/cocoa/cocoa_base_utils.h"
#import "ui/base/cocoa/controls/hyperlink_button_cell.h"
#import "ui/base/cocoa/window_size_constants.h"
#include "ui/base/l10n/l10n_util.h"
@@ -166,7 +167,8 @@ const CGFloat kContentWidth = kWindowWidth - 2 * kFramePadding;
- (void)showWindow:(id)sender {
BrowserWindowController* controller = [[self parentWindow] windowController];
NSPoint anchorPoint = [[controller toolbarController] translateBubblePoint];
- anchorPoint = [[self parentWindow] convertBaseToScreen:anchorPoint];
+ anchorPoint =
+ ui::ConvertPointFromWindowToScreen([self parentWindow], anchorPoint);
[self setAnchorPoint:anchorPoint];
[super showWindow:sender];
}
diff --git a/chrome/browser/ui/cocoa/validation_message_bubble_cocoa.mm b/chrome/browser/ui/cocoa/validation_message_bubble_cocoa.mm
index 8c15b98..3d5b36b 100644
--- a/chrome/browser/ui/cocoa/validation_message_bubble_cocoa.mm
+++ b/chrome/browser/ui/cocoa/validation_message_bubble_cocoa.mm
@@ -18,6 +18,7 @@
#include "grit/theme_resources.h"
#import "third_party/google_toolbox_for_mac/src/AppKit/GTMUILocalizerAndLayoutTweaker.h"
#import "ui/base/cocoa/base_view.h"
+#include "ui/base/cocoa/cocoa_base_utils.h"
#import "ui/base/cocoa/flipped_view.h"
#include "ui/base/resource/resource_bundle.h"
@@ -148,7 +149,7 @@ NSPoint GetAnchorPoint(content::RenderWidgetHost* widget_host,
NSRect cocoaRect = [view flipRectToNSRect:anchor_in_root_view];
NSRect windowRect = [view convertRect:cocoaRect toView:nil];
NSPoint point = NSMakePoint(NSMidX(windowRect), NSMinY(windowRect));
- return [[view window] convertBaseToScreen:point];
+ return ui::ConvertPointFromWindowToScreen([view window], point);
}
ValidationMessageBubbleCocoa::ValidationMessageBubbleCocoa(
diff --git a/chrome/browser/ui/cocoa/website_settings/chooser_bubble_ui_cocoa.mm b/chrome/browser/ui/cocoa/website_settings/chooser_bubble_ui_cocoa.mm
index bfae5ba..2c472ec 100644
--- a/chrome/browser/ui/cocoa/website_settings/chooser_bubble_ui_cocoa.mm
+++ b/chrome/browser/ui/cocoa/website_settings/chooser_bubble_ui_cocoa.mm
@@ -27,6 +27,7 @@
#include "chrome/grit/generated_resources.h"
#include "content/public/browser/native_web_keyboard_event.h"
#include "skia/ext/skia_utils_mac.h"
+#include "ui/base/cocoa/cocoa_base_utils.h"
#include "ui/base/cocoa/controls/hyperlink_text_view.h"
#include "ui/base/cocoa/window_size_constants.h"
#include "ui/base/l10n/l10n_util.h"
@@ -407,7 +408,8 @@ scoped_ptr<BubbleUi> ChooserBubbleController::BuildBubbleUi() {
anchor = NSMakePoint(NSMidX(contentFrame), NSMaxY(contentFrame));
}
- return [[self getExpectedParentWindow] convertBaseToScreen:anchor];
+ return ui::ConvertPointFromWindowToScreen([self getExpectedParentWindow],
+ anchor);
}
- (bool)hasLocationBar {
diff --git a/chrome/browser/ui/cocoa/website_settings/permission_bubble_controller.mm b/chrome/browser/ui/cocoa/website_settings/permission_bubble_controller.mm
index fb8f3dd..ae493f9 100644
--- a/chrome/browser/ui/cocoa/website_settings/permission_bubble_controller.mm
+++ b/chrome/browser/ui/cocoa/website_settings/permission_bubble_controller.mm
@@ -33,6 +33,7 @@
#include "content/public/browser/user_metrics.h"
#include "grit/components_strings.h"
#include "skia/ext/skia_utils_mac.h"
+#include "ui/base/cocoa/cocoa_base_utils.h"
#import "ui/base/cocoa/controls/hyperlink_text_view.h"
#import "ui/base/cocoa/menu_controller.h"
#include "ui/base/cocoa/window_size_constants.h"
@@ -454,7 +455,8 @@ class MenuDelegate : public ui::SimpleMenuModel::Delegate {
anchor = NSMakePoint(NSMidX(contentFrame), NSMaxY(contentFrame));
}
- return [[self getExpectedParentWindow] convertBaseToScreen:anchor];
+ return ui::ConvertPointFromWindowToScreen([self getExpectedParentWindow],
+ anchor);
}
- (bool)hasLocationBar {
diff --git a/chrome/browser/ui/cocoa/website_settings/permission_bubble_controller_unittest.mm b/chrome/browser/ui/cocoa/website_settings/permission_bubble_controller_unittest.mm
index e3ceaff..75d6c50 100644
--- a/chrome/browser/ui/cocoa/website_settings/permission_bubble_controller_unittest.mm
+++ b/chrome/browser/ui/cocoa/website_settings/permission_bubble_controller_unittest.mm
@@ -25,6 +25,7 @@
#include "grit/components_strings.h"
#include "testing/gmock/include/gmock/gmock.h"
#import "testing/gtest_mac.h"
+#include "ui/base/cocoa/cocoa_base_utils.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/l10n/l10n_util_mac.h"
#import "ui/events/test/cocoa_test_event_utils.h"
@@ -363,7 +364,7 @@ TEST_F(PermissionBubbleControllerTest, AnchorPositionWithLocationBar) {
[BrowserWindowController browserWindowControllerForWindow:window];
LocationBarViewMac* location_bar_bridge = [controller locationBarBridge];
NSPoint expected = location_bar_bridge->GetPageInfoBubblePoint();
- expected = [window convertBaseToScreen:expected];
+ expected = ui::ConvertPointFromWindowToScreen(window, expected);
EXPECT_NSEQ(expected, anchor);
}
@@ -379,7 +380,7 @@ TEST_F(PermissionBubbleControllerTest, AnchorPositionWithoutLocationBar) {
NSWindow* window = browser()->window()->GetNativeWindow();
NSRect frame = [window frame];
NSPoint expected = NSMakePoint(frame.size.width / 2, frame.size.height);
- expected = [window convertBaseToScreen:expected];
+ expected = ui::ConvertPointFromWindowToScreen(window, expected);
EXPECT_NSEQ(expected, anchor);
}
diff --git a/chrome/browser/ui/cocoa/website_settings/website_settings_bubble_controller.mm b/chrome/browser/ui/cocoa/website_settings/website_settings_bubble_controller.mm
index 9934fcc..1a4dad1 100644
--- a/chrome/browser/ui/cocoa/website_settings/website_settings_bubble_controller.mm
+++ b/chrome/browser/ui/cocoa/website_settings/website_settings_bubble_controller.mm
@@ -41,6 +41,7 @@
#include "grit/components_google_chrome_strings.h"
#include "grit/components_strings.h"
#import "third_party/google_toolbox_for_mac/src/AppKit/GTMUILocalizerAndLayoutTweaker.h"
+#include "ui/base/cocoa/cocoa_base_utils.h"
#import "ui/base/cocoa/controls/hyperlink_button_cell.h"
#import "ui/base/cocoa/flipped_view.h"
#import "ui/base/cocoa/hover_image_button.h"
@@ -117,7 +118,7 @@ NSPoint AnchorPointForWindow(NSWindow* parent) {
LocationBarViewMac* location_bar = [controller locationBarBridge];
if (location_bar) {
NSPoint bubble_point = location_bar->GetPageInfoBubblePoint();
- origin = [parent convertBaseToScreen:bubble_point];
+ origin = ui::ConvertPointFromWindowToScreen(parent, bubble_point);
}
}
return origin;
diff --git a/chrome/test/base/interactive_test_utils_cocoa.mm b/chrome/test/base/interactive_test_utils_cocoa.mm
index 228c0a2..ee4e8c2 100644
--- a/chrome/test/base/interactive_test_utils_cocoa.mm
+++ b/chrome/test/base/interactive_test_utils_cocoa.mm
@@ -13,6 +13,7 @@
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_window.h"
#import "chrome/browser/ui/cocoa/view_id_util.h"
+#include "ui/base/cocoa/cocoa_base_utils.h"
namespace ui_test_utils {
@@ -32,7 +33,7 @@ void MoveMouseToNSViewCenterAndPress(
NSRect bounds = [view bounds];
NSPoint center = NSMakePoint(NSMidX(bounds), NSMidY(bounds));
center = [view convertPoint:center toView:nil];
- center = [window convertBaseToScreen:center];
+ center = ui::ConvertPointFromWindowToScreen(window, center);
center = NSMakePoint(center.x, [screen frame].size.height - center.y);
ui_controls::SendMouseMoveNotifyWhenDone(