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

Side by Side Diff: chrome/browser/ui/cocoa/passwords/passwords_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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/passwords/passwords_bubble_controller.h" 5 #import "chrome/browser/ui/cocoa/passwords/passwords_bubble_controller.h"
6 6
7 #include "base/mac/scoped_nsobject.h" 7 #include "base/mac/scoped_nsobject.h"
8 #include "chrome/browser/ui/browser_finder.h" 8 #include "chrome/browser/ui/browser_finder.h"
9 #import "chrome/browser/ui/cocoa/browser_window_controller.h" 9 #import "chrome/browser/ui/cocoa/browser_window_controller.h"
10 #import "chrome/browser/ui/cocoa/info_bubble_view.h" 10 #import "chrome/browser/ui/cocoa/info_bubble_view.h"
11 #import "chrome/browser/ui/cocoa/info_bubble_window.h" 11 #import "chrome/browser/ui/cocoa/info_bubble_window.h"
12 #include "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" 12 #include "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h"
13 #import "chrome/browser/ui/cocoa/passwords/auto_signin_view_controller.h" 13 #import "chrome/browser/ui/cocoa/passwords/auto_signin_view_controller.h"
14 #import "chrome/browser/ui/cocoa/passwords/confirmation_password_saved_view_cont roller.h" 14 #import "chrome/browser/ui/cocoa/passwords/confirmation_password_saved_view_cont roller.h"
15 #import "chrome/browser/ui/cocoa/passwords/manage_passwords_view_controller.h" 15 #import "chrome/browser/ui/cocoa/passwords/manage_passwords_view_controller.h"
16 #import "chrome/browser/ui/cocoa/passwords/save_pending_password_view_controller .h" 16 #import "chrome/browser/ui/cocoa/passwords/save_pending_password_view_controller .h"
17 #import "chrome/browser/ui/cocoa/passwords/update_pending_password_view_controll er.h" 17 #import "chrome/browser/ui/cocoa/passwords/update_pending_password_view_controll er.h"
18 #include "ui/base/cocoa/cocoa_base_utils.h"
18 #include "ui/base/cocoa/window_size_constants.h" 19 #include "ui/base/cocoa/window_size_constants.h"
19 20
20 @interface ManagePasswordsBubbleController () 21 @interface ManagePasswordsBubbleController ()
21 // Updates the content view controller according to the current state. 22 // Updates the content view controller according to the current state.
22 - (void)updateState; 23 - (void)updateState;
23 @end 24 @end
24 25
25 @implementation ManagePasswordsBubbleController 26 @implementation ManagePasswordsBubbleController
26 - (id)initWithParentWindow:(NSWindow*)parentWindow 27 - (id)initWithParentWindow:(NSWindow*)parentWindow
27 model:(ManagePasswordsBubbleModel*)model { 28 model:(ManagePasswordsBubbleModel*)model {
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 // Center the bubble if there's no location bar. 109 // Center the bubble if there's no location bar.
109 NSRect contentFrame = [[[self parentWindow] contentView] frame]; 110 NSRect contentFrame = [[[self parentWindow] contentView] frame];
110 anchorPoint = NSMakePoint(NSMidX(contentFrame), NSMaxY(contentFrame)); 111 anchorPoint = NSMakePoint(NSMidX(contentFrame), NSMaxY(contentFrame));
111 arrow = info_bubble::kNoArrow; 112 arrow = info_bubble::kNoArrow;
112 } 113 }
113 114
114 // Update the anchor arrow. 115 // Update the anchor arrow.
115 [[self bubble] setArrowLocation:arrow]; 116 [[self bubble] setArrowLocation:arrow];
116 117
117 // Update the anchor point. 118 // Update the anchor point.
118 anchorPoint = [[self parentWindow] convertBaseToScreen:anchorPoint]; 119 anchorPoint =
120 ui::ConvertPointFromWindowToScreen([self parentWindow], anchorPoint);
119 [self setAnchorPoint:anchorPoint]; 121 [self setAnchorPoint:anchorPoint];
120 122
121 // Update the frame. 123 // Update the frame.
122 CGFloat height = NSHeight([[currentController_ view] frame]); 124 CGFloat height = NSHeight([[currentController_ view] frame]);
123 CGFloat width = NSWidth([[currentController_ view] frame]); 125 CGFloat width = NSWidth([[currentController_ view] frame]);
124 CGFloat x = anchorPoint.x - width; 126 CGFloat x = anchorPoint.x - width;
125 CGFloat y = anchorPoint.y - height; 127 CGFloat y = anchorPoint.y - height;
126 128
127 // Make the frame large enough for the arrow. 129 // Make the frame large enough for the arrow.
128 if (hasLocationBar) { 130 if (hasLocationBar) {
(...skipping 19 matching lines...) Expand all
148 150
149 @end 151 @end
150 152
151 @implementation ManagePasswordsBubbleController (Testing) 153 @implementation ManagePasswordsBubbleController (Testing)
152 154
153 - (NSViewController*)currentController { 155 - (NSViewController*)currentController {
154 return currentController_.get(); 156 return currentController_.get();
155 } 157 }
156 158
157 @end 159 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698