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

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

Issue 2808823002: MacViews: Allows the toolkit-views Manage Passwords Dialog to be used (Closed)
Patch Set: MacViews: Allows the toolkit-views Manage Passwords Dialog to be used (rebase) Created 3 years, 8 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/credentials_selection_view.h" 5 #import "chrome/browser/ui/cocoa/passwords/credentials_selection_view_cocoa.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #import "chrome/browser/ui/cocoa/bubble_combobox.h" 9 #import "chrome/browser/ui/cocoa/bubble_combobox.h"
10 #include "chrome/browser/ui/cocoa/chrome_style.h" 10 #include "chrome/browser/ui/cocoa/chrome_style.h"
11 #import "chrome/browser/ui/cocoa/passwords/passwords_bubble_utils.h" 11 #import "chrome/browser/ui/cocoa/passwords/passwords_bubble_utils.h"
12 #include "chrome/browser/ui/passwords/manage_passwords_bubble_model.h" 12 #include "chrome/browser/ui/passwords/manage_passwords_bubble_model.h"
13 #include "ui/base/models/simple_combobox_model.h" 13 #include "ui/base/models/simple_combobox_model.h"
14 14
15 namespace { 15 namespace {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 } // namespace 54 } // namespace
55 55
56 @implementation CredentialsSelectionView 56 @implementation CredentialsSelectionView
57 57
58 - (id)initWithModel:(ManagePasswordsBubbleModel*)model { 58 - (id)initWithModel:(ManagePasswordsBubbleModel*)model {
59 if ((self = [super init])) { 59 if ((self = [super init])) {
60 model_ = model; 60 model_ = model;
61 61
62 // Create the pop up button with usernames and the password field. 62 // Create the pop up button with usernames and the password field.
63 usernamePopUpButton_.reset([CreateUsernamesPopUpButton( 63 usernamePopUpButton_.reset([CreateUsernamesPopUpButton(
64 model_->local_credentials(), 64 model_->local_credentials(), model_->pending_password().username_value)
65 model_->pending_password().username_value) retain]); 65 retain]);
66 passwordField_.reset( 66 passwordField_.reset(
67 [PasswordLabel(model_->pending_password().password_value) retain]); 67 [PasswordLabel(model_->pending_password().password_value) retain]);
68 68
69 // Calculate desired widths of username and password. 69 // Calculate desired widths of username and password.
70 CGFloat firstWidth = NSMaxX([usernamePopUpButton_ frame]); 70 CGFloat firstWidth = NSMaxX([usernamePopUpButton_ frame]);
71 CGFloat secondWidth = NSMaxX([passwordField_ frame]); 71 CGFloat secondWidth = NSMaxX([passwordField_ frame]);
72 std::pair<CGFloat, CGFloat> sizes = GetResizedColumns( 72 std::pair<CGFloat, CGFloat> sizes = GetResizedColumns(
73 kDesiredRowWidth, std::make_pair(firstWidth, secondWidth)); 73 kDesiredRowWidth, std::make_pair(firstWidth, secondWidth));
74 CGFloat curX = 0; 74 CGFloat curX = 0;
75 CGFloat curY = 0; 75 CGFloat curY = 0;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 return self; 108 return self;
109 } 109 }
110 110
111 - (const autofill::PasswordForm*)getSelectedCredentials { 111 - (const autofill::PasswordForm*)getSelectedCredentials {
112 int selected_index = [usernamePopUpButton_ indexOfSelectedItem]; 112 int selected_index = [usernamePopUpButton_ indexOfSelectedItem];
113 CHECK(selected_index >= 0); 113 CHECK(selected_index >= 0);
114 return &model_->local_credentials()[selected_index]; 114 return &model_->local_credentials()[selected_index];
115 } 115 }
116 116
117 @end 117 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698