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_controller_impl.h" | 5 #include "chrome/browser/ui/autofill/autofill_dialog_controller_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
60 #include "content/public/browser/notification_service.h" | 60 #include "content/public/browser/notification_service.h" |
61 #include "content/public/browser/notification_types.h" | 61 #include "content/public/browser/notification_types.h" |
62 #include "content/public/browser/web_contents.h" | 62 #include "content/public/browser/web_contents.h" |
63 #include "content/public/browser/web_contents_view.h" | 63 #include "content/public/browser/web_contents_view.h" |
64 #include "content/public/common/url_constants.h" | 64 #include "content/public/common/url_constants.h" |
65 #include "grit/chromium_strings.h" | 65 #include "grit/chromium_strings.h" |
66 #include "grit/component_strings.h" | 66 #include "grit/component_strings.h" |
67 #include "grit/generated_resources.h" | 67 #include "grit/generated_resources.h" |
68 #include "grit/theme_resources.h" | 68 #include "grit/theme_resources.h" |
69 #include "grit/webkit_resources.h" | 69 #include "grit/webkit_resources.h" |
70 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" | |
70 #include "net/cert/cert_status_flags.h" | 71 #include "net/cert/cert_status_flags.h" |
71 #include "ui/base/base_window.h" | 72 #include "ui/base/base_window.h" |
72 #include "ui/base/l10n/l10n_util.h" | 73 #include "ui/base/l10n/l10n_util.h" |
73 #include "ui/base/models/combobox_model.h" | 74 #include "ui/base/models/combobox_model.h" |
74 #include "ui/base/resource/resource_bundle.h" | 75 #include "ui/base/resource/resource_bundle.h" |
75 #include "ui/gfx/canvas.h" | 76 #include "ui/gfx/canvas.h" |
76 #include "ui/gfx/color_utils.h" | 77 #include "ui/gfx/color_utils.h" |
77 #include "ui/gfx/skbitmap_operations.h" | 78 #include "ui/gfx/skbitmap_operations.h" |
78 | 79 |
79 namespace autofill { | 80 namespace autofill { |
(...skipping 1929 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2009 should_show_wallet_promo_ = false; | 2010 should_show_wallet_promo_ = false; |
2010 account_chooser_model_.SelectActiveWalletAccount(); | 2011 account_chooser_model_.SelectActiveWalletAccount(); |
2011 signin_helper_.reset(new wallet::WalletSigninHelper( | 2012 signin_helper_.reset(new wallet::WalletSigninHelper( |
2012 this, profile_->GetRequestContext())); | 2013 this, profile_->GetRequestContext())); |
2013 signin_helper_->StartWalletCookieValueFetch(); | 2014 signin_helper_->StartWalletCookieValueFetch(); |
2014 HideSignIn(); | 2015 HideSignIn(); |
2015 } | 2016 } |
2016 } | 2017 } |
2017 | 2018 |
2018 //////////////////////////////////////////////////////////////////////////////// | 2019 //////////////////////////////////////////////////////////////////////////////// |
2020 // content::WebContentsObserver implementation. | |
Ilya Sherman
2013/07/12 23:58:28
nit: Please leave a blank line after this one.
Mike Wittman
2013/07/13 00:16:34
Done.
| |
2021 void AutofillDialogControllerImpl::DidNavigateMainFrame( | |
2022 const content::LoadCommittedDetails& details, | |
2023 const content::FrameNavigateParams& params) { | |
2024 // Close view if necessary. | |
2025 if (!net::registry_controlled_domains::SameDomainOrHost( | |
2026 details.previous_url, details.entry->GetURL(), | |
2027 net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES)) | |
Ilya Sherman
2013/07/12 23:58:28
nit: Please use curly braces, since the if-stmt co
Mike Wittman
2013/07/13 00:16:34
Done.
| |
2028 Hide(); | |
2029 } | |
2030 | |
2031 //////////////////////////////////////////////////////////////////////////////// | |
2019 // SuggestionsMenuModelDelegate implementation. | 2032 // SuggestionsMenuModelDelegate implementation. |
2020 | 2033 |
2021 void AutofillDialogControllerImpl::SuggestionItemSelected( | 2034 void AutofillDialogControllerImpl::SuggestionItemSelected( |
2022 SuggestionsMenuModel* model, | 2035 SuggestionsMenuModel* model, |
2023 size_t index) { | 2036 size_t index) { |
2024 if (model->GetItemKeyAt(index) == kManageItemsKey) { | 2037 if (model->GetItemKeyAt(index) == kManageItemsKey) { |
2025 GURL url; | 2038 GURL url; |
2026 if (!IsPayingWithWallet()) { | 2039 if (!IsPayingWithWallet()) { |
2027 GURL settings_url(chrome::kChromeUISettingsURL); | 2040 GURL settings_url(chrome::kChromeUISettingsURL); |
2028 url = settings_url.Resolve(chrome::kAutofillSubPage); | 2041 url = settings_url.Resolve(chrome::kAutofillSubPage); |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2278 return source_url_.SchemeIs(chrome::kHttpsScheme); | 2291 return source_url_.SchemeIs(chrome::kHttpsScheme); |
2279 } | 2292 } |
2280 | 2293 |
2281 AutofillDialogControllerImpl::AutofillDialogControllerImpl( | 2294 AutofillDialogControllerImpl::AutofillDialogControllerImpl( |
2282 content::WebContents* contents, | 2295 content::WebContents* contents, |
2283 const FormData& form_structure, | 2296 const FormData& form_structure, |
2284 const GURL& source_url, | 2297 const GURL& source_url, |
2285 const DialogType dialog_type, | 2298 const DialogType dialog_type, |
2286 const base::Callback<void(const FormStructure*, | 2299 const base::Callback<void(const FormStructure*, |
2287 const std::string&)>& callback) | 2300 const std::string&)>& callback) |
2288 : profile_(Profile::FromBrowserContext(contents->GetBrowserContext())), | 2301 : WebContentsObserver(contents), |
2302 profile_(Profile::FromBrowserContext(contents->GetBrowserContext())), | |
2289 contents_(contents), | 2303 contents_(contents), |
2290 initial_user_state_(AutofillMetrics::DIALOG_USER_STATE_UNKNOWN), | 2304 initial_user_state_(AutofillMetrics::DIALOG_USER_STATE_UNKNOWN), |
2291 dialog_type_(dialog_type), | 2305 dialog_type_(dialog_type), |
2292 form_structure_(form_structure, std::string()), | 2306 form_structure_(form_structure, std::string()), |
2293 invoked_from_same_origin_(true), | 2307 invoked_from_same_origin_(true), |
2294 source_url_(source_url), | 2308 source_url_(source_url), |
2295 callback_(callback), | 2309 callback_(callback), |
2296 account_chooser_model_(this, profile_->GetPrefs(), metric_logger_, | 2310 account_chooser_model_(this, profile_->GetPrefs(), metric_logger_, |
2297 dialog_type), | 2311 dialog_type), |
2298 wallet_client_(profile_->GetRequestContext(), this), | 2312 wallet_client_(profile_->GetRequestContext(), this), |
(...skipping 1109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3408 AutofillMetrics::DIALOG_USER_SIGNED_IN_NO_WALLET_NO_AUTOFILL; | 3422 AutofillMetrics::DIALOG_USER_SIGNED_IN_NO_WALLET_NO_AUTOFILL; |
3409 } | 3423 } |
3410 | 3424 |
3411 // Has Wallet items. | 3425 // Has Wallet items. |
3412 return has_autofill_profiles ? | 3426 return has_autofill_profiles ? |
3413 AutofillMetrics::DIALOG_USER_SIGNED_IN_HAS_WALLET_HAS_AUTOFILL : | 3427 AutofillMetrics::DIALOG_USER_SIGNED_IN_HAS_WALLET_HAS_AUTOFILL : |
3414 AutofillMetrics::DIALOG_USER_SIGNED_IN_HAS_WALLET_NO_AUTOFILL; | 3428 AutofillMetrics::DIALOG_USER_SIGNED_IN_HAS_WALLET_NO_AUTOFILL; |
3415 } | 3429 } |
3416 | 3430 |
3417 } // namespace autofill | 3431 } // namespace autofill |
OLD | NEW |