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 3518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3529 // { "command": "EnablePlugin", | 3529 // { "command": "EnablePlugin", |
3530 // "path": "/Library/Internet Plug-Ins/Flash Player.plugin" } | 3530 // "path": "/Library/Internet Plug-Ins/Flash Player.plugin" } |
3531 void TestingAutomationProvider::EnablePlugin(Browser* browser, | 3531 void TestingAutomationProvider::EnablePlugin(Browser* browser, |
3532 DictionaryValue* args, | 3532 DictionaryValue* args, |
3533 IPC::Message* reply_message) { | 3533 IPC::Message* reply_message) { |
3534 FilePath::StringType path; | 3534 FilePath::StringType path; |
3535 AutomationJSONReply reply(this, reply_message); | 3535 AutomationJSONReply reply(this, reply_message); |
3536 if (!args->GetString("path", &path)) { | 3536 if (!args->GetString("path", &path)) { |
3537 reply.SendError("path not specified."); | 3537 reply.SendError("path not specified."); |
3538 return; | 3538 return; |
3539 } else if (!webkit::npapi::PluginList::Singleton()->EnablePlugin( | |
3540 FilePath(path))) { | |
3541 reply.SendError(StringPrintf("Could not enable plugin for path %s.", | |
3542 path.c_str())); | |
3543 return; | |
3544 } | 3539 } |
| 3540 PluginPrefs::GetForProfile(browser->profile())->EnablePlugin( |
| 3541 true, FilePath(path)); |
3545 reply.SendSuccess(NULL); | 3542 reply.SendSuccess(NULL); |
3546 } | 3543 } |
3547 | 3544 |
3548 // Sample json input: | 3545 // Sample json input: |
3549 // { "command": "DisablePlugin", | 3546 // { "command": "DisablePlugin", |
3550 // "path": "/Library/Internet Plug-Ins/Flash Player.plugin" } | 3547 // "path": "/Library/Internet Plug-Ins/Flash Player.plugin" } |
3551 void TestingAutomationProvider::DisablePlugin(Browser* browser, | 3548 void TestingAutomationProvider::DisablePlugin(Browser* browser, |
3552 DictionaryValue* args, | 3549 DictionaryValue* args, |
3553 IPC::Message* reply_message) { | 3550 IPC::Message* reply_message) { |
3554 FilePath::StringType path; | 3551 FilePath::StringType path; |
3555 AutomationJSONReply reply(this, reply_message); | 3552 AutomationJSONReply reply(this, reply_message); |
3556 if (!args->GetString("path", &path)) { | 3553 if (!args->GetString("path", &path)) { |
3557 reply.SendError("path not specified."); | 3554 reply.SendError("path not specified."); |
3558 return; | 3555 return; |
3559 } else if (!webkit::npapi::PluginList::Singleton()->DisablePlugin( | |
3560 FilePath(path))) { | |
3561 reply.SendError(StringPrintf("Could not disable plugin for path %s.", | |
3562 path.c_str())); | |
3563 return; | |
3564 } | 3556 } |
| 3557 PluginPrefs::GetForProfile(browser->profile())->EnablePlugin( |
| 3558 false, FilePath(path)); |
3565 reply.SendSuccess(NULL); | 3559 reply.SendSuccess(NULL); |
3566 } | 3560 } |
3567 | 3561 |
3568 // Sample json input: | 3562 // Sample json input: |
3569 // { "command": "SaveTabContents", | 3563 // { "command": "SaveTabContents", |
3570 // "tab_index": 0, | 3564 // "tab_index": 0, |
3571 // "filename": <a full pathname> } | 3565 // "filename": <a full pathname> } |
3572 // Sample json output: | 3566 // Sample json output: |
3573 // {} | 3567 // {} |
3574 void TestingAutomationProvider::SaveTabContents( | 3568 void TestingAutomationProvider::SaveTabContents( |
(...skipping 2772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6347 IPC::ParamTraits<std::vector<GURL> >::Write(reply_message_, redirects_gurl); | 6341 IPC::ParamTraits<std::vector<GURL> >::Write(reply_message_, redirects_gurl); |
6348 | 6342 |
6349 Send(reply_message_); | 6343 Send(reply_message_); |
6350 redirect_query_ = 0; | 6344 redirect_query_ = 0; |
6351 reply_message_ = NULL; | 6345 reply_message_ = NULL; |
6352 } | 6346 } |
6353 | 6347 |
6354 void TestingAutomationProvider::OnRemoveProvider() { | 6348 void TestingAutomationProvider::OnRemoveProvider() { |
6355 AutomationProviderList::GetInstance()->RemoveProvider(this); | 6349 AutomationProviderList::GetInstance()->RemoveProvider(this); |
6356 } | 6350 } |
OLD | NEW |