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 3883 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3894 reply.SendSuccess(NULL); | 3894 reply.SendSuccess(NULL); |
3895 } | 3895 } |
3896 | 3896 |
3897 // Sample json input: { "command": "GetThemeInfo" } | 3897 // Sample json input: { "command": "GetThemeInfo" } |
3898 // Refer GetThemeInfo() in chrome/test/pyautolib/pyauto.py for sample output. | 3898 // Refer GetThemeInfo() in chrome/test/pyautolib/pyauto.py for sample output. |
3899 void TestingAutomationProvider::GetThemeInfo( | 3899 void TestingAutomationProvider::GetThemeInfo( |
3900 Browser* browser, | 3900 Browser* browser, |
3901 DictionaryValue* args, | 3901 DictionaryValue* args, |
3902 IPC::Message* reply_message) { | 3902 IPC::Message* reply_message) { |
3903 scoped_ptr<DictionaryValue> return_value(new DictionaryValue); | 3903 scoped_ptr<DictionaryValue> return_value(new DictionaryValue); |
3904 const Extension* theme = ThemeServiceFactory::GetThemeForProfile(profile()); | 3904 const Extension* theme = |
Yoyo Zhou
2012/05/23 23:17:49
nit: This change looks spurious.
Jay Civelli
2012/05/30 20:20:35
Done.
| |
3905 ThemeServiceFactory::GetThemeForProfile(profile()); | |
3905 if (theme) { | 3906 if (theme) { |
3906 return_value->SetString("name", theme->name()); | 3907 return_value->SetString("name", theme->name()); |
3907 return_value->Set("images", theme->GetThemeImages()->DeepCopy()); | 3908 return_value->Set("images", theme->GetThemeImages()->DeepCopy()); |
3908 return_value->Set("colors", theme->GetThemeColors()->DeepCopy()); | 3909 return_value->Set("colors", theme->GetThemeColors()->DeepCopy()); |
3909 return_value->Set("tints", theme->GetThemeTints()->DeepCopy()); | 3910 return_value->Set("tints", theme->GetThemeTints()->DeepCopy()); |
3910 } | 3911 } |
3911 AutomationJSONReply(this, reply_message).SendSuccess(return_value.get()); | 3912 AutomationJSONReply(this, reply_message).SendSuccess(return_value.get()); |
3912 } | 3913 } |
3913 | 3914 |
3914 void TestingAutomationProvider::InstallExtension( | 3915 void TestingAutomationProvider::InstallExtension( |
(...skipping 24 matching lines...) Expand all Loading... | |
3939 new ExtensionReadyNotificationObserver( | 3940 new ExtensionReadyNotificationObserver( |
3940 manager, | 3941 manager, |
3941 service, | 3942 service, |
3942 this, | 3943 this, |
3943 reply_message); | 3944 reply_message); |
3944 | 3945 |
3945 FilePath extension_path(path_string); | 3946 FilePath extension_path(path_string); |
3946 // If the given path has a 'crx' extension, assume it is a packed extension | 3947 // If the given path has a 'crx' extension, assume it is a packed extension |
3947 // and install it. Otherwise load it as an unpacked extension. | 3948 // and install it. Otherwise load it as an unpacked extension. |
3948 if (extension_path.MatchesExtension(FILE_PATH_LITERAL(".crx"))) { | 3949 if (extension_path.MatchesExtension(FILE_PATH_LITERAL(".crx"))) { |
3949 ExtensionInstallUI* client = | 3950 ExtensionInstallPrompt* client = |
3950 (with_ui ? new ExtensionInstallUI(browser->profile()) : NULL); | 3951 (with_ui ? new ExtensionInstallPrompt(browser->profile()) : NULL); |
3951 scoped_refptr<CrxInstaller> installer( | 3952 scoped_refptr<CrxInstaller> installer( |
3952 CrxInstaller::Create(service, client)); | 3953 CrxInstaller::Create(service, client)); |
3953 if (!with_ui) | 3954 if (!with_ui) |
3954 installer->set_allow_silent_install(true); | 3955 installer->set_allow_silent_install(true); |
3955 installer->set_install_cause(extension_misc::INSTALL_CAUSE_AUTOMATION); | 3956 installer->set_install_cause(extension_misc::INSTALL_CAUSE_AUTOMATION); |
3956 installer->InstallCrx(extension_path); | 3957 installer->InstallCrx(extension_path); |
3957 } else { | 3958 } else { |
3958 scoped_refptr<extensions::UnpackedInstaller> installer( | 3959 scoped_refptr<extensions::UnpackedInstaller> installer( |
3959 extensions::UnpackedInstaller::Create(service)); | 3960 extensions::UnpackedInstaller::Create(service)); |
3960 installer->set_prompt_for_plugins(with_ui); | 3961 installer->set_prompt_for_plugins(with_ui); |
(...skipping 2609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6570 | 6571 |
6571 void TestingAutomationProvider::WaitForProcessLauncherThreadToGoIdle( | 6572 void TestingAutomationProvider::WaitForProcessLauncherThreadToGoIdle( |
6572 IPC::Message* reply_message) { | 6573 IPC::Message* reply_message) { |
6573 new WaitForProcessLauncherThreadToGoIdleObserver(this, reply_message); | 6574 new WaitForProcessLauncherThreadToGoIdleObserver(this, reply_message); |
6574 } | 6575 } |
6575 | 6576 |
6576 void TestingAutomationProvider::OnRemoveProvider() { | 6577 void TestingAutomationProvider::OnRemoveProvider() { |
6577 if (g_browser_process) | 6578 if (g_browser_process) |
6578 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); | 6579 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); |
6579 } | 6580 } |
OLD | NEW |