Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Side by Side Diff: chrome/browser/automation/testing_automation_provider.cc

Issue 7980011: Convert the PluginService interface to be an async wrapper around PluginList. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: New interface as discussed Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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()->LoadPluginList(false,
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,
3492 DictionaryValue* args,
3493 IPC::Message* reply_message) {
3491 std::vector<webkit::WebPluginInfo> plugins; 3494 std::vector<webkit::WebPluginInfo> plugins;
3492 webkit::npapi::PluginList::Singleton()->GetPlugins(&plugins); 3495 PluginService::GetInstance()->GetPlugins(&plugins);
3496
3493 PluginPrefs* plugin_prefs = PluginPrefs::GetForProfile(browser->profile()); 3497 PluginPrefs* plugin_prefs = PluginPrefs::GetForProfile(browser->profile());
3494 ListValue* items = new ListValue; 3498 ListValue* items = new ListValue;
3495 for (std::vector<webkit::WebPluginInfo>::const_iterator it = 3499 for (std::vector<webkit::WebPluginInfo>::iterator it = plugins.begin();
3496 plugins.begin();
3497 it != plugins.end(); 3500 it != plugins.end();
3498 ++it) { 3501 ++it) {
3499 DictionaryValue* item = new DictionaryValue; 3502 DictionaryValue* item = new DictionaryValue;
3500 item->SetString("name", it->name); 3503 item->SetString("name", it->name);
3501 item->SetString("path", it->path.value()); 3504 item->SetString("path", it->path.value());
3502 item->SetString("version", it->version); 3505 item->SetString("version", it->version);
3503 item->SetString("desc", it->desc); 3506 item->SetString("desc", it->desc);
3504 item->SetBoolean("enabled", plugin_prefs->IsPluginEnabled(*it)); 3507 item->SetBoolean("enabled", plugin_prefs->IsPluginEnabled(*it));
3505 // Add info about mime types. 3508 // Add info about mime types.
3506 ListValue* mime_types = new ListValue(); 3509 ListValue* mime_types = new ListValue();
(...skipping 2840 matching lines...) Expand 10 before | Expand all | Expand 10 after
6347 6350
6348 Send(reply_message_); 6351 Send(reply_message_);
6349 redirect_query_ = 0; 6352 redirect_query_ = 0;
6350 reply_message_ = NULL; 6353 reply_message_ = NULL;
6351 } 6354 }
6352 6355
6353 void TestingAutomationProvider::OnRemoveProvider() { 6356 void TestingAutomationProvider::OnRemoveProvider() {
6354 if (g_browser_process) 6357 if (g_browser_process)
6355 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); 6358 g_browser_process->GetAutomationProviderList()->RemoveProvider(this);
6356 } 6359 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698