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 "chrome/browser/automation/automation_provider_observers.h" | 5 #include "chrome/browser/automation/automation_provider_observers.h" |
6 | 6 |
7 #include <deque> | 7 #include <deque> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 1541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1552 IPC::Message* reply_message) | 1552 IPC::Message* reply_message) |
1553 : provider_(provider->AsWeakPtr()), | 1553 : provider_(provider->AsWeakPtr()), |
1554 reply_message_(reply_message) { | 1554 reply_message_(reply_message) { |
1555 } | 1555 } |
1556 | 1556 |
1557 AutomationProviderGetPasswordsObserver:: | 1557 AutomationProviderGetPasswordsObserver:: |
1558 ~AutomationProviderGetPasswordsObserver() {} | 1558 ~AutomationProviderGetPasswordsObserver() {} |
1559 | 1559 |
1560 void AutomationProviderGetPasswordsObserver::OnPasswordStoreRequestDone( | 1560 void AutomationProviderGetPasswordsObserver::OnPasswordStoreRequestDone( |
1561 CancelableRequestProvider::Handle handle, | 1561 CancelableRequestProvider::Handle handle, |
1562 const std::vector<content::PasswordForm*>& result) { | 1562 const std::vector<autofill::PasswordForm*>& result) { |
1563 if (!provider_.get()) { | 1563 if (!provider_.get()) { |
1564 delete this; | 1564 delete this; |
1565 return; | 1565 return; |
1566 } | 1566 } |
1567 | 1567 |
1568 scoped_ptr<DictionaryValue> return_value(new DictionaryValue); | 1568 scoped_ptr<DictionaryValue> return_value(new DictionaryValue); |
1569 | 1569 |
1570 ListValue* passwords = new ListValue; | 1570 ListValue* passwords = new ListValue; |
1571 for (std::vector<content::PasswordForm*>::const_iterator it = | 1571 for (std::vector<autofill::PasswordForm*>::const_iterator it = |
1572 result.begin(); it != result.end(); ++it) { | 1572 result.begin(); it != result.end(); ++it) { |
1573 DictionaryValue* password_val = new DictionaryValue; | 1573 DictionaryValue* password_val = new DictionaryValue; |
1574 content::PasswordForm* password_form = *it; | 1574 autofill::PasswordForm* password_form = *it; |
1575 password_val->SetString("username_value", password_form->username_value); | 1575 password_val->SetString("username_value", password_form->username_value); |
1576 password_val->SetString("password_value", password_form->password_value); | 1576 password_val->SetString("password_value", password_form->password_value); |
1577 password_val->SetString("signon_realm", password_form->signon_realm); | 1577 password_val->SetString("signon_realm", password_form->signon_realm); |
1578 password_val->SetDouble( | 1578 password_val->SetDouble( |
1579 "time", static_cast<double>(password_form->date_created.ToDoubleT())); | 1579 "time", static_cast<double>(password_form->date_created.ToDoubleT())); |
1580 password_val->SetString("origin_url", password_form->origin.spec()); | 1580 password_val->SetString("origin_url", password_form->origin.spec()); |
1581 password_val->SetString("username_element", | 1581 password_val->SetString("username_element", |
1582 password_form->username_element); | 1582 password_form->username_element); |
1583 password_val->SetString("password_element", | 1583 password_val->SetString("password_element", |
1584 password_form->password_element); | 1584 password_form->password_element); |
1585 password_val->SetString("submit_element", password_form->submit_element); | 1585 password_val->SetString("submit_element", password_form->submit_element); |
1586 password_val->SetString("action_target", password_form->action.spec()); | 1586 password_val->SetString("action_target", password_form->action.spec()); |
1587 password_val->SetBoolean("blacklist", password_form->blacklisted_by_user); | 1587 password_val->SetBoolean("blacklist", password_form->blacklisted_by_user); |
1588 passwords->Append(password_val); | 1588 passwords->Append(password_val); |
1589 } | 1589 } |
1590 | 1590 |
1591 return_value->Set("passwords", passwords); | 1591 return_value->Set("passwords", passwords); |
1592 AutomationJSONReply(provider_.get(), reply_message_.release()) | 1592 AutomationJSONReply(provider_.get(), reply_message_.release()) |
1593 .SendSuccess(return_value.get()); | 1593 .SendSuccess(return_value.get()); |
1594 delete this; | 1594 delete this; |
1595 } | 1595 } |
1596 | 1596 |
1597 void AutomationProviderGetPasswordsObserver::OnGetPasswordStoreResults( | 1597 void AutomationProviderGetPasswordsObserver::OnGetPasswordStoreResults( |
1598 const std::vector<content::PasswordForm*>& results) { | 1598 const std::vector<autofill::PasswordForm*>& results) { |
1599 // TODO(kaiwang): Implement when I refactor | 1599 // TODO(kaiwang): Implement when I refactor |
1600 // PasswordManager::GetAutofillableLogins. | 1600 // PasswordManager::GetAutofillableLogins. |
1601 NOTIMPLEMENTED(); | 1601 NOTIMPLEMENTED(); |
1602 } | 1602 } |
1603 | 1603 |
1604 PasswordStoreLoginsChangedObserver::PasswordStoreLoginsChangedObserver( | 1604 PasswordStoreLoginsChangedObserver::PasswordStoreLoginsChangedObserver( |
1605 AutomationProvider* automation, | 1605 AutomationProvider* automation, |
1606 IPC::Message* reply_message, | 1606 IPC::Message* reply_message, |
1607 PasswordStoreChange::Type expected_type, | 1607 PasswordStoreChange::Type expected_type, |
1608 const std::string& result_key) | 1608 const std::string& result_key) |
(...skipping 1043 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2652 if (automation_.get()) { | 2652 if (automation_.get()) { |
2653 AutomationJSONReply(automation_.get(), reply_message_.release()) | 2653 AutomationJSONReply(automation_.get(), reply_message_.release()) |
2654 .SendSuccess(NULL); | 2654 .SendSuccess(NULL); |
2655 } | 2655 } |
2656 delete this; | 2656 delete this; |
2657 } | 2657 } |
2658 } else { | 2658 } else { |
2659 NOTREACHED(); | 2659 NOTREACHED(); |
2660 } | 2660 } |
2661 } | 2661 } |
OLD | NEW |