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

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

Issue 9863047: Exclude ProtectorService code from Android build. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 8 years, 8 months 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
OLDNEW
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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 #include "chrome/browser/platform_util.h" 72 #include "chrome/browser/platform_util.h"
73 #include "chrome/browser/plugin_prefs.h" 73 #include "chrome/browser/plugin_prefs.h"
74 #include "chrome/browser/prefs/pref_service.h" 74 #include "chrome/browser/prefs/pref_service.h"
75 #include "chrome/browser/printing/print_preview_tab_controller.h" 75 #include "chrome/browser/printing/print_preview_tab_controller.h"
76 #include "chrome/browser/printing/print_view_manager.h" 76 #include "chrome/browser/printing/print_view_manager.h"
77 #include "chrome/browser/profiles/profile.h" 77 #include "chrome/browser/profiles/profile.h"
78 #include "chrome/browser/profiles/profile_info_cache.h" 78 #include "chrome/browser/profiles/profile_info_cache.h"
79 #include "chrome/browser/profiles/profile_manager.h" 79 #include "chrome/browser/profiles/profile_manager.h"
80 #include "chrome/browser/protector/protector_service.h" 80 #include "chrome/browser/protector/protector_service.h"
81 #include "chrome/browser/protector/protector_service_factory.h" 81 #include "chrome/browser/protector/protector_service_factory.h"
82 #include "chrome/browser/protector/protector_utils.h"
82 #include "chrome/browser/search_engines/template_url.h" 83 #include "chrome/browser/search_engines/template_url.h"
83 #include "chrome/browser/search_engines/template_url_service.h" 84 #include "chrome/browser/search_engines/template_url_service.h"
84 #include "chrome/browser/search_engines/template_url_service_factory.h" 85 #include "chrome/browser/search_engines/template_url_service_factory.h"
85 #include "chrome/browser/sessions/restore_tab_helper.h" 86 #include "chrome/browser/sessions/restore_tab_helper.h"
86 #include "chrome/browser/sessions/session_service_factory.h" 87 #include "chrome/browser/sessions/session_service_factory.h"
87 #include "chrome/browser/sync/profile_sync_service.h" 88 #include "chrome/browser/sync/profile_sync_service.h"
88 #include "chrome/browser/sync/profile_sync_service_factory.h" 89 #include "chrome/browser/sync/profile_sync_service_factory.h"
89 #include "chrome/browser/tab_contents/confirm_infobar_delegate.h" 90 #include "chrome/browser/tab_contents/confirm_infobar_delegate.h"
90 #include "chrome/browser/tab_contents/link_infobar_delegate.h" 91 #include "chrome/browser/tab_contents/link_infobar_delegate.h"
91 #include "chrome/browser/themes/theme_service.h" 92 #include "chrome/browser/themes/theme_service.h"
(...skipping 2429 matching lines...) Expand 10 before | Expand all | Expand 10 after
2521 2522
2522 browser_handler_map["LoadSearchEngineInfo"] = 2523 browser_handler_map["LoadSearchEngineInfo"] =
2523 &TestingAutomationProvider::LoadSearchEngineInfo; 2524 &TestingAutomationProvider::LoadSearchEngineInfo;
2524 browser_handler_map["GetSearchEngineInfo"] = 2525 browser_handler_map["GetSearchEngineInfo"] =
2525 &TestingAutomationProvider::GetSearchEngineInfo; 2526 &TestingAutomationProvider::GetSearchEngineInfo;
2526 browser_handler_map["AddOrEditSearchEngine"] = 2527 browser_handler_map["AddOrEditSearchEngine"] =
2527 &TestingAutomationProvider::AddOrEditSearchEngine; 2528 &TestingAutomationProvider::AddOrEditSearchEngine;
2528 browser_handler_map["PerformActionOnSearchEngine"] = 2529 browser_handler_map["PerformActionOnSearchEngine"] =
2529 &TestingAutomationProvider::PerformActionOnSearchEngine; 2530 &TestingAutomationProvider::PerformActionOnSearchEngine;
2530 2531
2532 #if defined(ENABLE_PROTECTOR_SERVICE)
2531 browser_handler_map["GetProtectorState"] = 2533 browser_handler_map["GetProtectorState"] =
2532 &TestingAutomationProvider::GetProtectorState; 2534 &TestingAutomationProvider::GetProtectorState;
2533 browser_handler_map["PerformProtectorAction"] = 2535 browser_handler_map["PerformProtectorAction"] =
2534 &TestingAutomationProvider::PerformProtectorAction; 2536 &TestingAutomationProvider::PerformProtectorAction;
2537 #endif
2535 2538
2536 browser_handler_map["SetWindowDimensions"] = 2539 browser_handler_map["SetWindowDimensions"] =
2537 &TestingAutomationProvider::SetWindowDimensions; 2540 &TestingAutomationProvider::SetWindowDimensions;
2538 2541
2539 browser_handler_map["GetDownloadsInfo"] = 2542 browser_handler_map["GetDownloadsInfo"] =
2540 &TestingAutomationProvider::GetDownloadsInfo; 2543 &TestingAutomationProvider::GetDownloadsInfo;
2541 browser_handler_map["WaitForAllDownloadsToComplete"] = 2544 browser_handler_map["WaitForAllDownloadsToComplete"] =
2542 &TestingAutomationProvider::WaitForAllDownloadsToComplete; 2545 &TestingAutomationProvider::WaitForAllDownloadsToComplete;
2543 browser_handler_map["PerformActionOnDownload"] = 2546 browser_handler_map["PerformActionOnDownload"] =
2544 &TestingAutomationProvider::PerformActionOnDownload; 2547 &TestingAutomationProvider::PerformActionOnDownload;
(...skipping 901 matching lines...) Expand 10 before | Expand all | Expand 10 after
3446 } else if (action == "default") { 3449 } else if (action == "default") {
3447 url_model->AddObserver(new AutomationProviderSearchEngineObserver( 3450 url_model->AddObserver(new AutomationProviderSearchEngineObserver(
3448 this, reply_message)); 3451 this, reply_message));
3449 url_model->SetDefaultSearchProvider(template_url); 3452 url_model->SetDefaultSearchProvider(template_url);
3450 } else { 3453 } else {
3451 AutomationJSONReply(this, reply_message).SendError( 3454 AutomationJSONReply(this, reply_message).SendError(
3452 "Invalid action: " + action); 3455 "Invalid action: " + action);
3453 } 3456 }
3454 } 3457 }
3455 3458
3459 #if defined(ENABLE_PROTECTOR_SERVICE)
3456 // Sample json output: { "enabled": true, 3460 // Sample json output: { "enabled": true,
3457 // "showing_change": false } 3461 // "showing_change": false }
3458 void TestingAutomationProvider::GetProtectorState( 3462 void TestingAutomationProvider::GetProtectorState(
3459 Browser* browser, 3463 Browser* browser,
3460 DictionaryValue* args, 3464 DictionaryValue* args,
3461 IPC::Message* reply_message) { 3465 IPC::Message* reply_message) {
3462 protector::ProtectorService* protector_service = 3466 protector::ProtectorService* protector_service =
3463 protector::ProtectorServiceFactory::GetForProfile(browser->profile()); 3467 protector::ProtectorServiceFactory::GetForProfile(browser->profile());
3464 scoped_ptr<DictionaryValue> return_value(new DictionaryValue); 3468 scoped_ptr<DictionaryValue> return_value(new DictionaryValue);
3465 return_value->SetBoolean("enabled", protector::IsEnabled()); 3469 return_value->SetBoolean("enabled", protector::IsEnabled());
(...skipping 24 matching lines...) Expand all
3490 protector::BaseSettingChange* change = 3494 protector::BaseSettingChange* change =
3491 protector_service->GetLastChange(); 3495 protector_service->GetLastChange();
3492 if (action == "apply_change") 3496 if (action == "apply_change")
3493 protector_service->ApplyChange(change, browser); 3497 protector_service->ApplyChange(change, browser);
3494 else if (action == "discard_change") 3498 else if (action == "discard_change")
3495 protector_service->DiscardChange(change, browser); 3499 protector_service->DiscardChange(change, browser);
3496 else 3500 else
3497 return reply.SendError("Invalid 'action' value"); 3501 return reply.SendError("Invalid 'action' value");
3498 reply.SendSuccess(NULL); 3502 reply.SendSuccess(NULL);
3499 } 3503 }
3504 #endif // defined(ENABLE_PROTECTOR_SERVICE)
3500 3505
3501 // Sample json input: { "command": "GetLocalStatePrefsInfo" } 3506 // Sample json input: { "command": "GetLocalStatePrefsInfo" }
3502 // Refer chrome/test/pyautolib/prefs_info.py for sample json output. 3507 // Refer chrome/test/pyautolib/prefs_info.py for sample json output.
3503 void TestingAutomationProvider::GetLocalStatePrefsInfo( 3508 void TestingAutomationProvider::GetLocalStatePrefsInfo(
3504 DictionaryValue* args, 3509 DictionaryValue* args,
3505 IPC::Message* reply_message) { 3510 IPC::Message* reply_message) {
3506 DictionaryValue* items = g_browser_process->local_state()-> 3511 DictionaryValue* items = g_browser_process->local_state()->
3507 GetPreferenceValues(); 3512 GetPreferenceValues();
3508 scoped_ptr<DictionaryValue> return_value(new DictionaryValue); 3513 scoped_ptr<DictionaryValue> return_value(new DictionaryValue);
3509 return_value->Set("prefs", items); // return_value owns items. 3514 return_value->Set("prefs", items); // return_value owns items.
(...skipping 3573 matching lines...) Expand 10 before | Expand all | Expand 10 after
7083 7088
7084 Send(reply_message_); 7089 Send(reply_message_);
7085 redirect_query_ = 0; 7090 redirect_query_ = 0;
7086 reply_message_ = NULL; 7091 reply_message_ = NULL;
7087 } 7092 }
7088 7093
7089 void TestingAutomationProvider::OnRemoveProvider() { 7094 void TestingAutomationProvider::OnRemoveProvider() {
7090 if (g_browser_process) 7095 if (g_browser_process)
7091 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); 7096 g_browser_process->GetAutomationProviderList()->RemoveProvider(this);
7092 } 7097 }
OLDNEW
« no previous file with comments | « chrome/browser/automation/testing_automation_provider.h ('k') | chrome/browser/profiles/profile_dependency_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698