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 3353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3364 TemplateURLService::TemplateURLVector template_urls = | 3364 TemplateURLService::TemplateURLVector template_urls = |
3365 url_model->GetTemplateURLs(); | 3365 url_model->GetTemplateURLs(); |
3366 for (TemplateURLService::TemplateURLVector::const_iterator it = | 3366 for (TemplateURLService::TemplateURLVector::const_iterator it = |
3367 template_urls.begin(); it != template_urls.end(); ++it) { | 3367 template_urls.begin(); it != template_urls.end(); ++it) { |
3368 DictionaryValue* search_engine = new DictionaryValue; | 3368 DictionaryValue* search_engine = new DictionaryValue; |
3369 search_engine->SetString("short_name", UTF16ToUTF8((*it)->short_name())); | 3369 search_engine->SetString("short_name", UTF16ToUTF8((*it)->short_name())); |
3370 search_engine->SetString("keyword", UTF16ToUTF8((*it)->keyword())); | 3370 search_engine->SetString("keyword", UTF16ToUTF8((*it)->keyword())); |
3371 search_engine->SetBoolean("in_default_list", (*it)->ShowInDefaultList()); | 3371 search_engine->SetBoolean("in_default_list", (*it)->ShowInDefaultList()); |
3372 search_engine->SetBoolean("is_default", | 3372 search_engine->SetBoolean("is_default", |
3373 (*it) == url_model->GetDefaultSearchProvider()); | 3373 (*it) == url_model->GetDefaultSearchProvider()); |
3374 search_engine->SetBoolean("is_valid", (*it)->url_ref().IsValid()); | 3374 search_engine->SetBoolean("is_valid", (*it)->url()->IsValid()); |
3375 search_engine->SetBoolean("supports_replacement", | 3375 search_engine->SetBoolean("supports_replacement", |
3376 (*it)->url_ref().SupportsReplacement()); | 3376 (*it)->url()->SupportsReplacement()); |
3377 search_engine->SetString("url", (*it)->url()); | 3377 search_engine->SetString("url", (*it)->url()->url()); |
3378 search_engine->SetString("host", (*it)->url_ref().GetHost()); | 3378 search_engine->SetString("host", (*it)->url()->GetHost()); |
3379 search_engine->SetString("path", (*it)->url_ref().GetPath()); | 3379 search_engine->SetString("path", (*it)->url()->GetPath()); |
3380 search_engine->SetString("display_url", | 3380 search_engine->SetString("display_url", |
3381 UTF16ToUTF8((*it)->url_ref().DisplayURL())); | 3381 UTF16ToUTF8((*it)->url()->DisplayURL())); |
3382 search_engines->Append(search_engine); | 3382 search_engines->Append(search_engine); |
3383 } | 3383 } |
3384 return_value->Set("search_engines", search_engines); | 3384 return_value->Set("search_engines", search_engines); |
3385 AutomationJSONReply(this, reply_message).SendSuccess(return_value.get()); | 3385 AutomationJSONReply(this, reply_message).SendSuccess(return_value.get()); |
3386 } | 3386 } |
3387 | 3387 |
3388 // Refer to pyauto.py for sample JSON input. | 3388 // Refer to pyauto.py for sample JSON input. |
3389 void TestingAutomationProvider::AddOrEditSearchEngine( | 3389 void TestingAutomationProvider::AddOrEditSearchEngine( |
3390 Browser* browser, | 3390 Browser* browser, |
3391 DictionaryValue* args, | 3391 DictionaryValue* args, |
(...skipping 3722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7114 | 7114 |
7115 Send(reply_message_); | 7115 Send(reply_message_); |
7116 redirect_query_ = 0; | 7116 redirect_query_ = 0; |
7117 reply_message_ = NULL; | 7117 reply_message_ = NULL; |
7118 } | 7118 } |
7119 | 7119 |
7120 void TestingAutomationProvider::OnRemoveProvider() { | 7120 void TestingAutomationProvider::OnRemoveProvider() { |
7121 if (g_browser_process) | 7121 if (g_browser_process) |
7122 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); | 7122 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); |
7123 } | 7123 } |
OLD | NEW |