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 3343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3354 TemplateURLService::TemplateURLVector template_urls = | 3354 TemplateURLService::TemplateURLVector template_urls = |
3355 url_model->GetTemplateURLs(); | 3355 url_model->GetTemplateURLs(); |
3356 for (TemplateURLService::TemplateURLVector::const_iterator it = | 3356 for (TemplateURLService::TemplateURLVector::const_iterator it = |
3357 template_urls.begin(); it != template_urls.end(); ++it) { | 3357 template_urls.begin(); it != template_urls.end(); ++it) { |
3358 DictionaryValue* search_engine = new DictionaryValue; | 3358 DictionaryValue* search_engine = new DictionaryValue; |
3359 search_engine->SetString("short_name", UTF16ToUTF8((*it)->short_name())); | 3359 search_engine->SetString("short_name", UTF16ToUTF8((*it)->short_name())); |
3360 search_engine->SetString("keyword", UTF16ToUTF8((*it)->keyword())); | 3360 search_engine->SetString("keyword", UTF16ToUTF8((*it)->keyword())); |
3361 search_engine->SetBoolean("in_default_list", (*it)->ShowInDefaultList()); | 3361 search_engine->SetBoolean("in_default_list", (*it)->ShowInDefaultList()); |
3362 search_engine->SetBoolean("is_default", | 3362 search_engine->SetBoolean("is_default", |
3363 (*it) == url_model->GetDefaultSearchProvider()); | 3363 (*it) == url_model->GetDefaultSearchProvider()); |
3364 search_engine->SetBoolean("is_valid", (*it)->url()->IsValid()); | 3364 search_engine->SetBoolean("is_valid", (*it)->url_ref().IsValid()); |
3365 search_engine->SetBoolean("supports_replacement", | 3365 search_engine->SetBoolean("supports_replacement", |
3366 (*it)->url()->SupportsReplacement()); | 3366 (*it)->url_ref().SupportsReplacement()); |
3367 search_engine->SetString("url", (*it)->url()->url()); | 3367 search_engine->SetString("url", (*it)->url()); |
3368 search_engine->SetString("host", (*it)->url()->GetHost()); | 3368 search_engine->SetString("host", (*it)->url_ref().GetHost()); |
3369 search_engine->SetString("path", (*it)->url()->GetPath()); | 3369 search_engine->SetString("path", (*it)->url_ref().GetPath()); |
3370 search_engine->SetString("display_url", | 3370 search_engine->SetString("display_url", |
3371 UTF16ToUTF8((*it)->url()->DisplayURL())); | 3371 UTF16ToUTF8((*it)->url_ref().DisplayURL())); |
3372 search_engines->Append(search_engine); | 3372 search_engines->Append(search_engine); |
3373 } | 3373 } |
3374 return_value->Set("search_engines", search_engines); | 3374 return_value->Set("search_engines", search_engines); |
3375 AutomationJSONReply(this, reply_message).SendSuccess(return_value.get()); | 3375 AutomationJSONReply(this, reply_message).SendSuccess(return_value.get()); |
3376 } | 3376 } |
3377 | 3377 |
3378 // Refer to pyauto.py for sample JSON input. | 3378 // Refer to pyauto.py for sample JSON input. |
3379 void TestingAutomationProvider::AddOrEditSearchEngine( | 3379 void TestingAutomationProvider::AddOrEditSearchEngine( |
3380 Browser* browser, | 3380 Browser* browser, |
3381 DictionaryValue* args, | 3381 DictionaryValue* args, |
(...skipping 3701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7083 | 7083 |
7084 Send(reply_message_); | 7084 Send(reply_message_); |
7085 redirect_query_ = 0; | 7085 redirect_query_ = 0; |
7086 reply_message_ = NULL; | 7086 reply_message_ = NULL; |
7087 } | 7087 } |
7088 | 7088 |
7089 void TestingAutomationProvider::OnRemoveProvider() { | 7089 void TestingAutomationProvider::OnRemoveProvider() { |
7090 if (g_browser_process) | 7090 if (g_browser_process) |
7091 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); | 7091 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); |
7092 } | 7092 } |
OLD | NEW |