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

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

Issue 2542173002: [Mac] Omnibox icons active states (Closed)
Patch Set: Created 4 years 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
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/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/location_bar/manage_passwords_decoration.h"
13 #import "chrome/browser/ui/cocoa/passwords/auto_signin_view_controller.h" 14 #import "chrome/browser/ui/cocoa/passwords/auto_signin_view_controller.h"
14 #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"
15 #import "chrome/browser/ui/cocoa/passwords/manage_passwords_view_controller.h" 16 #import "chrome/browser/ui/cocoa/passwords/manage_passwords_view_controller.h"
16 #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"
17 #import "chrome/browser/ui/cocoa/passwords/signin_promo_view_controller.h" 18 #import "chrome/browser/ui/cocoa/passwords/signin_promo_view_controller.h"
18 #import "chrome/browser/ui/cocoa/passwords/update_pending_password_view_controll er.h" 19 #import "chrome/browser/ui/cocoa/passwords/update_pending_password_view_controll er.h"
19 #include "ui/base/cocoa/cocoa_base_utils.h" 20 #include "ui/base/cocoa/cocoa_base_utils.h"
20 #include "ui/base/cocoa/window_size_constants.h" 21 #include "ui/base/cocoa/window_size_constants.h"
21 22
22 @interface ManagePasswordsBubbleController () 23 @interface ManagePasswordsBubbleController ()
(...skipping 28 matching lines...) Expand all
51 [self performLayout]; 52 [self performLayout];
52 [super showWindow:sender]; 53 [super showWindow:sender];
53 } 54 }
54 55
55 - (void)close { 56 - (void)close {
56 // The bubble is about to be closed. It destroys the model. 57 // The bubble is about to be closed. It destroys the model.
57 model_ = nil; 58 model_ = nil;
58 [super close]; 59 [super close];
59 } 60 }
60 61
62 - (LocationBarDecoration*)decorationForBubble {
63 BrowserWindowController* controller = [BrowserWindowController
64 browserWindowControllerForWindow:[self parentWindow]];
65 LocationBarViewMac* locationBar = [controller locationBarBridge];
66 return locationBar ? locationBar->manage_passwords_decoration() : nullptr;
67 }
68
61 - (void)updateState { 69 - (void)updateState {
62 // Find the next view controller. 70 // Find the next view controller.
63 [currentController_ setDelegate:nil]; 71 [currentController_ setDelegate:nil];
64 currentController_.reset(); 72 currentController_.reset();
65 if (model_->state() == password_manager::ui::PENDING_PASSWORD_STATE) { 73 if (model_->state() == password_manager::ui::PENDING_PASSWORD_STATE) {
66 currentController_.reset([[SavePendingPasswordViewController alloc] 74 currentController_.reset([[SavePendingPasswordViewController alloc]
67 initWithDelegate:self]); 75 initWithDelegate:self]);
68 } else if (model_->state() == 76 } else if (model_->state() ==
69 password_manager::ui::PENDING_PASSWORD_UPDATE_STATE) { 77 password_manager::ui::PENDING_PASSWORD_UPDATE_STATE) {
70 currentController_.reset([[UpdatePendingPasswordViewController alloc] 78 currentController_.reset([[UpdatePendingPasswordViewController alloc]
(...skipping 30 matching lines...) Expand all
101 109
102 NSPoint anchorPoint; 110 NSPoint anchorPoint;
103 info_bubble::BubbleArrowLocation arrow; 111 info_bubble::BubbleArrowLocation arrow;
104 Browser* browser = chrome::FindBrowserWithWindow([self parentWindow]); 112 Browser* browser = chrome::FindBrowserWithWindow([self parentWindow]);
105 bool hasLocationBar = 113 bool hasLocationBar =
106 browser && browser->SupportsWindowFeature(Browser::FEATURE_LOCATIONBAR); 114 browser && browser->SupportsWindowFeature(Browser::FEATURE_LOCATIONBAR);
107 115
108 if (hasLocationBar) { 116 if (hasLocationBar) {
109 BrowserWindowController* controller = [BrowserWindowController 117 BrowserWindowController* controller = [BrowserWindowController
110 browserWindowControllerForWindow:[self parentWindow]]; 118 browserWindowControllerForWindow:[self parentWindow]];
111 anchorPoint = 119 anchorPoint = [controller locationBarBridge]->GetBubblePointForDecoration(
112 [controller locationBarBridge]->GetManagePasswordsBubblePoint(); 120 [self decorationForBubble]);
113 arrow = info_bubble::kTopRight; 121 arrow = info_bubble::kTopRight;
114 } else { 122 } else {
115 // Center the bubble if there's no location bar. 123 // Center the bubble if there's no location bar.
116 NSRect contentFrame = [[[self parentWindow] contentView] frame]; 124 NSRect contentFrame = [[[self parentWindow] contentView] frame];
117 anchorPoint = NSMakePoint(NSMidX(contentFrame), NSMaxY(contentFrame)); 125 anchorPoint = NSMakePoint(NSMidX(contentFrame), NSMaxY(contentFrame));
118 arrow = info_bubble::kNoArrow; 126 arrow = info_bubble::kNoArrow;
119 } 127 }
120 128
121 // Update the anchor arrow. 129 // Update the anchor arrow.
122 [[self bubble] setArrowLocation:arrow]; 130 [[self bubble] setArrowLocation:arrow];
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 181
174 @end 182 @end
175 183
176 @implementation ManagePasswordsBubbleController (Testing) 184 @implementation ManagePasswordsBubbleController (Testing)
177 185
178 - (NSViewController*)currentController { 186 - (NSViewController*)currentController {
179 return currentController_.get(); 187 return currentController_.get();
180 } 188 }
181 189
182 @end 190 @end
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/passwords/passwords_bubble_controller.h ('k') | chrome/browser/ui/cocoa/toolbar/toolbar_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698