diff options
author | Kristian Monsen <kristianm@google.com> | 2011-06-03 11:31:54 +0100 |
---|---|---|
committer | Kristian Monsen <kristianm@google.com> | 2011-06-14 20:39:24 -0700 |
commit | e673c43ad7cf68f9dfcc0e8b797a5c1b38e2fa63 (patch) | |
tree | 094feeec6ce53e1030080497e222b5db7d5720fd /chrome | |
parent | 3f388049fd942346ffbeed1dd8f4214d36f8f856 (diff) | |
download | external_chromium-e673c43ad7cf68f9dfcc0e8b797a5c1b38e2fa63.zip external_chromium-e673c43ad7cf68f9dfcc0e8b797a5c1b38e2fa63.tar.gz external_chromium-e673c43ad7cf68f9dfcc0e8b797a5c1b38e2fa63.tar.bz2 |
Merge Chromium at r11.0.672.0: Compile fix in autofill_manager.*
Major refactoring upstream created some problems:
http://codereview.chromium.org/5958021
Created wrapper functions so private functions can be
called from our webkit. Also needed one of the functions
to return a bool like they used to.
Change-Id: Ia6df2c264f9dc48cfbfb7f33732783ed2a329758
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/autofill/autofill_manager.cc | 41 | ||||
-rw-r--r-- | chrome/browser/autofill/autofill_manager.h | 29 |
2 files changed, 68 insertions, 2 deletions
diff --git a/chrome/browser/autofill/autofill_manager.cc b/chrome/browser/autofill/autofill_manager.cc index d2a1d62..4340aeb 100644 --- a/chrome/browser/autofill/autofill_manager.cc +++ b/chrome/browser/autofill/autofill_manager.cc @@ -30,8 +30,8 @@ #include "chrome/browser/tab_contents/tab_contents.h" #ifndef ANDROID #include "chrome/browser/ui/browser_list.h" -#endif #include "chrome/common/autofill_messages.h" +#endif #include "chrome/common/chrome_switches.h" #include "chrome/common/guid.h" #include "chrome/common/notification_details.h" @@ -258,12 +258,15 @@ void AutoFillManager::RegisterUserPrefs(PrefService* prefs) { kAutoFillNegativeUploadRateDefaultValue); } +#ifndef ANDROID void AutoFillManager::DidNavigateMainFramePostCommit( const NavigationController::LoadCommittedDetails& details, const ViewHostMsg_FrameNavigate_Params& params) { Reset(); } +#endif +#ifndef ANDROID bool AutoFillManager::OnMessageReceived(const IPC::Message& message) { bool handled = true; IPC_BEGIN_MESSAGE_MAP(AutoFillManager, message) @@ -284,10 +287,13 @@ bool AutoFillManager::OnMessageReceived(const IPC::Message& message) { return handled; } +#endif void AutoFillManager::OnFormSubmitted(const FormData& form) { // Let AutoComplete know as well. +#ifndef ANDROID tab_contents_->autocomplete_history_manager()->OnFormSubmitted(form); +#endif if (!IsAutoFillEnabled()) return; @@ -324,7 +330,11 @@ void AutoFillManager::OnFormsSeen(const std::vector<FormData>& forms) { ParseForms(forms); } +#ifdef ANDROID +bool AutoFillManager::OnQueryFormFieldAutoFill( +#else void AutoFillManager::OnQueryFormFieldAutoFill( +#endif int query_id, const webkit_glue::FormData& form, const webkit_glue::FormField& field) { @@ -355,12 +365,12 @@ void AutoFillManager::OnQueryFormFieldAutoFill( form_structure, field, type, &values, &labels, &icons, &unique_ids); } -#ifndef ANDROID DCHECK_EQ(values.size(), labels.size()); DCHECK_EQ(values.size(), icons.size()); DCHECK_EQ(values.size(), unique_ids.size()); if (!values.empty()) { +#ifndef ANDROID // Don't provide AutoFill suggestions when AutoFill is disabled, and don't // provide credit card suggestions for non-HTTPS pages. However, provide a // warning to the user in these cases. @@ -392,13 +402,28 @@ void AutoFillManager::OnQueryFormFieldAutoFill( } #endif } +#ifdef ANDROID + else { + return false; + } +#endif + } +#ifdef ANDROID + else { + return false; } +#endif +#ifdef ANDROID + host->AutoFillSuggestionsReturned(values, labels, icons, unique_ids); + return true; +#else // Add the results from AutoComplete. They come back asynchronously, so we // hand off what we generated and they will send the results back to the // renderer. tab_contents_->autocomplete_history_manager()->OnGetAutocompleteSuggestions( query_id, field.name(), field.value(), values, labels, icons, unique_ids); +#endif } void AutoFillManager::OnFillAutoFillFormData(int query_id, @@ -482,8 +507,12 @@ void AutoFillManager::OnFillAutoFillFormData(int query_id, } } +#ifdef ANDROID + host->AutoFillFormDataFilled(query_id, result); +#else host->Send(new AutoFillMsg_FormDataFilled(host->routing_id(), query_id, result)); +#endif return; } @@ -525,11 +554,16 @@ void AutoFillManager::OnFillAutoFillFormData(int query_id, } autofilled_forms_signatures_.push_front(form_structure->FormSignature()); +#ifdef ANDROID + host->AutoFillFormDataFilled(query_id, result); +#else host->Send(new AutoFillMsg_FormDataFilled( host->routing_id(), query_id, result)); +#endif } void AutoFillManager::OnShowAutoFillDialog() { +#ifndef ANDROID if (!CommandLine::ForCurrentProcess()->HasSwitch( switches::kDisableTabbedOptions)) { Browser* browser = BrowserList::GetLastActive(); @@ -541,6 +575,7 @@ void AutoFillManager::OnShowAutoFillDialog() { ShowAutoFillDialog(tab_contents_->GetContentNativeView(), personal_data_, tab_contents_->profile()->GetOriginalProfile()); +#endif } void AutoFillManager::OnDidFillAutoFillFormData() { @@ -553,10 +588,12 @@ void AutoFillManager::OnDidFillAutoFillFormData() { } void AutoFillManager::OnDidShowAutoFillSuggestions() { +#ifndef ANDROID NotificationService::current()->Notify( NotificationType::AUTOFILL_DID_SHOW_SUGGESTIONS, Source<RenderViewHost>(tab_contents_->render_view_host()), NotificationService::NoDetails()); +#endif } void AutoFillManager::OnLoadedAutoFillHeuristics( diff --git a/chrome/browser/autofill/autofill_manager.h b/chrome/browser/autofill/autofill_manager.h index 30cc6a5..d7dc87f 100644 --- a/chrome/browser/autofill/autofill_manager.h +++ b/chrome/browser/autofill/autofill_manager.h @@ -29,6 +29,8 @@ class CreditCard; class FormStructure; class PrefService; class RenderViewHost; +class TabContents; +class TabContentsObserver; #ifdef ANDROID class AutoFillHost; @@ -59,11 +61,13 @@ class AutoFillManager : // Returns the TabContents hosting this AutoFillManager. TabContents* tab_contents() const { return tab_contents_; } +#ifndef ANDROID // TabContentsObserver implementation. virtual void DidNavigateMainFramePostCommit( const NavigationController::LoadCommittedDetails& details, const ViewHostMsg_FrameNavigate_Params& params); virtual bool OnMessageReceived(const IPC::Message& message); +#endif // Called by the AutoFillCCInfoBarDelegate when the user interacts with the // infobar. @@ -89,6 +93,25 @@ class AutoFillManager : // Reset cache. void Reset(); +#ifdef ANDROID + void OnFormsSeenWrapper(const std::vector<webkit_glue::FormData>& forms) { + OnFormsSeen(forms); + } + + bool OnQueryFormFieldAutoFillWrapper(int query_id, + const webkit_glue::FormData& form, + const webkit_glue::FormField& field) { + return OnQueryFormFieldAutoFill(query_id, form, field); + } + + void OnFillAutoFillFormDataWrapper(int query_id, + const webkit_glue::FormData& form, + const webkit_glue::FormField& field, + int unique_id) { + OnFillAutoFillFormData(query_id, form, field, unique_id); + } +#endif + protected: // For tests. AutoFillManager(); @@ -119,9 +142,15 @@ class AutoFillManager : private: void OnFormSubmitted(const webkit_glue::FormData& form); void OnFormsSeen(const std::vector<webkit_glue::FormData>& forms); +#ifdef ANDROID + bool OnQueryFormFieldAutoFill(int query_id, + const webkit_glue::FormData& form, + const webkit_glue::FormField& field); +#else void OnQueryFormFieldAutoFill(int query_id, const webkit_glue::FormData& form, const webkit_glue::FormField& field); +#endif void OnFillAutoFillFormData(int query_id, const webkit_glue::FormData& form, const webkit_glue::FormField& field, |