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

Side by Side Diff: chrome/browser/ui/cocoa/passwords/manage_passwords_bubble_controller.mm

Issue 446073002: Add ManagePasswordsBubbleBlacklistViewController and unit tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: finalize Created 6 years, 3 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 | Annotate | Revision Log
OLDNEW
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 #import "chrome/browser/ui/cocoa/passwords/manage_passwords_bubble_manage_view_c ontroller.h" 11 #import "chrome/browser/ui/cocoa/passwords/manage_passwords_bubble_manage_view_c ontroller.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/manage_passwords_bubble_blacklist_vie w_controller.h"
13 #import "chrome/browser/ui/cocoa/passwords/manage_passwords_bubble_confirmation_ view_controller.h" 14 #import "chrome/browser/ui/cocoa/passwords/manage_passwords_bubble_confirmation_ view_controller.h"
14 #include "ui/base/cocoa/window_size_constants.h" 15 #include "ui/base/cocoa/window_size_constants.h"
15 16
16 @interface ManagePasswordsBubbleController () 17 @interface ManagePasswordsBubbleController ()
17 // Updates the content view controller according to the current state. 18 // Updates the content view controller according to the current state.
18 - (void)updateState; 19 - (void)updateState;
19 @end 20 @end
20 21
21 @implementation ManagePasswordsBubbleController 22 @implementation ManagePasswordsBubbleController
22 - (id)initWithParentWindow:(NSWindow*)parentWindow 23 - (id)initWithParentWindow:(NSWindow*)parentWindow
(...skipping 13 matching lines...) Expand all
36 return self; 37 return self;
37 } 38 }
38 39
39 - (void)showWindow:(id)sender { 40 - (void)showWindow:(id)sender {
40 [self performLayout]; 41 [self performLayout];
41 [super showWindow:sender]; 42 [super showWindow:sender];
42 } 43 }
43 44
44 - (void)updateState { 45 - (void)updateState {
45 // Find the next view controller. 46 // Find the next view controller.
46 // TODO(dconnelly): Handle other states once they're implemented.
47 currentController_.reset(); 47 currentController_.reset();
48 if (password_manager::ui::IsPendingState(model_->state())) { 48 if (password_manager::ui::IsPendingState(model_->state())) {
49 currentController_.reset( 49 currentController_.reset(
50 [[ManagePasswordsBubblePendingViewController alloc] 50 [[ManagePasswordsBubblePendingViewController alloc]
51 initWithModel:model_ 51 initWithModel:model_
52 delegate:self]); 52 delegate:self]);
53 } else if (model_->state() == password_manager::ui::CONFIRMATION_STATE) { 53 } else if (model_->state() == password_manager::ui::CONFIRMATION_STATE) {
54 currentController_.reset( 54 currentController_.reset(
55 [[ManagePasswordsBubbleConfirmationViewController alloc] 55 [[ManagePasswordsBubbleConfirmationViewController alloc]
56 initWithModel:model_ 56 initWithModel:model_
57 delegate:self]); 57 delegate:self]);
58 } else if (model_->state() == password_manager::ui::MANAGE_STATE) { 58 } else if (model_->state() == password_manager::ui::MANAGE_STATE) {
59 currentController_.reset([[ManagePasswordsBubbleManageViewController alloc] 59 currentController_.reset([[ManagePasswordsBubbleManageViewController alloc]
60 initWithModel:model_ 60 initWithModel:model_
61 delegate:self]); 61 delegate:self]);
62 } else if (model_->state() == password_manager::ui::BLACKLIST_STATE) {
63 currentController_.reset(
64 [[ManagePasswordsBubbleBlacklistViewController alloc]
65 initWithModel:model_
66 delegate:self]);
67 } else {
68 NOTREACHED();
62 } 69 }
63 [self performLayout]; 70 [self performLayout];
64 } 71 }
65 72
66 - (void)performLayout { 73 - (void)performLayout {
67 if (!currentController_) 74 if (!currentController_)
68 return; 75 return;
69 76
70 // Update the window. 77 // Update the window.
71 NSWindow* window = [self window]; 78 NSWindow* window = [self window];
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 122
116 @end 123 @end
117 124
118 @implementation ManagePasswordsBubbleController (Testing) 125 @implementation ManagePasswordsBubbleController (Testing)
119 126
120 - (NSViewController*)currentController { 127 - (NSViewController*)currentController {
121 return currentController_.get(); 128 return currentController_.get();
122 } 129 }
123 130
124 @end 131 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698