| 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 <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 #include "chrome/common/chrome_constants.h" | 96 #include "chrome/common/chrome_constants.h" |
| 97 #include "chrome/common/chrome_notification_types.h" | 97 #include "chrome/common/chrome_notification_types.h" |
| 98 #include "chrome/common/chrome_paths.h" | 98 #include "chrome/common/chrome_paths.h" |
| 99 #include "chrome/common/chrome_switches.h" | 99 #include "chrome/common/chrome_switches.h" |
| 100 #include "chrome/common/extensions/extension.h" | 100 #include "chrome/common/extensions/extension.h" |
| 101 #include "chrome/common/extensions/url_pattern.h" | 101 #include "chrome/common/extensions/url_pattern.h" |
| 102 #include "chrome/common/extensions/url_pattern_set.h" | 102 #include "chrome/common/extensions/url_pattern_set.h" |
| 103 #include "chrome/common/pref_names.h" | 103 #include "chrome/common/pref_names.h" |
| 104 #include "chrome/common/render_messages.h" | 104 #include "chrome/common/render_messages.h" |
| 105 #include "chrome/common/url_constants.h" | 105 #include "chrome/common/url_constants.h" |
| 106 #include "content/browser/plugin_service.h" |
| 106 #include "content/browser/renderer_host/render_process_host.h" | 107 #include "content/browser/renderer_host/render_process_host.h" |
| 107 #include "content/browser/renderer_host/render_view_host.h" | 108 #include "content/browser/renderer_host/render_view_host.h" |
| 108 #include "content/browser/tab_contents/interstitial_page.h" | 109 #include "content/browser/tab_contents/interstitial_page.h" |
| 109 #include "content/common/common_param_traits.h" | 110 #include "content/common/common_param_traits.h" |
| 110 #include "content/common/notification_service.h" | 111 #include "content/common/notification_service.h" |
| 111 #include "content/common/view_types.h" | 112 #include "content/common/view_types.h" |
| 112 #include "net/base/cookie_store.h" | 113 #include "net/base/cookie_store.h" |
| 113 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" | 114 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" |
| 114 #include "ui/base/events.h" | 115 #include "ui/base/events.h" |
| 115 #include "ui/base/keycodes/keyboard_codes.h" | 116 #include "ui/base/keycodes/keyboard_codes.h" |
| 116 #include "ui/base/message_box_flags.h" | 117 #include "ui/base/message_box_flags.h" |
| 117 #include "webkit/glue/webdropdata.h" | 118 #include "webkit/glue/webdropdata.h" |
| 118 #include "webkit/plugins/npapi/plugin_list.h" | 119 #include "webkit/plugins/webplugininfo.h" |
| 119 | 120 |
| 120 #if defined(OS_CHROMEOS) | 121 #if defined(OS_CHROMEOS) |
| 121 #include "chrome/browser/ui/webui/active_downloads_ui.h" | 122 #include "chrome/browser/ui/webui/active_downloads_ui.h" |
| 122 #else | 123 #else |
| 123 #include "chrome/browser/download/download_shelf.h" | 124 #include "chrome/browser/download/download_shelf.h" |
| 124 #endif | 125 #endif |
| 125 | 126 |
| 126 using automation_util::SendErrorIfModalDialogActive; | 127 using automation_util::SendErrorIfModalDialogActive; |
| 127 | 128 |
| 128 namespace { | 129 namespace { |
| (...skipping 3345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3474 reply_message, json_return, true); | 3475 reply_message, json_return, true); |
| 3475 Send(reply_message); | 3476 Send(reply_message); |
| 3476 } | 3477 } |
| 3477 | 3478 |
| 3478 // Sample json input: { "command": "GetPluginsInfo" } | 3479 // Sample json input: { "command": "GetPluginsInfo" } |
| 3479 // Refer chrome/test/pyautolib/plugins_info.py for sample json output. | 3480 // Refer chrome/test/pyautolib/plugins_info.py for sample json output. |
| 3480 void TestingAutomationProvider::GetPluginsInfo( | 3481 void TestingAutomationProvider::GetPluginsInfo( |
| 3481 Browser* browser, | 3482 Browser* browser, |
| 3482 DictionaryValue* args, | 3483 DictionaryValue* args, |
| 3483 IPC::Message* reply_message) { | 3484 IPC::Message* reply_message) { |
| 3484 if (!BrowserThread::CurrentlyOn(BrowserThread::FILE)) { | 3485 PluginService::GetInstance()->GetPlugins( |
| 3485 BrowserThread::PostTask( | 3486 base::Bind(&TestingAutomationProvider::GetPluginsInfoCallback, |
| 3486 BrowserThread::FILE, FROM_HERE, | 3487 this, browser, args, reply_message)); |
| 3487 base::Bind(&TestingAutomationProvider::GetPluginsInfo, | 3488 } |
| 3488 this, browser, args, reply_message)); | 3489 |
| 3489 return; | 3490 void TestingAutomationProvider::GetPluginsInfoCallback( |
| 3490 } | 3491 Browser* browser, |
| 3491 std::vector<webkit::WebPluginInfo> plugins; | 3492 DictionaryValue* args, |
| 3492 webkit::npapi::PluginList::Singleton()->GetPlugins(&plugins); | 3493 IPC::Message* reply_message, |
| 3494 const std::vector<webkit::WebPluginInfo>& plugins) { |
| 3493 PluginPrefs* plugin_prefs = PluginPrefs::GetForProfile(browser->profile()); | 3495 PluginPrefs* plugin_prefs = PluginPrefs::GetForProfile(browser->profile()); |
| 3494 ListValue* items = new ListValue; | 3496 ListValue* items = new ListValue; |
| 3495 for (std::vector<webkit::WebPluginInfo>::const_iterator it = | 3497 for (std::vector<webkit::WebPluginInfo>::const_iterator it = |
| 3496 plugins.begin(); | 3498 plugins.begin(); |
| 3497 it != plugins.end(); | 3499 it != plugins.end(); |
| 3498 ++it) { | 3500 ++it) { |
| 3499 DictionaryValue* item = new DictionaryValue; | 3501 DictionaryValue* item = new DictionaryValue; |
| 3500 item->SetString("name", it->name); | 3502 item->SetString("name", it->name); |
| 3501 item->SetString("path", it->path.value()); | 3503 item->SetString("path", it->path.value()); |
| 3502 item->SetString("version", it->version); | 3504 item->SetString("version", it->version); |
| (...skipping 2844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6347 | 6349 |
| 6348 Send(reply_message_); | 6350 Send(reply_message_); |
| 6349 redirect_query_ = 0; | 6351 redirect_query_ = 0; |
| 6350 reply_message_ = NULL; | 6352 reply_message_ = NULL; |
| 6351 } | 6353 } |
| 6352 | 6354 |
| 6353 void TestingAutomationProvider::OnRemoveProvider() { | 6355 void TestingAutomationProvider::OnRemoveProvider() { |
| 6354 if (g_browser_process) | 6356 if (g_browser_process) |
| 6355 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); | 6357 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); |
| 6356 } | 6358 } |
| OLD | NEW |