| 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/testing_automation_provider.h" | 5 #include "chrome/browser/automation/testing_automation_provider.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 3348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3359 TemplateURLService::TemplateURLVector template_urls = | 3359 TemplateURLService::TemplateURLVector template_urls = |
| 3360 url_model->GetTemplateURLs(); | 3360 url_model->GetTemplateURLs(); |
| 3361 for (TemplateURLService::TemplateURLVector::const_iterator it = | 3361 for (TemplateURLService::TemplateURLVector::const_iterator it = |
| 3362 template_urls.begin(); it != template_urls.end(); ++it) { | 3362 template_urls.begin(); it != template_urls.end(); ++it) { |
| 3363 DictionaryValue* search_engine = new DictionaryValue; | 3363 DictionaryValue* search_engine = new DictionaryValue; |
| 3364 search_engine->SetString("short_name", UTF16ToUTF8((*it)->short_name())); | 3364 search_engine->SetString("short_name", UTF16ToUTF8((*it)->short_name())); |
| 3365 search_engine->SetString("keyword", UTF16ToUTF8((*it)->keyword())); | 3365 search_engine->SetString("keyword", UTF16ToUTF8((*it)->keyword())); |
| 3366 search_engine->SetBoolean("in_default_list", (*it)->ShowInDefaultList()); | 3366 search_engine->SetBoolean("in_default_list", (*it)->ShowInDefaultList()); |
| 3367 search_engine->SetBoolean("is_default", | 3367 search_engine->SetBoolean("is_default", |
| 3368 (*it) == url_model->GetDefaultSearchProvider()); | 3368 (*it) == url_model->GetDefaultSearchProvider()); |
| 3369 search_engine->SetBoolean("is_valid", (*it)->url()->IsValid()); | 3369 search_engine->SetBoolean("is_valid", (*it)->url_ref().IsValid()); |
| 3370 search_engine->SetBoolean("supports_replacement", | 3370 search_engine->SetBoolean("supports_replacement", |
| 3371 (*it)->url()->SupportsReplacement()); | 3371 (*it)->url_ref().SupportsReplacement()); |
| 3372 search_engine->SetString("url", (*it)->url()->url()); | 3372 search_engine->SetString("url", (*it)->url()); |
| 3373 search_engine->SetString("host", (*it)->url()->GetHost()); | 3373 search_engine->SetString("host", (*it)->url_ref().GetHost()); |
| 3374 search_engine->SetString("path", (*it)->url()->GetPath()); | 3374 search_engine->SetString("path", (*it)->url_ref().GetPath()); |
| 3375 search_engine->SetString("display_url", | 3375 search_engine->SetString("display_url", |
| 3376 UTF16ToUTF8((*it)->url()->DisplayURL())); | 3376 UTF16ToUTF8((*it)->url_ref().DisplayURL())); |
| 3377 search_engines->Append(search_engine); | 3377 search_engines->Append(search_engine); |
| 3378 } | 3378 } |
| 3379 return_value->Set("search_engines", search_engines); | 3379 return_value->Set("search_engines", search_engines); |
| 3380 AutomationJSONReply(this, reply_message).SendSuccess(return_value.get()); | 3380 AutomationJSONReply(this, reply_message).SendSuccess(return_value.get()); |
| 3381 } | 3381 } |
| 3382 | 3382 |
| 3383 // Refer to pyauto.py for sample JSON input. | 3383 // Refer to pyauto.py for sample JSON input. |
| 3384 void TestingAutomationProvider::AddOrEditSearchEngine( | 3384 void TestingAutomationProvider::AddOrEditSearchEngine( |
| 3385 Browser* browser, | 3385 Browser* browser, |
| 3386 DictionaryValue* args, | 3386 DictionaryValue* args, |
| (...skipping 3703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7090 | 7090 |
| 7091 Send(reply_message_); | 7091 Send(reply_message_); |
| 7092 redirect_query_ = 0; | 7092 redirect_query_ = 0; |
| 7093 reply_message_ = NULL; | 7093 reply_message_ = NULL; |
| 7094 } | 7094 } |
| 7095 | 7095 |
| 7096 void TestingAutomationProvider::OnRemoveProvider() { | 7096 void TestingAutomationProvider::OnRemoveProvider() { |
| 7097 if (g_browser_process) | 7097 if (g_browser_process) |
| 7098 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); | 7098 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); |
| 7099 } | 7099 } |
| OLD | NEW |