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

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: Ready for review 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 119
120 #if defined(OS_CHROMEOS) 120 #if defined(OS_CHROMEOS)
121 #include "chrome/browser/ui/webui/active_downloads_ui.h" 121 #include "chrome/browser/ui/webui/active_downloads_ui.h"
122 #else 122 #else
123 #include "chrome/browser/download/download_shelf.h" 123 #include "chrome/browser/download/download_shelf.h"
124 #endif 124 #endif
125 125
126 using automation_util::SendErrorIfModalDialogActive; 126 using automation_util::SendErrorIfModalDialogActive;
127 127
128 namespace { 128 namespace {
(...skipping 3345 matching lines...) Expand 10 before | Expand all | Expand 10 after
3474 reply_message, json_return, true); 3474 reply_message, json_return, true);
3475 Send(reply_message); 3475 Send(reply_message);
3476 } 3476 }
3477 3477
3478 // Sample json input: { "command": "GetPluginsInfo" } 3478 // Sample json input: { "command": "GetPluginsInfo" }
3479 // Refer chrome/test/pyautolib/plugins_info.py for sample json output. 3479 // Refer chrome/test/pyautolib/plugins_info.py for sample json output.
3480 void TestingAutomationProvider::GetPluginsInfo( 3480 void TestingAutomationProvider::GetPluginsInfo(
3481 Browser* browser, 3481 Browser* browser,
3482 DictionaryValue* args, 3482 DictionaryValue* args,
3483 IPC::Message* reply_message) { 3483 IPC::Message* reply_message) {
3484 if (!BrowserThread::CurrentlyOn(BrowserThread::FILE)) { 3484 PluginService::GetInstance()->GetPlugins(
3485 BrowserThread::PostTask( 3485 base::Bind(&TestingAutomationProvider::GetPluginsInfoSendReply,
3486 BrowserThread::FILE, FROM_HERE, 3486 this, browser, args, reply_message));
3487 base::Bind(&TestingAutomationProvider::GetPluginsInfo, 3487 }
3488 this, browser, args, reply_message)); 3488
3489 return; 3489 void TestingAutomationProvider::GetPluginsInfoSendReply(
3490 } 3490 Browser* browser,
3491 std::vector<webkit::WebPluginInfo> plugins; 3491 DictionaryValue* args,
3492 webkit::npapi::PluginList::Singleton()->GetPlugins(&plugins); 3492 IPC::Message* reply_message,
3493 std::vector<webkit::WebPluginInfo> plugins) {
3493 PluginPrefs* plugin_prefs = PluginPrefs::GetForProfile(browser->profile()); 3494 PluginPrefs* plugin_prefs = PluginPrefs::GetForProfile(browser->profile());
3494 ListValue* items = new ListValue; 3495 ListValue* items = new ListValue;
3495 for (std::vector<webkit::WebPluginInfo>::const_iterator it = 3496 for (std::vector<webkit::WebPluginInfo>::const_iterator it =
3496 plugins.begin(); 3497 plugins.begin();
3497 it != plugins.end(); 3498 it != plugins.end();
3498 ++it) { 3499 ++it) {
3499 DictionaryValue* item = new DictionaryValue; 3500 DictionaryValue* item = new DictionaryValue;
3500 item->SetString("name", it->name); 3501 item->SetString("name", it->name);
3501 item->SetString("path", it->path.value()); 3502 item->SetString("path", it->path.value());
3502 item->SetString("version", it->version); 3503 item->SetString("version", it->version);
(...skipping 2844 matching lines...) Expand 10 before | Expand all | Expand 10 after
6347 6348
6348 Send(reply_message_); 6349 Send(reply_message_);
6349 redirect_query_ = 0; 6350 redirect_query_ = 0;
6350 reply_message_ = NULL; 6351 reply_message_ = NULL;
6351 } 6352 }
6352 6353
6353 void TestingAutomationProvider::OnRemoveProvider() { 6354 void TestingAutomationProvider::OnRemoveProvider() {
6354 if (g_browser_process) 6355 if (g_browser_process)
6355 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); 6356 g_browser_process->GetAutomationProviderList()->RemoveProvider(this);
6356 } 6357 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698