| 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 #include "base/utf_string_conversions.h" | 5 #include "base/utf_string_conversions.h" |
| 6 #include "chrome/browser/autofill/autocomplete_history_manager.h" | 6 #include "chrome/browser/autofill/autocomplete_history_manager.h" |
| 7 #include "chrome/browser/autofill/autofill_external_delegate.h" | 7 #include "chrome/browser/autofill/autofill_external_delegate.h" |
| 8 #include "chrome/browser/autofill/autofill_manager.h" | 8 #include "chrome/browser/autofill/autofill_manager.h" |
| 9 #include "chrome/common/autofill_messages.h" | 9 #include "chrome/common/autofill_messages.h" |
| 10 #include "chrome/common/chrome_constants.h" | 10 #include "chrome/common/chrome_constants.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 "grit/chromium_strings.h" | 13 #include "grit/chromium_strings.h" |
| 14 #include "grit/generated_resources.h" | 14 #include "grit/generated_resources.h" |
| 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAutofillClient.h" | 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAutofillClient.h" |
| 16 #include "ui/base/l10n/l10n_util.h" | 16 #include "ui/base/l10n/l10n_util.h" |
| 17 | 17 |
| 18 using content::RenderViewHost; | 18 using content::RenderViewHost; |
| 19 using WebKit::WebAutofillClient; | 19 using WebKit::WebAutofillClient; |
| 20 | 20 |
| 21 AutofillExternalDelegate::~AutofillExternalDelegate() { | 21 AutofillExternalDelegate::~AutofillExternalDelegate() {} |
| 22 } | |
| 23 | 22 |
| 24 AutofillExternalDelegate::AutofillExternalDelegate( | 23 AutofillExternalDelegate::AutofillExternalDelegate( |
| 25 TabContents* tab_contents, | 24 TabContents* tab_contents, |
| 26 AutofillManager* autofill_manager) | 25 AutofillManager* autofill_manager) |
| 27 : tab_contents_(tab_contents), | 26 : tab_contents_(tab_contents), |
| 28 autofill_manager_(autofill_manager), | 27 autofill_manager_(autofill_manager), |
| 29 password_autofill_manager_( | 28 password_autofill_manager_( |
| 30 tab_contents ? tab_contents->web_contents() : NULL), | 29 tab_contents ? tab_contents->web_contents() : NULL), |
| 31 autofill_query_id_(0), | 30 autofill_query_id_(0), |
| 32 display_warning_if_disabled_(false), | 31 display_warning_if_disabled_(false), |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 } else { | 203 } else { |
| 205 FillAutofillFormData(unique_id, false); | 204 FillAutofillFormData(unique_id, false); |
| 206 } | 205 } |
| 207 | 206 |
| 208 HideAutofillPopup(); | 207 HideAutofillPopup(); |
| 209 | 208 |
| 210 return true; | 209 return true; |
| 211 } | 210 } |
| 212 | 211 |
| 213 void AutofillExternalDelegate::ClearPreviewedForm() { | 212 void AutofillExternalDelegate::ClearPreviewedForm() { |
| 214 RenderViewHost* host = tab_contents_->web_contents()->GetRenderViewHost(); | 213 if (tab_contents_ && tab_contents_->web_contents()) { |
| 215 host->Send(new AutofillMsg_ClearPreviewedForm(host->GetRoutingID())); | 214 RenderViewHost* host = tab_contents_->web_contents()->GetRenderViewHost(); |
| 215 |
| 216 if (host) |
| 217 host->Send(new AutofillMsg_ClearPreviewedForm(host->GetRoutingID())); |
| 218 } |
| 216 } | 219 } |
| 217 | 220 |
| 218 void AutofillExternalDelegate::HideAutofillPopup() { | 221 void AutofillExternalDelegate::HideAutofillPopup() { |
| 219 popup_visible_ = false; | 222 popup_visible_ = false; |
| 220 | 223 |
| 221 HideAutofillPopupInternal(); | 224 HideAutofillPopupInternal(); |
| 222 } | 225 } |
| 223 | 226 |
| 224 void AutofillExternalDelegate::Reset() { | 227 void AutofillExternalDelegate::Reset() { |
| 225 HideAutofillPopup(); | 228 HideAutofillPopup(); |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 data_list_labels_.begin(), | 339 data_list_labels_.begin(), |
| 337 data_list_labels_.end()); | 340 data_list_labels_.end()); |
| 338 autofill_icons->insert(autofill_icons->begin(), | 341 autofill_icons->insert(autofill_icons->begin(), |
| 339 data_list_icons_.begin(), | 342 data_list_icons_.begin(), |
| 340 data_list_icons_.end()); | 343 data_list_icons_.end()); |
| 341 autofill_unique_ids->insert(autofill_unique_ids->begin(), | 344 autofill_unique_ids->insert(autofill_unique_ids->begin(), |
| 342 data_list_unique_ids_.begin(), | 345 data_list_unique_ids_.begin(), |
| 343 data_list_unique_ids_.end()); | 346 data_list_unique_ids_.end()); |
| 344 } | 347 } |
| 345 | 348 |
| 346 // Add a "!defined(OS_YOUROS) for each platform that implements this | |
| 347 // in an autofill_external_delegate_YOUROS.cc. Currently there are | |
| 348 // none, so all platforms use the default. | |
| 349 | 349 |
| 350 #if !defined(OS_ANDROID) && !defined(TOOLKIT_GTK) | 350 #if defined(OS_MACOSX) |
| 351 | 351 |
| 352 AutofillExternalDelegate* AutofillExternalDelegate::Create( | 352 AutofillExternalDelegate* AutofillExternalDelegate::Create( |
| 353 TabContents*, AutofillManager*) { | 353 TabContents*, AutofillManager*) { |
| 354 return NULL; | 354 return NULL; |
| 355 } | 355 } |
| 356 | 356 |
| 357 #endif | 357 #endif |
| OLD | NEW |