diff options
author | maruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-09 22:27:10 +0000 |
---|---|---|
committer | maruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-09 22:27:10 +0000 |
commit | 17c9bb62b181253607cc8608a502d412abce599f (patch) | |
tree | 39a700407bd3355d75f8a77538934bed207c1737 /chrome/browser | |
parent | 92aad5227a8e7b00f7fbc3e409037bf23cccda0c (diff) | |
download | chromium_src-17c9bb62b181253607cc8608a502d412abce599f.zip chromium_src-17c9bb62b181253607cc8608a502d412abce599f.tar.gz chromium_src-17c9bb62b181253607cc8608a502d412abce599f.tar.bz2 |
NO CODE CHANGE. Fix EOL in autofill_manager.cc.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9429 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/autofill_manager.cc | 220 |
1 files changed, 110 insertions, 110 deletions
diff --git a/chrome/browser/autofill_manager.cc b/chrome/browser/autofill_manager.cc index 0f11160..d1beb16 100644 --- a/chrome/browser/autofill_manager.cc +++ b/chrome/browser/autofill_manager.cc @@ -1,110 +1,110 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/autofill_manager.h"
-
-#include "base/string_util.h"
-#include "chrome/browser/profile.h"
-#include "chrome/browser/tab_contents/web_contents.h"
-#include "chrome/common/pref_names.h"
-
-AutofillManager::AutofillManager(WebContents* web_contents) :
- web_contents_(web_contents),
- pending_query_handle_(0),
- node_id_(0),
- request_id_(0) {
- form_autofill_enabled_.Init(prefs::kFormAutofillEnabled,
- profile()->GetPrefs(), NULL);
-}
-
-AutofillManager::~AutofillManager() {
- CancelPendingQuery();
-}
-
-void AutofillManager::CancelPendingQuery() {
- if (pending_query_handle_) {
- WebDataService* web_data_service =
- profile()->GetWebDataService(Profile::EXPLICIT_ACCESS);
- if (!web_data_service) {
- NOTREACHED();
- return;
- }
- web_data_service->CancelRequest(pending_query_handle_);
- }
- pending_query_handle_ = 0;
-}
-
-Profile* AutofillManager::profile() {
- return web_contents_->profile();
-}
-
-void AutofillManager::AutofillFormSubmitted(const AutofillForm& form) {
- StoreFormEntriesInWebDatabase(form);
-}
-
-void AutofillManager::FetchValuesForName(const std::wstring& name,
- const std::wstring& prefix,
- int limit,
- int64 node_id,
- int request_id) {
- if (!*form_autofill_enabled_)
- return;
-
- WebDataService* web_data_service =
- profile()->GetWebDataService(Profile::EXPLICIT_ACCESS);
- if (!web_data_service) {
- NOTREACHED();
- return;
- }
-
- CancelPendingQuery();
-
- node_id_ = node_id;
- request_id_ = request_id;
-
- pending_query_handle_ = web_data_service->
- GetFormValuesForElementName(name, prefix, limit, this);
-}
-
-void AutofillManager::OnWebDataServiceRequestDone(WebDataService::Handle h,
- const WDTypedResult* result) {
- DCHECK(pending_query_handle_);
- pending_query_handle_ = 0;
-
- if (!*form_autofill_enabled_)
- return;
-
- DCHECK(result);
- if (!result)
- return;
-
- switch (result->GetType()) {
- case AUTOFILL_VALUE_RESULT: {
- RenderViewHost* host = web_contents_->render_view_host();
- if (!host)
- return;
- const WDResult<std::vector<std::wstring> >* r =
- static_cast<const WDResult<std::vector<std::wstring> >*>(result);
- std::vector<std::wstring> suggestions = r->GetValue();
- host->AutofillSuggestionsReturned(suggestions, node_id_, request_id_, -1);
- break;
- }
-
- default:
- NOTREACHED();
- break;
- }
-}
-
-void AutofillManager::StoreFormEntriesInWebDatabase(
- const AutofillForm& form) {
- if (!*form_autofill_enabled_)
- return;
-
- if (profile()->IsOffTheRecord())
- return;
-
- profile()->GetWebDataService(Profile::EXPLICIT_ACCESS)->
- AddAutofillFormElements(form.elements);
-}
+// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/autofill_manager.h" + +#include "base/string_util.h" +#include "chrome/browser/profile.h" +#include "chrome/browser/tab_contents/web_contents.h" +#include "chrome/common/pref_names.h" + +AutofillManager::AutofillManager(WebContents* web_contents) : + web_contents_(web_contents), + pending_query_handle_(0), + node_id_(0), + request_id_(0) { + form_autofill_enabled_.Init(prefs::kFormAutofillEnabled, + profile()->GetPrefs(), NULL); +} + +AutofillManager::~AutofillManager() { + CancelPendingQuery(); +} + +void AutofillManager::CancelPendingQuery() { + if (pending_query_handle_) { + WebDataService* web_data_service = + profile()->GetWebDataService(Profile::EXPLICIT_ACCESS); + if (!web_data_service) { + NOTREACHED(); + return; + } + web_data_service->CancelRequest(pending_query_handle_); + } + pending_query_handle_ = 0; +} + +Profile* AutofillManager::profile() { + return web_contents_->profile(); +} + +void AutofillManager::AutofillFormSubmitted(const AutofillForm& form) { + StoreFormEntriesInWebDatabase(form); +} + +void AutofillManager::FetchValuesForName(const std::wstring& name, + const std::wstring& prefix, + int limit, + int64 node_id, + int request_id) { + if (!*form_autofill_enabled_) + return; + + WebDataService* web_data_service = + profile()->GetWebDataService(Profile::EXPLICIT_ACCESS); + if (!web_data_service) { + NOTREACHED(); + return; + } + + CancelPendingQuery(); + + node_id_ = node_id; + request_id_ = request_id; + + pending_query_handle_ = web_data_service-> + GetFormValuesForElementName(name, prefix, limit, this); +} + +void AutofillManager::OnWebDataServiceRequestDone(WebDataService::Handle h, + const WDTypedResult* result) { + DCHECK(pending_query_handle_); + pending_query_handle_ = 0; + + if (!*form_autofill_enabled_) + return; + + DCHECK(result); + if (!result) + return; + + switch (result->GetType()) { + case AUTOFILL_VALUE_RESULT: { + RenderViewHost* host = web_contents_->render_view_host(); + if (!host) + return; + const WDResult<std::vector<std::wstring> >* r = + static_cast<const WDResult<std::vector<std::wstring> >*>(result); + std::vector<std::wstring> suggestions = r->GetValue(); + host->AutofillSuggestionsReturned(suggestions, node_id_, request_id_, -1); + break; + } + + default: + NOTREACHED(); + break; + } +} + +void AutofillManager::StoreFormEntriesInWebDatabase( + const AutofillForm& form) { + if (!*form_autofill_enabled_) + return; + + if (profile()->IsOffTheRecord()) + return; + + profile()->GetWebDataService(Profile::EXPLICIT_ACCESS)-> + AddAutofillFormElements(form.elements); +} |