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