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

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

Issue 6012002: Move the NPAPI files from webkit/glue/plugins to webkit/plugins/npapi and put... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years 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
« no previous file with comments | « chrome/browser/automation/automation_provider.cc ('k') | chrome/browser/dom_ui/plugins_ui.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "app/message_box_flags.h" 7 #include "app/message_box_flags.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/json/json_reader.h" 9 #include "base/json/json_reader.h"
10 #include "base/json/json_writer.h" 10 #include "base/json/json_writer.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 #include "chrome/common/chrome_constants.h" 68 #include "chrome/common/chrome_constants.h"
69 #include "chrome/common/chrome_paths.h" 69 #include "chrome/common/chrome_paths.h"
70 #include "chrome/common/chrome_switches.h" 70 #include "chrome/common/chrome_switches.h"
71 #include "chrome/common/net/url_request_context_getter.h" 71 #include "chrome/common/net/url_request_context_getter.h"
72 #include "chrome/common/notification_service.h" 72 #include "chrome/common/notification_service.h"
73 #include "chrome/common/url_constants.h" 73 #include "chrome/common/url_constants.h"
74 #include "chrome/common/automation_messages.h" 74 #include "chrome/common/automation_messages.h"
75 #include "net/base/cookie_store.h" 75 #include "net/base/cookie_store.h"
76 #include "net/url_request/url_request_context.h" 76 #include "net/url_request/url_request_context.h"
77 #include "views/event.h" 77 #include "views/event.h"
78 #include "webkit/glue/plugins/plugin_list.h" 78 #include "webkit/plugins/npapi/plugin_list.h"
79 79
80 namespace { 80 namespace {
81 81
82 void GetCookiesOnIOThread( 82 void GetCookiesOnIOThread(
83 const GURL& url, 83 const GURL& url,
84 const scoped_refptr<URLRequestContextGetter>& context_getter, 84 const scoped_refptr<URLRequestContextGetter>& context_getter,
85 base::WaitableEvent* event, 85 base::WaitableEvent* event,
86 std::string* cookies) { 86 std::string* cookies) {
87 *cookies = context_getter->GetCookieStore()->GetCookies(url); 87 *cookies = context_getter->GetCookieStore()->GetCookies(url);
88 event->Signal(); 88 event->Signal();
(...skipping 2897 matching lines...) Expand 10 before | Expand all | Expand 10 after
2986 reply_message, json_return, true); 2986 reply_message, json_return, true);
2987 Send(reply_message); 2987 Send(reply_message);
2988 } 2988 }
2989 2989
2990 // Sample json input: { "command": "GetPluginsInfo" } 2990 // Sample json input: { "command": "GetPluginsInfo" }
2991 // Refer chrome/test/pyautolib/plugins_info.py for sample json output. 2991 // Refer chrome/test/pyautolib/plugins_info.py for sample json output.
2992 void TestingAutomationProvider::GetPluginsInfo( 2992 void TestingAutomationProvider::GetPluginsInfo(
2993 Browser* browser, 2993 Browser* browser,
2994 DictionaryValue* args, 2994 DictionaryValue* args,
2995 IPC::Message* reply_message) { 2995 IPC::Message* reply_message) {
2996 std::vector<WebPluginInfo> plugins; 2996 std::vector<webkit::npapi::WebPluginInfo> plugins;
2997 NPAPI::PluginList::Singleton()->GetPlugins(false, &plugins); 2997 webkit::npapi::PluginList::Singleton()->GetPlugins(false, &plugins);
2998 ListValue* items = new ListValue; 2998 ListValue* items = new ListValue;
2999 for (std::vector<WebPluginInfo>::const_iterator it = plugins.begin(); 2999 for (std::vector<webkit::npapi::WebPluginInfo>::const_iterator it =
3000 plugins.begin();
3000 it != plugins.end(); 3001 it != plugins.end();
3001 ++it) { 3002 ++it) {
3002 DictionaryValue* item = new DictionaryValue; 3003 DictionaryValue* item = new DictionaryValue;
3003 item->SetString("name", it->name); 3004 item->SetString("name", it->name);
3004 item->SetString("path", it->path.value()); 3005 item->SetString("path", it->path.value());
3005 item->SetString("version", it->version); 3006 item->SetString("version", it->version);
3006 item->SetString("desc", it->desc); 3007 item->SetString("desc", it->desc);
3007 item->SetBoolean("enabled", it->enabled); 3008 item->SetBoolean("enabled", it->enabled);
3008 // Add info about mime types. 3009 // Add info about mime types.
3009 ListValue* mime_types = new ListValue(); 3010 ListValue* mime_types = new ListValue();
3010 for (std::vector<WebPluginMimeType>::const_iterator type_it = 3011 for (std::vector<webkit::npapi::WebPluginMimeType>::const_iterator type_it =
3011 it->mime_types.begin(); 3012 it->mime_types.begin();
3012 type_it != it->mime_types.end(); 3013 type_it != it->mime_types.end();
3013 ++type_it) { 3014 ++type_it) {
3014 DictionaryValue* mime_type = new DictionaryValue(); 3015 DictionaryValue* mime_type = new DictionaryValue();
3015 mime_type->SetString("mimeType", type_it->mime_type); 3016 mime_type->SetString("mimeType", type_it->mime_type);
3016 mime_type->SetString("description", type_it->description); 3017 mime_type->SetString("description", type_it->description);
3017 3018
3018 ListValue* file_extensions = new ListValue(); 3019 ListValue* file_extensions = new ListValue();
3019 for (std::vector<std::string>::const_iterator ext_it = 3020 for (std::vector<std::string>::const_iterator ext_it =
3020 type_it->file_extensions.begin(); 3021 type_it->file_extensions.begin();
(...skipping 18 matching lines...) Expand all
3039 // { "command": "EnablePlugin", 3040 // { "command": "EnablePlugin",
3040 // "path": "/Library/Internet Plug-Ins/Flash Player.plugin" } 3041 // "path": "/Library/Internet Plug-Ins/Flash Player.plugin" }
3041 void TestingAutomationProvider::EnablePlugin(Browser* browser, 3042 void TestingAutomationProvider::EnablePlugin(Browser* browser,
3042 DictionaryValue* args, 3043 DictionaryValue* args,
3043 IPC::Message* reply_message) { 3044 IPC::Message* reply_message) {
3044 FilePath::StringType path; 3045 FilePath::StringType path;
3045 AutomationJSONReply reply(this, reply_message); 3046 AutomationJSONReply reply(this, reply_message);
3046 if (!args->GetString("path", &path)) { 3047 if (!args->GetString("path", &path)) {
3047 reply.SendError("path not specified."); 3048 reply.SendError("path not specified.");
3048 return; 3049 return;
3049 } else if (!NPAPI::PluginList::Singleton()->EnablePlugin(FilePath(path))) { 3050 } else if (!webkit::npapi::PluginList::Singleton()->EnablePlugin(
3051 FilePath(path))) {
3050 reply.SendError(StringPrintf("Could not enable plugin for path %s.", 3052 reply.SendError(StringPrintf("Could not enable plugin for path %s.",
3051 path.c_str())); 3053 path.c_str()));
3052 return; 3054 return;
3053 } 3055 }
3054 reply.SendSuccess(NULL); 3056 reply.SendSuccess(NULL);
3055 } 3057 }
3056 3058
3057 // Sample json input: 3059 // Sample json input:
3058 // { "command": "DisablePlugin", 3060 // { "command": "DisablePlugin",
3059 // "path": "/Library/Internet Plug-Ins/Flash Player.plugin" } 3061 // "path": "/Library/Internet Plug-Ins/Flash Player.plugin" }
3060 void TestingAutomationProvider::DisablePlugin(Browser* browser, 3062 void TestingAutomationProvider::DisablePlugin(Browser* browser,
3061 DictionaryValue* args, 3063 DictionaryValue* args,
3062 IPC::Message* reply_message) { 3064 IPC::Message* reply_message) {
3063 FilePath::StringType path; 3065 FilePath::StringType path;
3064 AutomationJSONReply reply(this, reply_message); 3066 AutomationJSONReply reply(this, reply_message);
3065 if (!args->GetString("path", &path)) { 3067 if (!args->GetString("path", &path)) {
3066 reply.SendError("path not specified."); 3068 reply.SendError("path not specified.");
3067 return; 3069 return;
3068 } else if (!NPAPI::PluginList::Singleton()->DisablePlugin(FilePath(path))) { 3070 } else if (!webkit::npapi::PluginList::Singleton()->DisablePlugin(
3071 FilePath(path))) {
3069 reply.SendError(StringPrintf("Could not disable plugin for path %s.", 3072 reply.SendError(StringPrintf("Could not disable plugin for path %s.",
3070 path.c_str())); 3073 path.c_str()));
3071 return; 3074 return;
3072 } 3075 }
3073 reply.SendSuccess(NULL); 3076 reply.SendSuccess(NULL);
3074 } 3077 }
3075 3078
3076 // Sample json input: 3079 // Sample json input:
3077 // { "command": "SaveTabContents", 3080 // { "command": "SaveTabContents",
3078 // "tab_index": 0, 3081 // "tab_index": 0,
(...skipping 1441 matching lines...) Expand 10 before | Expand all | Expand 10 after
4520 // If you change this, update Observer for NotificationType::SESSION_END 4523 // If you change this, update Observer for NotificationType::SESSION_END
4521 // below. 4524 // below.
4522 MessageLoop::current()->PostTask(FROM_HERE, 4525 MessageLoop::current()->PostTask(FROM_HERE,
4523 NewRunnableMethod(this, &TestingAutomationProvider::OnRemoveProvider)); 4526 NewRunnableMethod(this, &TestingAutomationProvider::OnRemoveProvider));
4524 } 4527 }
4525 } 4528 }
4526 4529
4527 void TestingAutomationProvider::OnRemoveProvider() { 4530 void TestingAutomationProvider::OnRemoveProvider() {
4528 AutomationProviderList::GetInstance()->RemoveProvider(this); 4531 AutomationProviderList::GetInstance()->RemoveProvider(this);
4529 } 4532 }
OLDNEW
« no previous file with comments | « chrome/browser/automation/automation_provider.cc ('k') | chrome/browser/dom_ui/plugins_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698