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

Side by Side Diff: chrome/browser/ui/cocoa/autofill/autofill_popup_view_bridge.mm

Issue 11817051: Elide text in the new Autofill UI (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: fixing compile errors Created 7 years, 11 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 <Cocoa/Cocoa.h> 5 #import <Cocoa/Cocoa.h>
6 6
7 #include "chrome/browser/ui/cocoa/autofill/autofill_popup_view_bridge.h" 7 #include "chrome/browser/ui/cocoa/autofill/autofill_popup_view_bridge.h"
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "chrome/browser/ui/autofill/autofill_popup_controller.h" 10 #include "chrome/browser/ui/autofill/autofill_popup_controller.h"
(...skipping 23 matching lines...) Expand all
34 controller_->ViewDestroyed(); 34 controller_->ViewDestroyed();
35 35
36 [window_ close]; 36 [window_ close];
37 } 37 }
38 38
39 void AutofillPopupViewBridge::Hide() { 39 void AutofillPopupViewBridge::Hide() {
40 delete this; 40 delete this;
41 } 41 }
42 42
43 void AutofillPopupViewBridge::Show() { 43 void AutofillPopupViewBridge::Show() {
44 SetInitialBounds();
45 UpdateBoundsAndRedrawPopup(); 44 UpdateBoundsAndRedrawPopup();
46 [[controller_->container_view() window] addChildWindow:window_ 45 [[controller_->container_view() window] addChildWindow:window_
47 ordered:NSWindowAbove]; 46 ordered:NSWindowAbove];
48 } 47 }
49 48
50 void AutofillPopupViewBridge::InvalidateRow(size_t row) { 49 void AutofillPopupViewBridge::InvalidateRow(size_t row) {
51 NSRect dirty_rect = 50 NSRect dirty_rect =
52 NSRectFromCGRect(controller_->GetRowBounds(row).ToCGRect()); 51 NSRectFromCGRect(controller_->GetRowBounds(row).ToCGRect());
53 [view_ setNeedsDisplayInRect:dirty_rect]; 52 [view_ setNeedsDisplayInRect:dirty_rect];
54 } 53 }
55 54
56 void AutofillPopupViewBridge::UpdateBoundsAndRedrawPopup() { 55 void AutofillPopupViewBridge::UpdateBoundsAndRedrawPopup() {
57 NSRect frame = NSRectFromCGRect(controller_->popup_bounds().ToCGRect()); 56 NSRect frame = NSRectFromCGRect(controller_->popup_bounds().ToCGRect());
58 57
59 // Flip coordinates back into Cocoa-land. 58 // Flip coordinates back into Cocoa-land.
60 // TODO(isherman): Does this agree with the controller's idea of handling 59 // TODO(isherman): Does this agree with the controller's idea of handling
61 // multi-monitor setups correctly? 60 // multi-monitor setups correctly?
62 NSScreen* screen = [[controller_->container_view() window] screen]; 61 NSScreen* screen = [[controller_->container_view() window] screen];
63 frame.origin.y = NSHeight([screen frame]) - NSMaxY(frame); 62 frame.origin.y = NSHeight([screen frame]) - NSMaxY(frame);
64 63
65 // TODO(isherman): The view should support scrolling if the popup gets too 64 // TODO(isherman): The view should support scrolling if the popup gets too
66 // big to fit on the screen. 65 // big to fit on the screen.
67 [window_ setFrame:frame display:YES]; 66 [window_ setFrame:frame display:YES];
68 } 67 }
69 68
70 void AutofillPopupViewBridge::SetInitialBounds() {
71 // The bounds rect in Chrome's screen coordinates. The popup should be
72 // positioned just below the element which initiated it.
73 gfx::Rect bounds(controller_->element_bounds().x(),
74 controller_->element_bounds().bottom(),
75 controller_->GetPopupRequiredWidth(),
76 controller_->GetPopupRequiredHeight());
77
78 // TODO(isherman): Position the popup correctly if it can't fit below the text
79 // field: http://crbug.com/164603
80
81 controller_->SetPopupBounds(bounds);
82 }
83
84 AutofillPopupView* AutofillPopupView::Create( 69 AutofillPopupView* AutofillPopupView::Create(
85 AutofillPopupController* controller) { 70 AutofillPopupController* controller) {
86 return new AutofillPopupViewBridge(controller); 71 return new AutofillPopupViewBridge(controller);
87 } 72 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698