| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 #include "chrome/browser/download/save_package_file_picker.h" | 51 #include "chrome/browser/download/save_package_file_picker.h" |
| 52 #include "chrome/browser/extensions/browser_action_test_util.h" | 52 #include "chrome/browser/extensions/browser_action_test_util.h" |
| 53 #include "chrome/browser/extensions/crx_installer.h" | 53 #include "chrome/browser/extensions/crx_installer.h" |
| 54 #include "chrome/browser/extensions/extension_action.h" | 54 #include "chrome/browser/extensions/extension_action.h" |
| 55 #include "chrome/browser/extensions/extension_action_manager.h" | 55 #include "chrome/browser/extensions/extension_action_manager.h" |
| 56 #include "chrome/browser/extensions/extension_host.h" | 56 #include "chrome/browser/extensions/extension_host.h" |
| 57 #include "chrome/browser/extensions/extension_process_manager.h" | 57 #include "chrome/browser/extensions/extension_process_manager.h" |
| 58 #include "chrome/browser/extensions/extension_service.h" | 58 #include "chrome/browser/extensions/extension_service.h" |
| 59 #include "chrome/browser/extensions/extension_system.h" | 59 #include "chrome/browser/extensions/extension_system.h" |
| 60 #include "chrome/browser/extensions/extension_tab_util.h" | 60 #include "chrome/browser/extensions/extension_tab_util.h" |
| 61 #include "chrome/browser/extensions/extension_util.h" |
| 61 #include "chrome/browser/extensions/unpacked_installer.h" | 62 #include "chrome/browser/extensions/unpacked_installer.h" |
| 62 #include "chrome/browser/extensions/updater/extension_updater.h" | 63 #include "chrome/browser/extensions/updater/extension_updater.h" |
| 63 #include "chrome/browser/history/history_service_factory.h" | 64 #include "chrome/browser/history/history_service_factory.h" |
| 64 #include "chrome/browser/history/top_sites.h" | 65 #include "chrome/browser/history/top_sites.h" |
| 65 #include "chrome/browser/infobars/confirm_infobar_delegate.h" | 66 #include "chrome/browser/infobars/confirm_infobar_delegate.h" |
| 66 #include "chrome/browser/infobars/infobar_service.h" | 67 #include "chrome/browser/infobars/infobar_service.h" |
| 67 #include "chrome/browser/lifetime/application_lifetime.h" | 68 #include "chrome/browser/lifetime/application_lifetime.h" |
| 68 #include "chrome/browser/notifications/balloon.h" | 69 #include "chrome/browser/notifications/balloon.h" |
| 69 #include "chrome/browser/notifications/balloon_collection.h" | 70 #include "chrome/browser/notifications/balloon_collection.h" |
| 70 #include "chrome/browser/notifications/balloon_notification_ui_manager.h" | 71 #include "chrome/browser/notifications/balloon_notification_ui_manager.h" |
| (...skipping 3498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3569 Manifest::Location location = extension->location(); | 3570 Manifest::Location location = extension->location(); |
| 3570 extension_value->SetBoolean("is_component", | 3571 extension_value->SetBoolean("is_component", |
| 3571 location == Manifest::COMPONENT); | 3572 location == Manifest::COMPONENT); |
| 3572 extension_value->SetBoolean("is_internal", | 3573 extension_value->SetBoolean("is_internal", |
| 3573 location == Manifest::INTERNAL); | 3574 location == Manifest::INTERNAL); |
| 3574 extension_value->SetBoolean("is_user_installed", | 3575 extension_value->SetBoolean("is_user_installed", |
| 3575 location == Manifest::INTERNAL || | 3576 location == Manifest::INTERNAL || |
| 3576 Manifest::IsUnpackedLocation(location)); | 3577 Manifest::IsUnpackedLocation(location)); |
| 3577 extension_value->SetBoolean("is_enabled", service->IsExtensionEnabled(id)); | 3578 extension_value->SetBoolean("is_enabled", service->IsExtensionEnabled(id)); |
| 3578 extension_value->SetBoolean("allowed_in_incognito", | 3579 extension_value->SetBoolean("allowed_in_incognito", |
| 3579 service->IsIncognitoEnabled(id)); | 3580 extension_util::IsIncognitoEnabled(id, service)); |
| 3580 extension_value->SetBoolean( | 3581 extension_value->SetBoolean( |
| 3581 "has_page_action", | 3582 "has_page_action", |
| 3582 extension_action_manager->GetPageAction(*extension) != NULL); | 3583 extension_action_manager->GetPageAction(*extension) != NULL); |
| 3583 extensions_values->Append(extension_value); | 3584 extensions_values->Append(extension_value); |
| 3584 } | 3585 } |
| 3585 return_value->Set("extensions", extensions_values); | 3586 return_value->Set("extensions", extensions_values); |
| 3586 reply.SendSuccess(return_value.get()); | 3587 reply.SendSuccess(return_value.get()); |
| 3587 } | 3588 } |
| 3588 | 3589 |
| 3589 // See UninstallExtensionById() in chrome/test/pyautolib/pyauto.py for sample | 3590 // See UninstallExtensionById() in chrome/test/pyautolib/pyauto.py for sample |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3677 service->EnableExtension(extension->id()); | 3678 service->EnableExtension(extension->id()); |
| 3678 } else { | 3679 } else { |
| 3679 AutomationJSONReply(this, reply_message).SendSuccess(NULL); | 3680 AutomationJSONReply(this, reply_message).SendSuccess(NULL); |
| 3680 } | 3681 } |
| 3681 } else { | 3682 } else { |
| 3682 service->DisableExtension(extension->id(), | 3683 service->DisableExtension(extension->id(), |
| 3683 Extension::DISABLE_USER_ACTION); | 3684 Extension::DISABLE_USER_ACTION); |
| 3684 AutomationJSONReply(this, reply_message).SendSuccess(NULL); | 3685 AutomationJSONReply(this, reply_message).SendSuccess(NULL); |
| 3685 } | 3686 } |
| 3686 | 3687 |
| 3687 service->SetIsIncognitoEnabled(extension->id(), allow_in_incognito); | 3688 extension_util::SetIsIncognitoEnabled( |
| 3689 extension->id(), service, allow_in_incognito); |
| 3688 } | 3690 } |
| 3689 | 3691 |
| 3690 // See TriggerPageActionById() in chrome/test/pyautolib/pyauto.py | 3692 // See TriggerPageActionById() in chrome/test/pyautolib/pyauto.py |
| 3691 // for sample json input. | 3693 // for sample json input. |
| 3692 void TestingAutomationProvider::TriggerPageActionById( | 3694 void TestingAutomationProvider::TriggerPageActionById( |
| 3693 DictionaryValue* args, | 3695 DictionaryValue* args, |
| 3694 IPC::Message* reply_message) { | 3696 IPC::Message* reply_message) { |
| 3695 std::string error; | 3697 std::string error; |
| 3696 Browser* browser; | 3698 Browser* browser; |
| 3697 WebContents* tab; | 3699 WebContents* tab; |
| (...skipping 1756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5454 if (g_browser_process) | 5456 if (g_browser_process) |
| 5455 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); | 5457 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); |
| 5456 } | 5458 } |
| 5457 | 5459 |
| 5458 void TestingAutomationProvider::EnsureTabSelected(Browser* browser, | 5460 void TestingAutomationProvider::EnsureTabSelected(Browser* browser, |
| 5459 WebContents* tab) { | 5461 WebContents* tab) { |
| 5460 TabStripModel* tab_strip = browser->tab_strip_model(); | 5462 TabStripModel* tab_strip = browser->tab_strip_model(); |
| 5461 if (tab_strip->GetActiveWebContents() != tab) | 5463 if (tab_strip->GetActiveWebContents() != tab) |
| 5462 tab_strip->ActivateTabAt(tab_strip->GetIndexOfWebContents(tab), true); | 5464 tab_strip->ActivateTabAt(tab_strip->GetIndexOfWebContents(tab), true); |
| 5463 } | 5465 } |
| OLD | NEW |