Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/login_prompt_cocoa.h" | 5 #import "chrome/browser/ui/cocoa/login_prompt_cocoa.h" |
| 6 | 6 |
| 7 #include "base/mac/bundle_locations.h" | 7 #include "base/mac/bundle_locations.h" |
| 8 #include "base/mac/scoped_nsobject.h" | 8 #include "base/mac/scoped_nsobject.h" |
| 9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| 11 #include "base/strings/sys_string_conversions.h" | 11 #include "base/strings/sys_string_conversions.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 13 #include "chrome/browser/tab_contents/tab_util.h" | 13 #include "chrome/browser/tab_contents/tab_util.h" |
| 14 #include "chrome/browser/ui/browser_dialogs.h" | |
| 14 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_sh eet.h" | 15 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_sh eet.h" |
| 15 #include "chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.h" | 16 #include "chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.h" |
| 16 #include "chrome/browser/ui/login/login_prompt.h" | 17 #include "chrome/browser/ui/login/login_prompt.h" |
| 17 #include "components/password_manager/core/browser/login_model.h" | 18 #include "components/password_manager/core/browser/login_model.h" |
| 18 #include "components/password_manager/core/browser/password_manager.h" | 19 #include "components/password_manager/core/browser/password_manager.h" |
| 19 #include "content/public/browser/browser_thread.h" | 20 #include "content/public/browser/browser_thread.h" |
| 20 #include "content/public/browser/web_contents.h" | 21 #include "content/public/browser/web_contents.h" |
| 21 #include "net/url_request/url_request.h" | 22 #include "net/url_request/url_request.h" |
| 22 #include "third_party/google_toolbox_for_mac/src/AppKit/GTMUILocalizerAndLayoutT weaker.h" | 23 #include "third_party/google_toolbox_for_mac/src/AppKit/GTMUILocalizerAndLayoutT weaker.h" |
| 23 | 24 |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 119 base::scoped_nsobject<LoginHandlerSheet> sheet_controller_; | 120 base::scoped_nsobject<LoginHandlerSheet> sheet_controller_; |
| 120 | 121 |
| 121 scoped_ptr<ConstrainedWindowMac> constrained_window_; | 122 scoped_ptr<ConstrainedWindowMac> constrained_window_; |
| 122 | 123 |
| 123 DISALLOW_COPY_AND_ASSIGN(LoginHandlerMac); | 124 DISALLOW_COPY_AND_ASSIGN(LoginHandlerMac); |
| 124 }; | 125 }; |
| 125 | 126 |
| 126 // static | 127 // static |
| 127 LoginHandler* LoginHandler::Create(net::AuthChallengeInfo* auth_info, | 128 LoginHandler* LoginHandler::Create(net::AuthChallengeInfo* auth_info, |
| 128 net::URLRequest* request) { | 129 net::URLRequest* request) { |
| 130 if (chrome::ToolkitViewsDialogsEnabled()) | |
| 131 return chrome::CreateLoginHandlerViews(auth_info, request); | |
|
msw
2015/08/07 02:23:33
It'd be simpler if this could just "return new Log
tapted
2015/08/07 03:40:17
Yeah exactly. - c/b/ui/cocoa inherits the views DE
| |
| 129 return new LoginHandlerMac(auth_info, request); | 132 return new LoginHandlerMac(auth_info, request); |
| 130 } | 133 } |
| 131 | 134 |
| 132 // ---------------------------------------------------------------------------- | 135 // ---------------------------------------------------------------------------- |
| 133 // LoginHandlerSheet | 136 // LoginHandlerSheet |
| 134 | 137 |
| 135 @implementation LoginHandlerSheet | 138 @implementation LoginHandlerSheet |
| 136 | 139 |
| 137 - (id)initWithLoginHandler:(LoginHandlerMac*)handler { | 140 - (id)initWithLoginHandler:(LoginHandlerMac*)handler { |
| 138 NSString* nibPath = | 141 NSString* nibPath = |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 180 // Resize the text field. | 183 // Resize the text field. |
| 181 CGFloat windowDelta = [GTMUILocalizerAndLayoutTweaker | 184 CGFloat windowDelta = [GTMUILocalizerAndLayoutTweaker |
| 182 sizeToFitFixedWidthTextField:explanationField_]; | 185 sizeToFitFixedWidthTextField:explanationField_]; |
| 183 | 186 |
| 184 NSRect newFrame = [[self window] frame]; | 187 NSRect newFrame = [[self window] frame]; |
| 185 newFrame.size.height += windowDelta; | 188 newFrame.size.height += windowDelta; |
| 186 [[self window] setFrame:newFrame display:NO]; | 189 [[self window] setFrame:newFrame display:NO]; |
| 187 } | 190 } |
| 188 | 191 |
| 189 @end | 192 @end |
| OLD | NEW |