| 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_handler_cocoa.h" | 5 #import "chrome/browser/ui/cocoa/login_handler_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/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| 11 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
| 12 #include "base/strings/sys_string_conversions.h" | 12 #include "base/strings/sys_string_conversions.h" |
| 13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
| 14 #include "chrome/browser/tab_contents/tab_util.h" | 14 #include "chrome/browser/tab_contents/tab_util.h" |
| 15 #include "chrome/browser/ui/browser_dialogs.h" | 15 #include "chrome/browser/ui/browser_dialogs.h" |
| 16 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_sh
eet.h" | 16 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_sh
eet.h" |
| 17 #include "chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.h" | 17 #include "chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.h" |
| 18 #include "chrome/browser/ui/login/login_handler.h" | 18 #include "chrome/browser/ui/login/login_handler.h" |
| 19 #include "components/password_manager/core/browser/login_model.h" | 19 #include "components/password_manager/core/browser/login_model.h" |
| 20 #include "components/password_manager/core/browser/password_manager.h" | 20 #include "components/password_manager/core/browser/password_manager.h" |
| 21 #include "content/public/browser/browser_thread.h" | 21 #include "content/public/browser/browser_thread.h" |
| 22 #include "content/public/browser/web_contents.h" | 22 #include "content/public/browser/web_contents.h" |
| 23 #include "net/url_request/url_request.h" | 23 #include "net/url_request/url_request.h" |
| 24 #include "third_party/google_toolbox_for_mac/src/AppKit/GTMUILocalizerAndLayoutT
weaker.h" | 24 #include "third_party/google_toolbox_for_mac/src/AppKit/GTMUILocalizerAndLayoutT
weaker.h" |
| 25 #include "ui/base/material_design/material_design_controller.h" |
| 25 | 26 |
| 26 using autofill::PasswordForm; | 27 using autofill::PasswordForm; |
| 27 using content::BrowserThread; | 28 using content::BrowserThread; |
| 28 using content::WebContents; | 29 using content::WebContents; |
| 29 | 30 |
| 30 // ---------------------------------------------------------------------------- | 31 // ---------------------------------------------------------------------------- |
| 31 // LoginHandlerMac | 32 // LoginHandlerMac |
| 32 | 33 |
| 33 // This class simply forwards the authentication from the LoginView (on | 34 // This class simply forwards the authentication from the LoginView (on |
| 34 // the UI thread) to the net::URLRequest (on the I/O thread). | 35 // the UI thread) to the net::URLRequest (on the I/O thread). |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 base::scoped_nsobject<LoginHandlerSheet> sheet_controller_; | 128 base::scoped_nsobject<LoginHandlerSheet> sheet_controller_; |
| 128 | 129 |
| 129 std::unique_ptr<ConstrainedWindowMac> constrained_window_; | 130 std::unique_ptr<ConstrainedWindowMac> constrained_window_; |
| 130 | 131 |
| 131 DISALLOW_COPY_AND_ASSIGN(LoginHandlerMac); | 132 DISALLOW_COPY_AND_ASSIGN(LoginHandlerMac); |
| 132 }; | 133 }; |
| 133 | 134 |
| 134 // static | 135 // static |
| 135 LoginHandler* LoginHandler::Create(net::AuthChallengeInfo* auth_info, | 136 LoginHandler* LoginHandler::Create(net::AuthChallengeInfo* auth_info, |
| 136 net::URLRequest* request) { | 137 net::URLRequest* request) { |
| 137 if (chrome::ToolkitViewsWebUIDialogsEnabled()) | 138 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) |
| 138 return chrome::CreateLoginHandlerViews(auth_info, request); | 139 return chrome::CreateLoginHandlerViews(auth_info, request); |
| 139 return new LoginHandlerMac(auth_info, request); | 140 return new LoginHandlerMac(auth_info, request); |
| 140 } | 141 } |
| 141 | 142 |
| 142 // ---------------------------------------------------------------------------- | 143 // ---------------------------------------------------------------------------- |
| 143 // LoginHandlerSheet | 144 // LoginHandlerSheet |
| 144 | 145 |
| 145 @implementation LoginHandlerSheet | 146 @implementation LoginHandlerSheet |
| 146 | 147 |
| 147 - (id)initWithLoginHandler:(LoginHandlerMac*)handler { | 148 - (id)initWithLoginHandler:(LoginHandlerMac*)handler { |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 // Resize the text field. | 202 // Resize the text field. |
| 202 CGFloat windowDelta = [GTMUILocalizerAndLayoutTweaker | 203 CGFloat windowDelta = [GTMUILocalizerAndLayoutTweaker |
| 203 sizeToFitFixedWidthTextField:explanationField_]; | 204 sizeToFitFixedWidthTextField:explanationField_]; |
| 204 | 205 |
| 205 NSRect newFrame = [[self window] frame]; | 206 NSRect newFrame = [[self window] frame]; |
| 206 newFrame.size.height += windowDelta; | 207 newFrame.size.height += windowDelta; |
| 207 [[self window] setFrame:newFrame display:NO]; | 208 [[self window] setFrame:newFrame display:NO]; |
| 208 } | 209 } |
| 209 | 210 |
| 210 @end | 211 @end |
| OLD | NEW |