OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 3444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3455 AutomationJSONReply reply(this, reply_message); | 3455 AutomationJSONReply reply(this, reply_message); |
3456 if (!protector::IsEnabled()) { | 3456 if (!protector::IsEnabled()) { |
3457 reply.SendError("Protector is disabled"); | 3457 reply.SendError("Protector is disabled"); |
3458 return; | 3458 return; |
3459 } | 3459 } |
3460 std::string action; | 3460 std::string action; |
3461 if (!args->GetString("action", &action)) { | 3461 if (!args->GetString("action", &action)) { |
3462 reply.SendError("Missing 'action' value"); | 3462 reply.SendError("Missing 'action' value"); |
3463 return; | 3463 return; |
3464 } | 3464 } |
| 3465 protector::BaseSettingChange* change = |
| 3466 protector_service->GetLastChange(); |
3465 if (action == "apply_change") | 3467 if (action == "apply_change") |
3466 protector_service->ApplyChange(browser); | 3468 protector_service->ApplyChange(change, browser); |
3467 else if (action == "discard_change") | 3469 else if (action == "discard_change") |
3468 protector_service->DiscardChange(browser); | 3470 protector_service->DiscardChange(change, browser); |
3469 else | 3471 else |
3470 return reply.SendError("Invalid 'action' value"); | 3472 return reply.SendError("Invalid 'action' value"); |
3471 reply.SendSuccess(NULL); | 3473 reply.SendSuccess(NULL); |
3472 } | 3474 } |
3473 | 3475 |
3474 // Sample json input: { "command": "GetLocalStatePrefsInfo" } | 3476 // Sample json input: { "command": "GetLocalStatePrefsInfo" } |
3475 // Refer chrome/test/pyautolib/prefs_info.py for sample json output. | 3477 // Refer chrome/test/pyautolib/prefs_info.py for sample json output. |
3476 void TestingAutomationProvider::GetLocalStatePrefsInfo( | 3478 void TestingAutomationProvider::GetLocalStatePrefsInfo( |
3477 DictionaryValue* args, | 3479 DictionaryValue* args, |
3478 IPC::Message* reply_message) { | 3480 IPC::Message* reply_message) { |
(...skipping 3494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6973 | 6975 |
6974 Send(reply_message_); | 6976 Send(reply_message_); |
6975 redirect_query_ = 0; | 6977 redirect_query_ = 0; |
6976 reply_message_ = NULL; | 6978 reply_message_ = NULL; |
6977 } | 6979 } |
6978 | 6980 |
6979 void TestingAutomationProvider::OnRemoveProvider() { | 6981 void TestingAutomationProvider::OnRemoveProvider() { |
6980 if (g_browser_process) | 6982 if (g_browser_process) |
6981 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); | 6983 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); |
6982 } | 6984 } |
OLD | NEW |