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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 using content::NavigationEntry; | 180 using content::NavigationEntry; |
181 using content::OpenURLParams; | 181 using content::OpenURLParams; |
182 using content::PluginService; | 182 using content::PluginService; |
183 using content::Referrer; | 183 using content::Referrer; |
184 using content::RenderViewHost; | 184 using content::RenderViewHost; |
185 using content::SSLStatus; | 185 using content::SSLStatus; |
186 using content::WebContents; | 186 using content::WebContents; |
187 using extensions::Extension; | 187 using extensions::Extension; |
188 using extensions::ExtensionActionManager; | 188 using extensions::ExtensionActionManager; |
189 using extensions::ExtensionList; | 189 using extensions::ExtensionList; |
| 190 using extensions::Manifest; |
190 | 191 |
191 namespace { | 192 namespace { |
192 | 193 |
193 // Helper to reply asynchronously if |automation| is still valid. | 194 // Helper to reply asynchronously if |automation| is still valid. |
194 void SendSuccessReply(base::WeakPtr<AutomationProvider> automation, | 195 void SendSuccessReply(base::WeakPtr<AutomationProvider> automation, |
195 IPC::Message* reply_message) { | 196 IPC::Message* reply_message) { |
196 if (automation) | 197 if (automation) |
197 AutomationJSONReply(automation.get(), reply_message).SendSuccess(NULL); | 198 AutomationJSONReply(automation.get(), reply_message).SendSuccess(NULL); |
198 } | 199 } |
199 | 200 |
(...skipping 3497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3697 extension_value->SetString("description", extension->description()); | 3698 extension_value->SetString("description", extension->description()); |
3698 extension_value->SetString("background_url", | 3699 extension_value->SetString("background_url", |
3699 extension->GetBackgroundURL().spec()); | 3700 extension->GetBackgroundURL().spec()); |
3700 extension_value->SetString("options_url", | 3701 extension_value->SetString("options_url", |
3701 extensions::ManifestURL::GetOptionsPage(extension).spec()); | 3702 extensions::ManifestURL::GetOptionsPage(extension).spec()); |
3702 extension_value->Set("host_permissions", | 3703 extension_value->Set("host_permissions", |
3703 GetHostPermissions(extension, false)); | 3704 GetHostPermissions(extension, false)); |
3704 extension_value->Set("effective_host_permissions", | 3705 extension_value->Set("effective_host_permissions", |
3705 GetHostPermissions(extension, true)); | 3706 GetHostPermissions(extension, true)); |
3706 extension_value->Set("api_permissions", GetAPIPermissions(extension)); | 3707 extension_value->Set("api_permissions", GetAPIPermissions(extension)); |
3707 Extension::Location location = extension->location(); | 3708 Manifest::Location location = extension->location(); |
3708 extension_value->SetBoolean("is_component", | 3709 extension_value->SetBoolean("is_component", |
3709 location == Extension::COMPONENT); | 3710 location == Manifest::COMPONENT); |
3710 extension_value->SetBoolean("is_internal", | 3711 extension_value->SetBoolean("is_internal", |
3711 location == Extension::INTERNAL); | 3712 location == Manifest::INTERNAL); |
3712 extension_value->SetBoolean("is_user_installed", | 3713 extension_value->SetBoolean("is_user_installed", |
3713 location == Extension::INTERNAL || | 3714 location == Manifest::INTERNAL || |
3714 location == Extension::LOAD); | 3715 location == Manifest::LOAD); |
3715 extension_value->SetBoolean("is_enabled", service->IsExtensionEnabled(id)); | 3716 extension_value->SetBoolean("is_enabled", service->IsExtensionEnabled(id)); |
3716 extension_value->SetBoolean("allowed_in_incognito", | 3717 extension_value->SetBoolean("allowed_in_incognito", |
3717 service->IsIncognitoEnabled(id)); | 3718 service->IsIncognitoEnabled(id)); |
3718 extension_value->SetBoolean( | 3719 extension_value->SetBoolean( |
3719 "has_page_action", | 3720 "has_page_action", |
3720 extension_action_manager->GetPageAction(*extension) != NULL); | 3721 extension_action_manager->GetPageAction(*extension) != NULL); |
3721 extensions_values->Append(extension_value); | 3722 extensions_values->Append(extension_value); |
3722 } | 3723 } |
3723 return_value->Set("extensions", extensions_values); | 3724 return_value->Set("extensions", extensions_values); |
3724 reply.SendSuccess(return_value.get()); | 3725 reply.SendSuccess(return_value.get()); |
(...skipping 2229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5954 if (g_browser_process) | 5955 if (g_browser_process) |
5955 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); | 5956 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); |
5956 } | 5957 } |
5957 | 5958 |
5958 void TestingAutomationProvider::EnsureTabSelected(Browser* browser, | 5959 void TestingAutomationProvider::EnsureTabSelected(Browser* browser, |
5959 WebContents* tab) { | 5960 WebContents* tab) { |
5960 TabStripModel* tab_strip = browser->tab_strip_model(); | 5961 TabStripModel* tab_strip = browser->tab_strip_model(); |
5961 if (tab_strip->GetActiveWebContents() != tab) | 5962 if (tab_strip->GetActiveWebContents() != tab) |
5962 tab_strip->ActivateTabAt(tab_strip->GetIndexOfWebContents(tab), true); | 5963 tab_strip->ActivateTabAt(tab_strip->GetIndexOfWebContents(tab), true); |
5963 } | 5964 } |
OLD | NEW |