| 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 #include "chrome/common/automation_constants.h" | 120 #include "chrome/common/automation_constants.h" |
| 121 #include "chrome/common/automation_events.h" | 121 #include "chrome/common/automation_events.h" |
| 122 #include "chrome/common/automation_id.h" | 122 #include "chrome/common/automation_id.h" |
| 123 #include "chrome/common/automation_messages.h" | 123 #include "chrome/common/automation_messages.h" |
| 124 #include "chrome/common/chrome_constants.h" | 124 #include "chrome/common/chrome_constants.h" |
| 125 #include "chrome/common/chrome_notification_types.h" | 125 #include "chrome/common/chrome_notification_types.h" |
| 126 #include "chrome/common/chrome_paths.h" | 126 #include "chrome/common/chrome_paths.h" |
| 127 #include "chrome/common/chrome_switches.h" | 127 #include "chrome/common/chrome_switches.h" |
| 128 #include "chrome/common/extensions/extension.h" | 128 #include "chrome/common/extensions/extension.h" |
| 129 #include "chrome/common/extensions/permissions/permission_set.h" | 129 #include "chrome/common/extensions/permissions/permission_set.h" |
| 130 #include "chrome/common/extensions/url_pattern_set.h" | |
| 131 #include "chrome/common/pref_names.h" | 130 #include "chrome/common/pref_names.h" |
| 132 #include "chrome/common/render_messages.h" | 131 #include "chrome/common/render_messages.h" |
| 133 #include "content/public/browser/browser_child_process_host_iterator.h" | 132 #include "content/public/browser/browser_child_process_host_iterator.h" |
| 134 #include "content/public/browser/child_process_data.h" | 133 #include "content/public/browser/child_process_data.h" |
| 135 #include "content/public/browser/favicon_status.h" | 134 #include "content/public/browser/favicon_status.h" |
| 136 #include "content/public/browser/geolocation.h" | 135 #include "content/public/browser/geolocation.h" |
| 137 #include "content/public/browser/interstitial_page.h" | 136 #include "content/public/browser/interstitial_page.h" |
| 138 #include "content/public/browser/interstitial_page_delegate.h" | 137 #include "content/public/browser/interstitial_page_delegate.h" |
| 139 #include "content/public/browser/navigation_entry.h" | 138 #include "content/public/browser/navigation_entry.h" |
| 140 #include "content/public/browser/notification_service.h" | 139 #include "content/public/browser/notification_service.h" |
| 141 #include "content/public/browser/plugin_service.h" | 140 #include "content/public/browser/plugin_service.h" |
| 142 #include "content/public/browser/render_process_host.h" | 141 #include "content/public/browser/render_process_host.h" |
| 143 #include "content/public/browser/render_view_host.h" | 142 #include "content/public/browser/render_view_host.h" |
| 144 #include "content/public/browser/render_widget_host_view.h" | 143 #include "content/public/browser/render_widget_host_view.h" |
| 145 #include "content/public/browser/web_contents.h" | 144 #include "content/public/browser/web_contents.h" |
| 146 #include "content/public/common/child_process_host.h" | 145 #include "content/public/common/child_process_host.h" |
| 147 #include "content/public/common/common_param_traits.h" | 146 #include "content/public/common/common_param_traits.h" |
| 148 #include "content/public/common/geoposition.h" | 147 #include "content/public/common/geoposition.h" |
| 149 #include "content/public/common/ssl_status.h" | 148 #include "content/public/common/ssl_status.h" |
| 150 #include "extensions/common/url_pattern.h" | 149 #include "extensions/common/url_pattern.h" |
| 150 #include "extensions/common/url_pattern_set.h" |
| 151 #include "net/cookies/cookie_store.h" | 151 #include "net/cookies/cookie_store.h" |
| 152 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" | 152 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" |
| 153 #include "ui/base/events/event_constants.h" | 153 #include "ui/base/events/event_constants.h" |
| 154 #include "ui/base/keycodes/keyboard_codes.h" | 154 #include "ui/base/keycodes/keyboard_codes.h" |
| 155 #include "ui/base/ui_base_types.h" | 155 #include "ui/base/ui_base_types.h" |
| 156 #include "ui/ui_controls/ui_controls.h" | 156 #include "ui/ui_controls/ui_controls.h" |
| 157 #include "webkit/glue/webdropdata.h" | 157 #include "webkit/glue/webdropdata.h" |
| 158 #include "webkit/plugins/webplugininfo.h" | 158 #include "webkit/plugins/webplugininfo.h" |
| 159 | 159 |
| 160 #if defined(ENABLE_CONFIGURATION_POLICY) | 160 #if defined(ENABLE_CONFIGURATION_POLICY) |
| (...skipping 3567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3728 } | 3728 } |
| 3729 } else { | 3729 } else { |
| 3730 AutomationJSONReply(this, reply_message).SendError( | 3730 AutomationJSONReply(this, reply_message).SendError( |
| 3731 "Extensions service/process manager is not available"); | 3731 "Extensions service/process manager is not available"); |
| 3732 } | 3732 } |
| 3733 } | 3733 } |
| 3734 | 3734 |
| 3735 namespace { | 3735 namespace { |
| 3736 | 3736 |
| 3737 ListValue* GetHostPermissions(const Extension* ext, bool effective_perm) { | 3737 ListValue* GetHostPermissions(const Extension* ext, bool effective_perm) { |
| 3738 URLPatternSet pattern_set; | 3738 extensions::URLPatternSet pattern_set; |
| 3739 if (effective_perm) | 3739 if (effective_perm) |
| 3740 pattern_set = ext->GetEffectiveHostPermissions(); | 3740 pattern_set = ext->GetEffectiveHostPermissions(); |
| 3741 else | 3741 else |
| 3742 pattern_set = ext->GetActivePermissions()->explicit_hosts(); | 3742 pattern_set = ext->GetActivePermissions()->explicit_hosts(); |
| 3743 | 3743 |
| 3744 ListValue* permissions = new ListValue; | 3744 ListValue* permissions = new ListValue; |
| 3745 for (URLPatternSet::const_iterator perm = pattern_set.begin(); | 3745 for (extensions::URLPatternSet::const_iterator perm = pattern_set.begin(); |
| 3746 perm != pattern_set.end(); ++perm) { | 3746 perm != pattern_set.end(); ++perm) { |
| 3747 permissions->Append(new StringValue(perm->GetAsString())); | 3747 permissions->Append(new StringValue(perm->GetAsString())); |
| 3748 } | 3748 } |
| 3749 | 3749 |
| 3750 return permissions; | 3750 return permissions; |
| 3751 } | 3751 } |
| 3752 | 3752 |
| 3753 ListValue* GetAPIPermissions(const Extension* ext) { | 3753 ListValue* GetAPIPermissions(const Extension* ext) { |
| 3754 ListValue* permissions = new ListValue; | 3754 ListValue* permissions = new ListValue; |
| 3755 std::set<std::string> perm_list = | 3755 std::set<std::string> perm_list = |
| (...skipping 2589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6345 void TestingAutomationProvider::OnRemoveProvider() { | 6345 void TestingAutomationProvider::OnRemoveProvider() { |
| 6346 if (g_browser_process) | 6346 if (g_browser_process) |
| 6347 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); | 6347 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); |
| 6348 } | 6348 } |
| 6349 | 6349 |
| 6350 void TestingAutomationProvider::EnsureTabSelected(Browser* browser, | 6350 void TestingAutomationProvider::EnsureTabSelected(Browser* browser, |
| 6351 WebContents* tab) { | 6351 WebContents* tab) { |
| 6352 if (chrome::GetActiveWebContents(browser) != tab) | 6352 if (chrome::GetActiveWebContents(browser) != tab) |
| 6353 chrome::ActivateTabAt(browser, chrome::GetIndexOfTab(browser, tab), true); | 6353 chrome::ActivateTabAt(browser, chrome::GetIndexOfTab(browser, tab), true); |
| 6354 } | 6354 } |
| OLD | NEW |