| OLD | NEW |
| 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" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 // Find the next view controller. | 61 // Find the next view controller. |
| 62 currentController_.reset(); | 62 currentController_.reset(); |
| 63 if (model_->state() == password_manager::ui::PENDING_PASSWORD_STATE) { | 63 if (model_->state() == password_manager::ui::PENDING_PASSWORD_STATE) { |
| 64 currentController_.reset([[SavePendingPasswordViewController alloc] | 64 currentController_.reset([[SavePendingPasswordViewController alloc] |
| 65 initWithDelegate:self]); | 65 initWithDelegate:self]); |
| 66 } else if (model_->state() == | 66 } else if (model_->state() == |
| 67 password_manager::ui::PENDING_PASSWORD_UPDATE_STATE) { | 67 password_manager::ui::PENDING_PASSWORD_UPDATE_STATE) { |
| 68 currentController_.reset([[UpdatePendingPasswordViewController alloc] | 68 currentController_.reset([[UpdatePendingPasswordViewController alloc] |
| 69 initWithDelegate:self]); | 69 initWithDelegate:self]); |
| 70 } else if (model_->state() == password_manager::ui::CONFIRMATION_STATE) { | 70 } else if (model_->state() == password_manager::ui::CONFIRMATION_STATE) { |
| 71 currentController_.reset( | 71 currentController_.reset([[ConfirmationPasswordSavedViewController alloc] |
| 72 [[ManagePasswordsBubbleConfirmationViewController alloc] | 72 initWithDelegate:self]); |
| 73 initWithModel:model_ | |
| 74 delegate:self]); | |
| 75 } else if (model_->state() == password_manager::ui::MANAGE_STATE) { | 73 } else if (model_->state() == password_manager::ui::MANAGE_STATE) { |
| 76 currentController_.reset( | 74 currentController_.reset( |
| 77 [[ManagePasswordsBubbleManageViewController alloc] | 75 [[ManagePasswordsViewController alloc] initWithDelegate:self]); |
| 78 initWithModel:model_ | |
| 79 delegate:self]); | |
| 80 } else if (model_->state() == password_manager::ui::AUTO_SIGNIN_STATE) { | 76 } else if (model_->state() == password_manager::ui::AUTO_SIGNIN_STATE) { |
| 81 currentController_.reset( | 77 currentController_.reset( |
| 82 [[ManagePasswordsBubbleAutoSigninViewController alloc] | 78 [[AutoSigninViewController alloc] initWithDelegate:self]); |
| 83 initWithModel:model_ | |
| 84 delegate:self]); | |
| 85 } else { | 79 } else { |
| 86 NOTREACHED(); | 80 NOTREACHED(); |
| 87 } | 81 } |
| 88 } | 82 } |
| 89 | 83 |
| 90 - (void)performLayout { | 84 - (void)performLayout { |
| 91 if (!currentController_) | 85 if (!currentController_) |
| 92 return; | 86 return; |
| 93 | 87 |
| 94 // Update the window. | 88 // Update the window. |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 height += info_bubble::kBubbleArrowHeight; | 129 height += info_bubble::kBubbleArrowHeight; |
| 136 x += info_bubble::kBubbleArrowXOffset + | 130 x += info_bubble::kBubbleArrowXOffset + |
| 137 (0.5 * info_bubble::kBubbleArrowWidth); | 131 (0.5 * info_bubble::kBubbleArrowWidth); |
| 138 } | 132 } |
| 139 | 133 |
| 140 [window setFrame:NSMakeRect(x, y, width, height) | 134 [window setFrame:NSMakeRect(x, y, width, height) |
| 141 display:YES | 135 display:YES |
| 142 animate:[window isVisible]]; | 136 animate:[window isVisible]]; |
| 143 } | 137 } |
| 144 | 138 |
| 145 #pragma mark ManagePasswordsBubbleContentViewDelegate | 139 #pragma mark BasePasswordsContentViewDelegate |
| 146 | 140 |
| 147 - (void)viewShouldDismiss { | 141 - (void)viewShouldDismiss { |
| 148 [self close]; | 142 [self close]; |
| 149 } | 143 } |
| 150 | 144 |
| 151 - (ManagePasswordsBubbleModel*)model { | 145 - (ManagePasswordsBubbleModel*)model { |
| 152 return model_; | 146 return model_; |
| 153 } | 147 } |
| 154 | 148 |
| 155 @end | 149 @end |
| 156 | 150 |
| 157 @implementation ManagePasswordsBubbleController (Testing) | 151 @implementation ManagePasswordsBubbleController (Testing) |
| 158 | 152 |
| 159 - (NSViewController*)currentController { | 153 - (NSViewController*)currentController { |
| 160 return currentController_.get(); | 154 return currentController_.get(); |
| 161 } | 155 } |
| 162 | 156 |
| 163 @end | 157 @end |
| OLD | NEW |