| 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" |
| 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/account_chooser_view_controller.h" | 13 #import "chrome/browser/ui/cocoa/passwords/account_chooser_view_controller.h" |
| 14 #import "chrome/browser/ui/cocoa/passwords/auto_signin_view_controller.h" | 14 #import "chrome/browser/ui/cocoa/passwords/auto_signin_view_controller.h" |
| 15 #import "chrome/browser/ui/cocoa/passwords/confirmation_password_saved_view_cont
roller.h" | 15 #import "chrome/browser/ui/cocoa/passwords/confirmation_password_saved_view_cont
roller.h" |
| 16 #import "chrome/browser/ui/cocoa/passwords/manage_passwords_view_controller.h" | 16 #import "chrome/browser/ui/cocoa/passwords/manage_passwords_view_controller.h" |
| 17 #import "chrome/browser/ui/cocoa/passwords/save_pending_password_view_controller
.h" | 17 #import "chrome/browser/ui/cocoa/passwords/save_pending_password_view_controller
.h" |
| 18 #import "chrome/browser/ui/cocoa/passwords/update_pending_password_view_controll
er.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 27 matching lines...) Expand all Loading... |
| 55 [super close]; | 56 [super close]; |
| 56 } | 57 } |
| 57 | 58 |
| 58 - (void)updateState { | 59 - (void)updateState { |
| 59 // Find the next view controller. | 60 // Find the next view controller. |
| 60 currentController_.reset(); | 61 currentController_.reset(); |
| 61 if (model_->state() == password_manager::ui::PENDING_PASSWORD_STATE) { | 62 if (model_->state() == password_manager::ui::PENDING_PASSWORD_STATE) { |
| 62 currentController_.reset([[SavePendingPasswordViewController alloc] | 63 currentController_.reset([[SavePendingPasswordViewController alloc] |
| 63 initWithModel:model_ | 64 initWithModel:model_ |
| 64 delegate:self]); | 65 delegate:self]); |
| 66 } else if (model_->state() == |
| 67 password_manager::ui::PENDING_PASSWORD_UPDATE_STATE) { |
| 68 currentController_.reset([[UpdatePendingPasswordViewController alloc] |
| 69 initWithModel:model_ |
| 70 delegate:self]); |
| 65 } else if (model_->state() == password_manager::ui::CONFIRMATION_STATE) { | 71 } else if (model_->state() == password_manager::ui::CONFIRMATION_STATE) { |
| 66 currentController_.reset( | 72 currentController_.reset( |
| 67 [[ManagePasswordsBubbleConfirmationViewController alloc] | 73 [[ManagePasswordsBubbleConfirmationViewController alloc] |
| 68 initWithModel:model_ | 74 initWithModel:model_ |
| 69 delegate:self]); | 75 delegate:self]); |
| 70 } else if (model_->state() == password_manager::ui::MANAGE_STATE) { | 76 } else if (model_->state() == password_manager::ui::MANAGE_STATE) { |
| 71 currentController_.reset( | 77 currentController_.reset( |
| 72 [[ManagePasswordsBubbleManageViewController alloc] | 78 [[ManagePasswordsBubbleManageViewController alloc] |
| 73 initWithModel:model_ | 79 initWithModel:model_ |
| 74 delegate:self]); | 80 delegate:self]); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 | 157 |
| 152 @end | 158 @end |
| 153 | 159 |
| 154 @implementation ManagePasswordsBubbleController (Testing) | 160 @implementation ManagePasswordsBubbleController (Testing) |
| 155 | 161 |
| 156 - (NSViewController*)currentController { | 162 - (NSViewController*)currentController { |
| 157 return currentController_.get(); | 163 return currentController_.get(); |
| 158 } | 164 } |
| 159 | 165 |
| 160 @end | 166 @end |
| OLD | NEW |