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