Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "chrome/browser/ui/autofill/autofill_dialog_sign_in_delegate.h" | 5 #include "chrome/browser/ui/autofill/autofill_dialog_sign_in_delegate.h" |
| 6 | 6 |
| 7 #include "chrome/browser/ui/autofill/autofill_dialog_view.h" | 7 #include "chrome/browser/ui/autofill/autofill_dialog_view.h" |
| 8 #include "chrome/browser/ui/browser_finder.h" | 8 #include "chrome/browser/ui/browser_finder.h" |
| 9 #include "chrome/browser/ui/browser_tabstrip.h" | 9 #include "chrome/browser/ui/browser_tabstrip.h" |
| 10 #include "components/autofill/content/browser/wallet/wallet_service_url.h" | 10 #include "components/autofill/content/browser/wallet/wallet_service_url.h" |
| 11 #include "content/public/browser/render_view_host.h" | 11 #include "content/public/browser/render_view_host.h" |
| 12 #include "content/public/browser/web_contents.h" | 12 #include "content/public/browser/web_contents.h" |
| 13 #include "content/public/common/renderer_preferences.h" | 13 #include "content/public/common/renderer_preferences.h" |
| 14 #include "ui/base/window_open_disposition.h" | 14 #include "ui/base/window_open_disposition.h" |
| 15 | 15 |
| 16 namespace autofill { | 16 namespace autofill { |
| 17 | 17 |
| 18 namespace { | 18 namespace { |
| 19 | 19 |
| 20 using content::OpenURLParams; | 20 using content::OpenURLParams; |
| 21 | 21 |
| 22 // Signals if |params| require opening inside the current WebContents. | 22 // Signals if |params| require opening inside the current WebContents. |
| 23 bool IsInPageTransition(const OpenURLParams& params) { | 23 bool IsInPageTransition(const OpenURLParams& params) { |
| 24 return params.transition == content::PAGE_TRANSITION_LINK && | 24 return params.disposition == CURRENT_TAB; |
|
Evan Stade
2014/01/03 01:47:44
new change
| |
| 25 params.disposition == CURRENT_TAB; | |
| 26 } | 25 } |
| 27 | 26 |
| 28 // Indicates if the open action specified by |params| should happen in the | 27 // Indicates if the open action specified by |params| should happen in the |
| 29 // Autofill dialog (when true) or in the browser (when false). | 28 // Autofill dialog (when true) or in the browser (when false). |
| 30 bool ShouldOpenInBrowser(const OpenURLParams& params) { | 29 bool ShouldOpenInBrowser(const OpenURLParams& params) { |
| 31 return !IsInPageTransition(params) || !wallet::IsSignInRelatedUrl(params.url); | 30 return !IsInPageTransition(params) || !wallet::IsSignInRelatedUrl(params.url); |
| 32 } | 31 } |
| 33 | 32 |
| 34 // Adjusts |params| to account for the fact that the open request originated in | 33 // Adjusts |params| to account for the fact that the open request originated in |
| 35 // the dialog, but will be executed in the browser. | 34 // the dialog, but will be executed in the browser. |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 116 | 115 |
| 117 void AutofillDialogSignInDelegate::EnableAutoResize() { | 116 void AutofillDialogSignInDelegate::EnableAutoResize() { |
| 118 DCHECK(!minimum_size_.IsEmpty()); | 117 DCHECK(!minimum_size_.IsEmpty()); |
| 119 DCHECK(!maximum_size_.IsEmpty()); | 118 DCHECK(!maximum_size_.IsEmpty()); |
| 120 content::RenderViewHost* host = web_contents()->GetRenderViewHost(); | 119 content::RenderViewHost* host = web_contents()->GetRenderViewHost(); |
| 121 if (host) | 120 if (host) |
| 122 host->EnableAutoResize(minimum_size_, maximum_size_); | 121 host->EnableAutoResize(minimum_size_, maximum_size_); |
| 123 } | 122 } |
| 124 | 123 |
| 125 } // namespace autofill | 124 } // namespace autofill |
| OLD | NEW |