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

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

Issue 10375021: Move Extension into extensions namespace (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Take 6 Created 8 years, 7 months 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
OLDNEW
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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 using content::InterstitialPage; 180 using content::InterstitialPage;
181 using content::NativeWebKeyboardEvent; 181 using content::NativeWebKeyboardEvent;
182 using content::NavigationController; 182 using content::NavigationController;
183 using content::NavigationEntry; 183 using content::NavigationEntry;
184 using content::PluginService; 184 using content::PluginService;
185 using content::OpenURLParams; 185 using content::OpenURLParams;
186 using content::Referrer; 186 using content::Referrer;
187 using content::RenderViewHost; 187 using content::RenderViewHost;
188 using content::SSLStatus; 188 using content::SSLStatus;
189 using content::WebContents; 189 using content::WebContents;
190 using extensions::Extension;
191 using extensions::ExtensionList;
190 192
191 namespace { 193 namespace {
192 194
193 // Helper to reply asynchronously if |automation| is still valid. 195 // Helper to reply asynchronously if |automation| is still valid.
194 void SendSuccessReply(base::WeakPtr<AutomationProvider> automation, 196 void SendSuccessReply(base::WeakPtr<AutomationProvider> automation,
195 IPC::Message* reply_message) { 197 IPC::Message* reply_message) {
196 if (automation) 198 if (automation)
197 AutomationJSONReply(automation.get(), reply_message).SendSuccess(NULL); 199 AutomationJSONReply(automation.get(), reply_message).SendSuccess(NULL);
198 } 200 }
199 201
(...skipping 3791 matching lines...) Expand 10 before | Expand all | Expand 10 after
3991 permissions->Append(new StringValue(perm->c_str())); 3993 permissions->Append(new StringValue(perm->c_str()));
3992 } 3994 }
3993 return permissions; 3995 return permissions;
3994 } 3996 }
3995 3997
3996 } // namespace 3998 } // namespace
3997 3999
3998 // Sample json input: { "command": "GetExtensionsInfo" } 4000 // Sample json input: { "command": "GetExtensionsInfo" }
3999 // See GetExtensionsInfo() in chrome/test/pyautolib/pyauto.py for sample json 4001 // See GetExtensionsInfo() in chrome/test/pyautolib/pyauto.py for sample json
4000 // output. 4002 // output.
4001 void TestingAutomationProvider::GetExtensionsInfo( 4003 void TestingAutomationProvider::GetExtensionsInfo(DictionaryValue* args,
4002 DictionaryValue* args, 4004 IPC::Message* reply_message) {
4003 IPC::Message* reply_message) {
4004 AutomationJSONReply reply(this, reply_message); 4005 AutomationJSONReply reply(this, reply_message);
4005 Browser* browser; 4006 Browser* browser;
4006 std::string error_msg; 4007 std::string error_msg;
4007 if (!GetBrowserFromJSONArgs(args, &browser, &error_msg)) { 4008 if (!GetBrowserFromJSONArgs(args, &browser, &error_msg)) {
4008 reply.SendError(error_msg); 4009 reply.SendError(error_msg);
4009 return; 4010 return;
4010 } 4011 }
4011 ExtensionService* service = browser->profile()->GetExtensionService(); 4012 ExtensionService* service = browser->profile()->GetExtensionService();
4012 if (!service) { 4013 if (!service) {
4013 reply.SendError("No extensions service."); 4014 reply.SendError("No extensions service.");
(...skipping 25 matching lines...) Expand all
4039 extension_value->SetString("options_url", 4040 extension_value->SetString("options_url",
4040 extension->options_url().spec()); 4041 extension->options_url().spec());
4041 extension_value->Set("host_permissions", 4042 extension_value->Set("host_permissions",
4042 GetHostPermissions(extension, false)); 4043 GetHostPermissions(extension, false));
4043 extension_value->Set("effective_host_permissions", 4044 extension_value->Set("effective_host_permissions",
4044 GetHostPermissions(extension, true)); 4045 GetHostPermissions(extension, true));
4045 extension_value->Set("api_permissions", GetAPIPermissions(extension)); 4046 extension_value->Set("api_permissions", GetAPIPermissions(extension));
4046 Extension::Location location = extension->location(); 4047 Extension::Location location = extension->location();
4047 extension_value->SetBoolean("is_component", 4048 extension_value->SetBoolean("is_component",
4048 location == Extension::COMPONENT); 4049 location == Extension::COMPONENT);
4049 extension_value->SetBoolean("is_internal", location == Extension::INTERNAL); 4050 extension_value->SetBoolean("is_internal",
4051 location == Extension::INTERNAL);
4050 extension_value->SetBoolean("is_user_installed", 4052 extension_value->SetBoolean("is_user_installed",
4051 location == Extension::INTERNAL || location == Extension::LOAD); 4053 location == Extension::INTERNAL ||
4054 location == Extension::LOAD);
4052 extension_value->SetBoolean("is_enabled", service->IsExtensionEnabled(id)); 4055 extension_value->SetBoolean("is_enabled", service->IsExtensionEnabled(id));
4053 extension_value->SetBoolean("allowed_in_incognito", 4056 extension_value->SetBoolean("allowed_in_incognito",
4054 service->IsIncognitoEnabled(id)); 4057 service->IsIncognitoEnabled(id));
4055 extension_value->SetBoolean("has_page_action", 4058 extension_value->SetBoolean("has_page_action",
4056 extension->page_action() != NULL); 4059 extension->page_action() != NULL);
4057 extensions_values->Append(extension_value); 4060 extensions_values->Append(extension_value);
4058 } 4061 }
4059 return_value->Set("extensions", extensions_values); 4062 return_value->Set("extensions", extensions_values);
4060 reply.SendSuccess(return_value.get()); 4063 reply.SendSuccess(return_value.get());
4061 } 4064 }
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
4144 new ExtensionReadyNotificationObserver( 4147 new ExtensionReadyNotificationObserver(
4145 manager, 4148 manager,
4146 service, 4149 service,
4147 this, 4150 this,
4148 reply_message); 4151 reply_message);
4149 service->EnableExtension(extension->id()); 4152 service->EnableExtension(extension->id());
4150 } else { 4153 } else {
4151 AutomationJSONReply(this, reply_message).SendSuccess(NULL); 4154 AutomationJSONReply(this, reply_message).SendSuccess(NULL);
4152 } 4155 }
4153 } else { 4156 } else {
4154 service->DisableExtension(extension->id(), Extension::DISABLE_USER_ACTION); 4157 service->DisableExtension(extension->id(),
4158 Extension::DISABLE_USER_ACTION);
4155 AutomationJSONReply(this, reply_message).SendSuccess(NULL); 4159 AutomationJSONReply(this, reply_message).SendSuccess(NULL);
4156 } 4160 }
4157 4161
4158 service->SetIsIncognitoEnabled(extension->id(), allow_in_incognito); 4162 service->SetIsIncognitoEnabled(extension->id(), allow_in_incognito);
4159 } 4163 }
4160 4164
4161 namespace { 4165 namespace {
4162 4166
4163 // Selects the given |browser| and |tab| if not selected already. 4167 // Selects the given |browser| and |tab| if not selected already.
4164 void EnsureTabSelected(Browser* browser, WebContents* tab) { 4168 void EnsureTabSelected(Browser* browser, WebContents* tab) {
(...skipping 2401 matching lines...) Expand 10 before | Expand all | Expand 10 after
6566 6570
6567 void TestingAutomationProvider::WaitForProcessLauncherThreadToGoIdle( 6571 void TestingAutomationProvider::WaitForProcessLauncherThreadToGoIdle(
6568 IPC::Message* reply_message) { 6572 IPC::Message* reply_message) {
6569 new WaitForProcessLauncherThreadToGoIdleObserver(this, reply_message); 6573 new WaitForProcessLauncherThreadToGoIdleObserver(this, reply_message);
6570 } 6574 }
6571 6575
6572 void TestingAutomationProvider::OnRemoveProvider() { 6576 void TestingAutomationProvider::OnRemoveProvider() {
6573 if (g_browser_process) 6577 if (g_browser_process)
6574 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); 6578 g_browser_process->GetAutomationProviderList()->RemoveProvider(this);
6575 } 6579 }
OLDNEW
« no previous file with comments | « chrome/browser/automation/automation_util.cc ('k') | chrome/browser/background/background_application_list_model.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698