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/manage_passwords_bubble_controller.h" | 5 #import "chrome/browser/ui/cocoa/passwords/manage_passwords_bubble_controller.h" |
6 | 6 |
7 #include "base/mac/scoped_nsobject.h" | 7 #include "base/mac/scoped_nsobject.h" |
8 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 8 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
9 #import "chrome/browser/ui/cocoa/info_bubble_view.h" | 9 #import "chrome/browser/ui/cocoa/info_bubble_view.h" |
10 #import "chrome/browser/ui/cocoa/info_bubble_window.h" | 10 #import "chrome/browser/ui/cocoa/info_bubble_window.h" |
11 #include "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" | 11 #include "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" |
| 12 #import "chrome/browser/ui/cocoa/passwords/manage_passwords_bubble_confirmation_
view_controller.h" |
12 #include "ui/base/cocoa/window_size_constants.h" | 13 #include "ui/base/cocoa/window_size_constants.h" |
13 | 14 |
14 @interface ManagePasswordsBubbleController () | 15 @interface ManagePasswordsBubbleController () |
15 // Updates the content view controller according to the current state. | 16 // Updates the content view controller according to the current state. |
16 - (void)updateState; | 17 - (void)updateState; |
17 @end | 18 @end |
18 | 19 |
19 @implementation ManagePasswordsBubbleController | 20 @implementation ManagePasswordsBubbleController |
20 - (id)initWithParentWindow:(NSWindow*)parentWindow | 21 - (id)initWithParentWindow:(NSWindow*)parentWindow |
21 model:(ManagePasswordsBubbleModel*)model { | 22 model:(ManagePasswordsBubbleModel*)model { |
(...skipping 19 matching lines...) Expand all Loading... |
41 | 42 |
42 - (void)updateState { | 43 - (void)updateState { |
43 // Find the next view controller. | 44 // Find the next view controller. |
44 // TODO(dconnelly): Handle other states once they're implemented. | 45 // TODO(dconnelly): Handle other states once they're implemented. |
45 currentController_.reset(); | 46 currentController_.reset(); |
46 if (password_manager::ui::IsPendingState(model_->state())) { | 47 if (password_manager::ui::IsPendingState(model_->state())) { |
47 currentController_.reset( | 48 currentController_.reset( |
48 [[ManagePasswordsBubblePendingViewController alloc] | 49 [[ManagePasswordsBubblePendingViewController alloc] |
49 initWithModel:model_ | 50 initWithModel:model_ |
50 delegate:self]); | 51 delegate:self]); |
| 52 } else if (model_->state() == password_manager::ui::CONFIRMATION_STATE) { |
| 53 currentController_.reset( |
| 54 [[ManagePasswordsBubbleConfirmationViewController alloc] |
| 55 initWithModel:model_ |
| 56 delegate:self]); |
51 } | 57 } |
52 [self performLayout]; | 58 [self performLayout]; |
53 } | 59 } |
54 | 60 |
55 - (void)performLayout { | 61 - (void)performLayout { |
56 if (!currentController_) | 62 if (!currentController_) |
57 return; | 63 return; |
58 | 64 |
59 // Update the window. | 65 // Update the window. |
60 NSWindow* window = [self window]; | 66 NSWindow* window = [self window]; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 | 102 |
97 @end | 103 @end |
98 | 104 |
99 @implementation ManagePasswordsBubbleController (Testing) | 105 @implementation ManagePasswordsBubbleController (Testing) |
100 | 106 |
101 - (NSViewController*)currentController { | 107 - (NSViewController*)currentController { |
102 return currentController_.get(); | 108 return currentController_.get(); |
103 } | 109 } |
104 | 110 |
105 @end | 111 @end |
OLD | NEW |