| 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 ClearPreviewedForm(); |
| 22 } | 23 } |
| 23 | 24 |
| 24 AutofillExternalDelegate::AutofillExternalDelegate( | 25 AutofillExternalDelegate::AutofillExternalDelegate( |
| 25 TabContents* tab_contents, | 26 TabContents* tab_contents, |
| 26 AutofillManager* autofill_manager) | 27 AutofillManager* autofill_manager) |
| 27 : tab_contents_(tab_contents), | 28 : tab_contents_(tab_contents), |
| 28 autofill_manager_(autofill_manager), | 29 autofill_manager_(autofill_manager), |
| 29 password_autofill_manager_( | 30 password_autofill_manager_( |
| 30 tab_contents ? tab_contents->web_contents() : NULL), | 31 tab_contents ? tab_contents->web_contents() : NULL), |
| 31 autofill_query_id_(0), | 32 autofill_query_id_(0), |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 } else { | 205 } else { |
| 205 FillAutofillFormData(unique_id, false); | 206 FillAutofillFormData(unique_id, false); |
| 206 } | 207 } |
| 207 | 208 |
| 208 HideAutofillPopup(); | 209 HideAutofillPopup(); |
| 209 | 210 |
| 210 return true; | 211 return true; |
| 211 } | 212 } |
| 212 | 213 |
| 213 void AutofillExternalDelegate::ClearPreviewedForm() { | 214 void AutofillExternalDelegate::ClearPreviewedForm() { |
| 214 RenderViewHost* host = tab_contents_->web_contents()->GetRenderViewHost(); | 215 if (tab_contents_->web_contents()) { |
| 215 host->Send(new AutofillMsg_ClearPreviewedForm(host->GetRoutingID())); | 216 RenderViewHost* host = tab_contents_->web_contents()->GetRenderViewHost(); |
| 217 |
| 218 if (host) |
| 219 host->Send(new AutofillMsg_ClearPreviewedForm(host->GetRoutingID())); |
| 220 } |
| 216 } | 221 } |
| 217 | 222 |
| 218 void AutofillExternalDelegate::HideAutofillPopup() { | 223 void AutofillExternalDelegate::HideAutofillPopup() { |
| 219 popup_visible_ = false; | 224 popup_visible_ = false; |
| 220 | 225 |
| 221 HideAutofillPopupInternal(); | 226 HideAutofillPopupInternal(); |
| 222 } | 227 } |
| 223 | 228 |
| 224 void AutofillExternalDelegate::Reset() { | 229 void AutofillExternalDelegate::Reset() { |
| 225 HideAutofillPopup(); | 230 HideAutofillPopup(); |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 data_list_labels_.begin(), | 341 data_list_labels_.begin(), |
| 337 data_list_labels_.end()); | 342 data_list_labels_.end()); |
| 338 autofill_icons->insert(autofill_icons->begin(), | 343 autofill_icons->insert(autofill_icons->begin(), |
| 339 data_list_icons_.begin(), | 344 data_list_icons_.begin(), |
| 340 data_list_icons_.end()); | 345 data_list_icons_.end()); |
| 341 autofill_unique_ids->insert(autofill_unique_ids->begin(), | 346 autofill_unique_ids->insert(autofill_unique_ids->begin(), |
| 342 data_list_unique_ids_.begin(), | 347 data_list_unique_ids_.begin(), |
| 343 data_list_unique_ids_.end()); | 348 data_list_unique_ids_.end()); |
| 344 } | 349 } |
| 345 | 350 |
| 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 | 351 |
| 350 #if !defined(OS_ANDROID) && !defined(TOOLKIT_GTK) | 352 #if defined(OS_MACOSX) |
| 351 | 353 |
| 352 AutofillExternalDelegate* AutofillExternalDelegate::Create( | 354 AutofillExternalDelegate* AutofillExternalDelegate::Create( |
| 353 TabContents*, AutofillManager*) { | 355 TabContents*, AutofillManager*) { |
| 354 return NULL; | 356 return NULL; |
| 355 } | 357 } |
| 356 | 358 |
| 357 #endif | 359 #endif |
| OLD | NEW |