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

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

Issue 67253003: Reland: Move ExtensionProcessManager to src/extensions, part 4 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase process_manager Created 7 years, 1 month 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 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 #include "chrome/browser/download/download_prefs.h" 47 #include "chrome/browser/download/download_prefs.h"
48 #include "chrome/browser/download/download_service.h" 48 #include "chrome/browser/download/download_service.h"
49 #include "chrome/browser/download/download_service_factory.h" 49 #include "chrome/browser/download/download_service_factory.h"
50 #include "chrome/browser/download/download_shelf.h" 50 #include "chrome/browser/download/download_shelf.h"
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"
58 #include "chrome/browser/extensions/extension_service.h" 57 #include "chrome/browser/extensions/extension_service.h"
59 #include "chrome/browser/extensions/extension_system.h" 58 #include "chrome/browser/extensions/extension_system.h"
60 #include "chrome/browser/extensions/extension_tab_util.h" 59 #include "chrome/browser/extensions/extension_tab_util.h"
61 #include "chrome/browser/extensions/extension_util.h" 60 #include "chrome/browser/extensions/extension_util.h"
62 #include "chrome/browser/extensions/unpacked_installer.h" 61 #include "chrome/browser/extensions/unpacked_installer.h"
63 #include "chrome/browser/extensions/updater/extension_updater.h" 62 #include "chrome/browser/extensions/updater/extension_updater.h"
64 #include "chrome/browser/history/history_service_factory.h" 63 #include "chrome/browser/history/history_service_factory.h"
65 #include "chrome/browser/history/top_sites.h" 64 #include "chrome/browser/history/top_sites.h"
66 #include "chrome/browser/infobars/confirm_infobar_delegate.h" 65 #include "chrome/browser/infobars/confirm_infobar_delegate.h"
67 #include "chrome/browser/infobars/infobar_service.h" 66 #include "chrome/browser/infobars/infobar_service.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 #include "content/public/browser/render_process_host.h" 129 #include "content/public/browser/render_process_host.h"
131 #include "content/public/browser/render_view_host.h" 130 #include "content/public/browser/render_view_host.h"
132 #include "content/public/browser/render_widget_host_view.h" 131 #include "content/public/browser/render_widget_host_view.h"
133 #include "content/public/browser/web_contents.h" 132 #include "content/public/browser/web_contents.h"
134 #include "content/public/common/child_process_host.h" 133 #include "content/public/common/child_process_host.h"
135 #include "content/public/common/common_param_traits.h" 134 #include "content/public/common/common_param_traits.h"
136 #include "content/public/common/drop_data.h" 135 #include "content/public/common/drop_data.h"
137 #include "content/public/common/geoposition.h" 136 #include "content/public/common/geoposition.h"
138 #include "content/public/common/ssl_status.h" 137 #include "content/public/common/ssl_status.h"
139 #include "content/public/common/webplugininfo.h" 138 #include "content/public/common/webplugininfo.h"
139 #include "extensions/browser/process_manager.h"
140 #include "extensions/browser/view_type_utils.h" 140 #include "extensions/browser/view_type_utils.h"
141 #include "extensions/common/manifest_handlers/background_info.h" 141 #include "extensions/common/manifest_handlers/background_info.h"
142 #include "extensions/common/permissions/permission_set.h" 142 #include "extensions/common/permissions/permission_set.h"
143 #include "extensions/common/url_pattern.h" 143 #include "extensions/common/url_pattern.h"
144 #include "extensions/common/url_pattern_set.h" 144 #include "extensions/common/url_pattern_set.h"
145 #include "net/cookies/cookie_store.h" 145 #include "net/cookies/cookie_store.h"
146 #include "third_party/WebKit/public/web/WebInputEvent.h" 146 #include "third_party/WebKit/public/web/WebInputEvent.h"
147 #include "ui/base/ui_base_types.h" 147 #include "ui/base/ui_base_types.h"
148 #include "ui/events/event_constants.h" 148 #include "ui/events/event_constants.h"
149 #include "ui/events/keycodes/keyboard_codes.h" 149 #include "ui/events/keycodes/keyboard_codes.h"
(...skipping 2102 matching lines...) Expand 10 before | Expand all | Expand 10 after
2252 #else 2252 #else
2253 int flags = ChildProcessHost::CHILD_NORMAL; 2253 int flags = ChildProcessHost::CHILD_NORMAL;
2254 #endif 2254 #endif
2255 2255
2256 // Add all extension processes in a list of dictionaries, one dictionary 2256 // Add all extension processes in a list of dictionaries, one dictionary
2257 // item per extension process. 2257 // item per extension process.
2258 ListValue* extension_views = new ListValue; 2258 ListValue* extension_views = new ListValue;
2259 ProfileManager* profile_manager = g_browser_process->profile_manager(); 2259 ProfileManager* profile_manager = g_browser_process->profile_manager();
2260 std::vector<Profile*> profiles(profile_manager->GetLoadedProfiles()); 2260 std::vector<Profile*> profiles(profile_manager->GetLoadedProfiles());
2261 for (size_t i = 0; i < profiles.size(); ++i) { 2261 for (size_t i = 0; i < profiles.size(); ++i) {
2262 ExtensionProcessManager* process_manager = 2262 extensions::ProcessManager* process_manager =
2263 extensions::ExtensionSystem::Get(profiles[i])->process_manager(); 2263 extensions::ExtensionSystem::Get(profiles[i])->process_manager();
2264 if (!process_manager) 2264 if (!process_manager)
2265 continue; 2265 continue;
2266 const ExtensionProcessManager::ViewSet view_set = 2266 const extensions::ProcessManager::ViewSet view_set =
2267 process_manager->GetAllViews(); 2267 process_manager->GetAllViews();
2268 for (ExtensionProcessManager::ViewSet::const_iterator jt = 2268 for (extensions::ProcessManager::ViewSet::const_iterator jt =
2269 view_set.begin(); 2269 view_set.begin();
2270 jt != view_set.end(); ++jt) { 2270 jt != view_set.end(); ++jt) {
2271 content::RenderViewHost* render_view_host = *jt; 2271 content::RenderViewHost* render_view_host = *jt;
2272 // Don't add dead extension processes. 2272 // Don't add dead extension processes.
2273 if (!render_view_host->IsRenderViewLive()) 2273 if (!render_view_host->IsRenderViewLive())
2274 continue; 2274 continue;
2275 // Don't add views for which we can't obtain an extension. 2275 // Don't add views for which we can't obtain an extension.
2276 // TODO(benwells): work out why this happens. It only happens for one 2276 // TODO(benwells): work out why this happens. It only happens for one
2277 // test, and only on the bots. 2277 // test, and only on the bots.
2278 const Extension* extension = 2278 const Extension* extension =
(...skipping 1157 matching lines...) Expand 10 before | Expand all | Expand 10 after
3436 } 3436 }
3437 if (!args->GetBoolean("with_ui", &with_ui)) { 3437 if (!args->GetBoolean("with_ui", &with_ui)) {
3438 AutomationJSONReply(this, reply_message).SendError( 3438 AutomationJSONReply(this, reply_message).SendError(
3439 "Missing or invalid 'with_ui'"); 3439 "Missing or invalid 'with_ui'");
3440 return; 3440 return;
3441 } 3441 }
3442 args->GetBoolean("from_webstore", &from_webstore); 3442 args->GetBoolean("from_webstore", &from_webstore);
3443 3443
3444 ExtensionService* service = extensions::ExtensionSystem::Get( 3444 ExtensionService* service = extensions::ExtensionSystem::Get(
3445 browser->profile())->extension_service(); 3445 browser->profile())->extension_service();
3446 ExtensionProcessManager* manager = 3446 extensions::ProcessManager* manager =
3447 extensions::ExtensionSystem::Get(browser->profile())->process_manager(); 3447 extensions::ExtensionSystem::Get(browser->profile())->process_manager();
3448 if (service && manager) { 3448 if (service && manager) {
3449 // The observer will delete itself when done. 3449 // The observer will delete itself when done.
3450 new ExtensionReadyNotificationObserver( 3450 new ExtensionReadyNotificationObserver(
3451 manager, 3451 manager,
3452 service, 3452 service,
3453 this, 3453 this,
3454 reply_message); 3454 reply_message);
3455 3455
3456 base::FilePath extension_path(path_string); 3456 base::FilePath extension_path(path_string);
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
3649 3649
3650 if (allow_in_incognito && !enable) { 3650 if (allow_in_incognito && !enable) {
3651 AutomationJSONReply(this, reply_message) 3651 AutomationJSONReply(this, reply_message)
3652 .SendError("Invalid state: Disabled extension " 3652 .SendError("Invalid state: Disabled extension "
3653 "cannot be allowed in incognito mode."); 3653 "cannot be allowed in incognito mode.");
3654 return; 3654 return;
3655 } 3655 }
3656 3656
3657 ExtensionService* service = extensions::ExtensionSystem::Get( 3657 ExtensionService* service = extensions::ExtensionSystem::Get(
3658 browser->profile())->extension_service(); 3658 browser->profile())->extension_service();
3659 ExtensionProcessManager* manager = 3659 extensions::ProcessManager* manager =
3660 extensions::ExtensionSystem::Get(browser->profile())->process_manager(); 3660 extensions::ExtensionSystem::Get(browser->profile())->process_manager();
3661 if (!service) { 3661 if (!service) {
3662 AutomationJSONReply(this, reply_message) 3662 AutomationJSONReply(this, reply_message)
3663 .SendError("No extensions service or process manager."); 3663 .SendError("No extensions service or process manager.");
3664 return; 3664 return;
3665 } 3665 }
3666 3666
3667 if (enable) { 3667 if (enable) {
3668 if (!service->IsExtensionEnabled(extension->id())) { 3668 if (!service->IsExtensionEnabled(extension->id())) {
3669 new ExtensionReadyNotificationObserver( 3669 new ExtensionReadyNotificationObserver(
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
3880 return; 3880 return;
3881 } 3881 }
3882 3882
3883 extensions::ExtensionUpdater* updater = service->updater(); 3883 extensions::ExtensionUpdater* updater = service->updater();
3884 if (!updater) { 3884 if (!updater) {
3885 AutomationJSONReply(this, reply_message).SendError( 3885 AutomationJSONReply(this, reply_message).SendError(
3886 "No updater for extensions service."); 3886 "No updater for extensions service.");
3887 return; 3887 return;
3888 } 3888 }
3889 3889
3890 ExtensionProcessManager* manager = 3890 extensions::ProcessManager* manager =
3891 extensions::ExtensionSystem::Get(browser->profile())->process_manager(); 3891 extensions::ExtensionSystem::Get(browser->profile())->process_manager();
3892 if (!manager) { 3892 if (!manager) {
3893 AutomationJSONReply(this, reply_message).SendError( 3893 AutomationJSONReply(this, reply_message).SendError(
3894 "No extension process manager."); 3894 "No extension process manager.");
3895 return; 3895 return;
3896 } 3896 }
3897 3897
3898 // Create a new observer that waits until the extensions have been fully 3898 // Create a new observer that waits until the extensions have been fully
3899 // updated (we should not send the reply until after all extensions have 3899 // updated (we should not send the reply until after all extensions have
3900 // been updated). This observer will delete itself. 3900 // been updated). This observer will delete itself.
(...skipping 1551 matching lines...) Expand 10 before | Expand all | Expand 10 after
5452 if (g_browser_process) 5452 if (g_browser_process)
5453 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); 5453 g_browser_process->GetAutomationProviderList()->RemoveProvider(this);
5454 } 5454 }
5455 5455
5456 void TestingAutomationProvider::EnsureTabSelected(Browser* browser, 5456 void TestingAutomationProvider::EnsureTabSelected(Browser* browser,
5457 WebContents* tab) { 5457 WebContents* tab) {
5458 TabStripModel* tab_strip = browser->tab_strip_model(); 5458 TabStripModel* tab_strip = browser->tab_strip_model();
5459 if (tab_strip->GetActiveWebContents() != tab) 5459 if (tab_strip->GetActiveWebContents() != tab)
5460 tab_strip->ActivateTabAt(tab_strip->GetIndexOfWebContents(tab), true); 5460 tab_strip->ActivateTabAt(tab_strip->GetIndexOfWebContents(tab), true);
5461 } 5461 }
OLDNEW
« no previous file with comments | « chrome/browser/automation/automation_util.cc ('k') | chrome/browser/chrome_content_browser_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698