OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "app/message_box_flags.h" | 7 #include "app/message_box_flags.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 #include "chrome/browser/bookmarks/bookmark_model.h" | 30 #include "chrome/browser/bookmarks/bookmark_model.h" |
31 #include "chrome/browser/bookmarks/bookmark_storage.h" | 31 #include "chrome/browser/bookmarks/bookmark_storage.h" |
32 #include "chrome/browser/blocked_content_container.h" | 32 #include "chrome/browser/blocked_content_container.h" |
33 #include "chrome/browser/browser_process.h" | 33 #include "chrome/browser/browser_process.h" |
34 #include "chrome/browser/browser_shutdown.h" | 34 #include "chrome/browser/browser_shutdown.h" |
35 #include "chrome/browser/browser_window.h" | 35 #include "chrome/browser/browser_window.h" |
36 #include "chrome/browser/debugger/devtools_manager.h" | 36 #include "chrome/browser/debugger/devtools_manager.h" |
37 #include "chrome/browser/download/download_prefs.h" | 37 #include "chrome/browser/download/download_prefs.h" |
38 #include "chrome/browser/download/download_shelf.h" | 38 #include "chrome/browser/download/download_shelf.h" |
39 #include "chrome/browser/extensions/extension_host.h" | 39 #include "chrome/browser/extensions/extension_host.h" |
40 #include "chrome/browser/extensions/extensions_service.h" | 40 #include "chrome/browser/extensions/extension_service.h" |
41 #include "chrome/browser/history/top_sites.h" | 41 #include "chrome/browser/history/top_sites.h" |
42 #include "chrome/browser/importer/importer.h" | 42 #include "chrome/browser/importer/importer.h" |
43 #include "chrome/browser/notifications/balloon.h" | 43 #include "chrome/browser/notifications/balloon.h" |
44 #include "chrome/browser/notifications/balloon_collection.h" | 44 #include "chrome/browser/notifications/balloon_collection.h" |
45 #include "chrome/browser/notifications/balloon_host.h" | 45 #include "chrome/browser/notifications/balloon_host.h" |
46 #include "chrome/browser/notifications/notification.h" | 46 #include "chrome/browser/notifications/notification.h" |
47 #include "chrome/browser/notifications/notification_ui_manager.h" | 47 #include "chrome/browser/notifications/notification_ui_manager.h" |
48 #include "chrome/browser/profiles/profile.h" | 48 #include "chrome/browser/profiles/profile.h" |
49 #include "chrome/browser/platform_util.h" | 49 #include "chrome/browser/platform_util.h" |
50 #include "chrome/browser/prefs/pref_service.h" | 50 #include "chrome/browser/prefs/pref_service.h" |
(...skipping 3632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3683 } | 3683 } |
3684 | 3684 |
3685 // Sample json input: { "command": "GetExtensionsInfo" } | 3685 // Sample json input: { "command": "GetExtensionsInfo" } |
3686 // See GetExtensionsInfo() in chrome/test/pyautolib/pyauto.py for sample json | 3686 // See GetExtensionsInfo() in chrome/test/pyautolib/pyauto.py for sample json |
3687 // output. | 3687 // output. |
3688 void TestingAutomationProvider::GetExtensionsInfo( | 3688 void TestingAutomationProvider::GetExtensionsInfo( |
3689 Browser* browser, | 3689 Browser* browser, |
3690 DictionaryValue* args, | 3690 DictionaryValue* args, |
3691 IPC::Message* reply_message) { | 3691 IPC::Message* reply_message) { |
3692 AutomationJSONReply reply(this, reply_message); | 3692 AutomationJSONReply reply(this, reply_message); |
3693 ExtensionsService* service = profile()->GetExtensionsService(); | 3693 ExtensionService* service = profile()->GetExtensionService(); |
3694 if (!service) { | 3694 if (!service) { |
3695 reply.SendError("No extensions service."); | 3695 reply.SendError("No extensions service."); |
3696 } | 3696 } |
3697 scoped_ptr<DictionaryValue> return_value(new DictionaryValue); | 3697 scoped_ptr<DictionaryValue> return_value(new DictionaryValue); |
3698 ListValue* extensions_values = new ListValue; | 3698 ListValue* extensions_values = new ListValue; |
3699 const ExtensionList* extensions = service->extensions(); | 3699 const ExtensionList* extensions = service->extensions(); |
3700 for (ExtensionList::const_iterator it = extensions->begin(); | 3700 for (ExtensionList::const_iterator it = extensions->begin(); |
3701 it != extensions->end(); ++it) { | 3701 it != extensions->end(); ++it) { |
3702 const Extension* extension = *it; | 3702 const Extension* extension = *it; |
3703 DictionaryValue* extension_value = new DictionaryValue; | 3703 DictionaryValue* extension_value = new DictionaryValue; |
(...skipping 18 matching lines...) Expand all Loading... |
3722 void TestingAutomationProvider::UninstallExtensionById( | 3722 void TestingAutomationProvider::UninstallExtensionById( |
3723 Browser* browser, | 3723 Browser* browser, |
3724 DictionaryValue* args, | 3724 DictionaryValue* args, |
3725 IPC::Message* reply_message) { | 3725 IPC::Message* reply_message) { |
3726 AutomationJSONReply reply(this, reply_message); | 3726 AutomationJSONReply reply(this, reply_message); |
3727 std::string id; | 3727 std::string id; |
3728 if (!args->GetString("id", &id)) { | 3728 if (!args->GetString("id", &id)) { |
3729 reply.SendError("Must include string id."); | 3729 reply.SendError("Must include string id."); |
3730 return; | 3730 return; |
3731 } | 3731 } |
3732 ExtensionsService* service = profile()->GetExtensionsService(); | 3732 ExtensionService* service = profile()->GetExtensionService(); |
3733 if (!service) { | 3733 if (!service) { |
3734 reply.SendError("No extensions service."); | 3734 reply.SendError("No extensions service."); |
3735 return; | 3735 return; |
3736 } | 3736 } |
3737 ExtensionUnloadNotificationObserver observer; | 3737 ExtensionUnloadNotificationObserver observer; |
3738 service->UninstallExtension(id, false); | 3738 service->UninstallExtension(id, false); |
3739 reply.SendSuccess(NULL); | 3739 reply.SendSuccess(NULL); |
3740 } | 3740 } |
3741 | 3741 |
3742 // Sample json input: | 3742 // Sample json input: |
(...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4515 // If you change this, update Observer for NotificationType::SESSION_END | 4515 // If you change this, update Observer for NotificationType::SESSION_END |
4516 // below. | 4516 // below. |
4517 MessageLoop::current()->PostTask(FROM_HERE, | 4517 MessageLoop::current()->PostTask(FROM_HERE, |
4518 NewRunnableMethod(this, &TestingAutomationProvider::OnRemoveProvider)); | 4518 NewRunnableMethod(this, &TestingAutomationProvider::OnRemoveProvider)); |
4519 } | 4519 } |
4520 } | 4520 } |
4521 | 4521 |
4522 void TestingAutomationProvider::OnRemoveProvider() { | 4522 void TestingAutomationProvider::OnRemoveProvider() { |
4523 AutomationProviderList::GetInstance()->RemoveProvider(this); | 4523 AutomationProviderList::GetInstance()->RemoveProvider(this); |
4524 } | 4524 } |
OLD | NEW |