Chromium Code Reviews| Index: chrome/browser/ui/cocoa/autofill/password_generation_popup_view_bridge.mm |
| diff --git a/chrome/browser/ui/cocoa/autofill/autofill_popup_view_bridge.mm b/chrome/browser/ui/cocoa/autofill/password_generation_popup_view_bridge.mm |
| similarity index 69% |
| copy from chrome/browser/ui/cocoa/autofill/autofill_popup_view_bridge.mm |
| copy to chrome/browser/ui/cocoa/autofill/password_generation_popup_view_bridge.mm |
| index d173e32b084ca2887c8a68aaff78eb52ba0a0c04..e5389b32da30939ab03fa458284b95733229e399 100644 |
| --- a/chrome/browser/ui/cocoa/autofill/autofill_popup_view_bridge.mm |
| +++ b/chrome/browser/ui/cocoa/autofill/password_generation_popup_view_bridge.mm |
| @@ -4,18 +4,18 @@ |
| #import <Cocoa/Cocoa.h> |
| -#include "chrome/browser/ui/cocoa/autofill/autofill_popup_view_bridge.h" |
| +#include "chrome/browser/ui/cocoa/autofill/password_generation_popup_view_bridge.h" |
| #include "base/logging.h" |
| #include "chrome/browser/ui/autofill/autofill_popup_controller.h" |
| -#import "chrome/browser/ui/cocoa/autofill/autofill_popup_view_cocoa.h" |
| +#import "chrome/browser/ui/cocoa/autofill/password_generation_popup_view_cocoa.h" |
| #include "ui/base/cocoa/window_size_constants.h" |
| #include "ui/gfx/rect.h" |
| namespace autofill { |
| -AutofillPopupViewBridge::AutofillPopupViewBridge( |
| - AutofillPopupController* controller) |
| +PasswordGenerationPopupViewBridge::PasswordGenerationPopupViewBridge( |
| + PasswordGenerationPopupController* controller) |
| : controller_(controller) { |
| window_ = |
| [[NSWindow alloc] initWithContentRect:ui::kWindowSizeDeterminedLater |
| @@ -25,13 +25,14 @@ AutofillPopupViewBridge::AutofillPopupViewBridge( |
| // Telling Cocoa that the window is opaque enables some drawing optimizations. |
| [window_ setOpaque:YES]; |
| - view_ = [[[AutofillPopupViewCocoa alloc] |
| + view_ = [[[PasswordGenerationPopupViewCocoa alloc] |
| initWithController:controller_ |
| frame:NSZeroRect] autorelease]; |
| + |
| [window_ setContentView:view_]; |
| } |
| -AutofillPopupViewBridge::~AutofillPopupViewBridge() { |
| +PasswordGenerationPopupViewBridge::~PasswordGenerationPopupViewBridge() { |
| [view_ controllerDestroyed]; |
| // Remove the child window before closing, otherwise it can mess up |
| @@ -41,23 +42,17 @@ AutofillPopupViewBridge::~AutofillPopupViewBridge() { |
| [window_ close]; |
| } |
| -void AutofillPopupViewBridge::Hide() { |
| +void PasswordGenerationPopupViewBridge::Hide() { |
| delete this; |
| } |
| -void AutofillPopupViewBridge::Show() { |
| +void PasswordGenerationPopupViewBridge::Show() { |
| UpdateBoundsAndRedrawPopup(); |
| [[controller_->container_view() window] addChildWindow:window_ |
| ordered:NSWindowAbove]; |
| } |
| -void AutofillPopupViewBridge::InvalidateRow(size_t row) { |
| - NSRect dirty_rect = |
| - NSRectFromCGRect(controller_->GetRowBounds(row).ToCGRect()); |
| - [view_ setNeedsDisplayInRect:dirty_rect]; |
| -} |
| - |
| -void AutofillPopupViewBridge::UpdateBoundsAndRedrawPopup() { |
| +void PasswordGenerationPopupViewBridge::UpdateBoundsAndRedrawPopup() { |
| NSRect frame = NSRectFromCGRect(controller_->popup_bounds().ToCGRect()); |
| // Flip coordinates back into Cocoa-land. The controller's platform-neutral |
| @@ -73,9 +68,14 @@ void AutofillPopupViewBridge::UpdateBoundsAndRedrawPopup() { |
| [view_ setNeedsDisplay:YES]; |
| } |
|
Ilya Sherman
2014/05/07 00:34:44
There's a whole bunch of duplicated code in this f
Patrick Dubroy
2014/05/07 16:48:36
I've taken a crack at it in the latest patchset. B
Ilya Sherman
2014/05/08 00:34:32
I'm fine with either composition or inheritance.
|
| -AutofillPopupView* AutofillPopupView::Create( |
| - AutofillPopupController* controller) { |
| - return new AutofillPopupViewBridge(controller); |
| +void PasswordGenerationPopupViewBridge::PasswordSelectionUpdated() { |
| + NOTREACHED() << "Not implemented"; |
| +} |
| + |
| + |
| +PasswordGenerationPopupView* PasswordGenerationPopupView::Create( |
| + PasswordGenerationPopupController* controller) { |
| + return new PasswordGenerationPopupViewBridge(controller); |
| } |
| } // namespace autofill |