OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/testing_automation_provider.h" | 5 #include "chrome/browser/automation/testing_automation_provider.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 2480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2491 if (!item->GetString("url", &url_text)) { | 2491 if (!item->GetString("url", &url_text)) { |
2492 reply.SendError("bad args (no URL in dict?)"); | 2492 reply.SendError("bad args (no URL in dict?)"); |
2493 return; | 2493 return; |
2494 } | 2494 } |
2495 GURL gurl(url_text); | 2495 GURL gurl(url_text); |
2496 item->GetString("title", &title); // Don't care if it fails. | 2496 item->GetString("title", &title); // Don't care if it fails. |
2497 int it; | 2497 int it; |
2498 double dt; | 2498 double dt; |
2499 if (item->GetInteger("time", &it)) | 2499 if (item->GetInteger("time", &it)) |
2500 time = base::Time::FromTimeT(it); | 2500 time = base::Time::FromTimeT(it); |
2501 else if (item->GetReal("time", &dt)) | 2501 else if (item->GetDouble("time", &dt)) |
2502 time = base::Time::FromDoubleT(dt); | 2502 time = base::Time::FromDoubleT(dt); |
2503 | 2503 |
2504 // Ideas for "dummy" values (e.g. id_scope) came from | 2504 // Ideas for "dummy" values (e.g. id_scope) came from |
2505 // chrome/browser/autocomplete/history_contents_provider_unittest.cc | 2505 // chrome/browser/autocomplete/history_contents_provider_unittest.cc |
2506 HistoryService* hs = profile_->GetHistoryService(Profile::EXPLICIT_ACCESS); | 2506 HistoryService* hs = profile_->GetHistoryService(Profile::EXPLICIT_ACCESS); |
2507 const void* id_scope = reinterpret_cast<void*>(1); | 2507 const void* id_scope = reinterpret_cast<void*>(1); |
2508 hs->AddPage(gurl, time, | 2508 hs->AddPage(gurl, time, |
2509 id_scope, | 2509 id_scope, |
2510 0, | 2510 0, |
2511 GURL(), | 2511 GURL(), |
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3146 // Translates a dictionary password to a PasswordForm struct. | 3146 // Translates a dictionary password to a PasswordForm struct. |
3147 webkit_glue::PasswordForm GetPasswordFormFromDict( | 3147 webkit_glue::PasswordForm GetPasswordFormFromDict( |
3148 const DictionaryValue& password_dict) { | 3148 const DictionaryValue& password_dict) { |
3149 | 3149 |
3150 // If the time is specified, change time to the specified time. | 3150 // If the time is specified, change time to the specified time. |
3151 base::Time time = base::Time::Now(); | 3151 base::Time time = base::Time::Now(); |
3152 int it; | 3152 int it; |
3153 double dt; | 3153 double dt; |
3154 if (password_dict.GetInteger("time", &it)) | 3154 if (password_dict.GetInteger("time", &it)) |
3155 time = base::Time::FromTimeT(it); | 3155 time = base::Time::FromTimeT(it); |
3156 else if (password_dict.GetReal("time", &dt)) | 3156 else if (password_dict.GetDouble("time", &dt)) |
3157 time = base::Time::FromDoubleT(dt); | 3157 time = base::Time::FromDoubleT(dt); |
3158 | 3158 |
3159 std::string signon_realm; | 3159 std::string signon_realm; |
3160 string16 username_value; | 3160 string16 username_value; |
3161 string16 password_value; | 3161 string16 password_value; |
3162 string16 origin_url_text; | 3162 string16 origin_url_text; |
3163 string16 username_element; | 3163 string16 username_element; |
3164 string16 password_element; | 3164 string16 password_element; |
3165 string16 submit_element; | 3165 string16 submit_element; |
3166 string16 action_target_text; | 3166 string16 action_target_text; |
(...skipping 1349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4516 // If you change this, update Observer for NotificationType::SESSION_END | 4516 // If you change this, update Observer for NotificationType::SESSION_END |
4517 // below. | 4517 // below. |
4518 MessageLoop::current()->PostTask(FROM_HERE, | 4518 MessageLoop::current()->PostTask(FROM_HERE, |
4519 NewRunnableMethod(this, &TestingAutomationProvider::OnRemoveProvider)); | 4519 NewRunnableMethod(this, &TestingAutomationProvider::OnRemoveProvider)); |
4520 } | 4520 } |
4521 } | 4521 } |
4522 | 4522 |
4523 void TestingAutomationProvider::OnRemoveProvider() { | 4523 void TestingAutomationProvider::OnRemoveProvider() { |
4524 AutomationProviderList::GetInstance()->RemoveProvider(this); | 4524 AutomationProviderList::GetInstance()->RemoveProvider(this); |
4525 } | 4525 } |
OLD | NEW |