diff options
Diffstat (limited to 'chrome/browser/extensions')
10 files changed, 44 insertions, 36 deletions
diff --git a/chrome/browser/extensions/api/command_line_private/command_line_private_apitest.cc b/chrome/browser/extensions/api/command_line_private/command_line_private_apitest.cc index f8fe90d..ec14fd3 100644 --- a/chrome/browser/extensions/api/command_line_private/command_line_private_apitest.cc +++ b/chrome/browser/extensions/api/command_line_private/command_line_private_apitest.cc @@ -12,7 +12,7 @@ const char kTestCommandLineSwitch[] = "command-line-private-api-test-foo"; } // namespace class CommandLinePrivateApiTest : public ExtensionApiTest { - virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { + virtual void SetUpCommandLine(base::CommandLine* command_line) OVERRIDE { ExtensionApiTest::SetUpCommandLine(command_line); command_line->AppendSwitch(kTestCommandLineSwitch); } diff --git a/chrome/browser/extensions/api/messaging/native_process_launcher.h b/chrome/browser/extensions/api/messaging/native_process_launcher.h index 601823d..6694bdc 100644 --- a/chrome/browser/extensions/api/messaging/native_process_launcher.h +++ b/chrome/browser/extensions/api/messaging/native_process_launcher.h @@ -11,10 +11,10 @@ #include "base/process/process.h" #include "ui/gfx/native_widget_types.h" -class CommandLine; class GURL; namespace base { +class CommandLine; class FilePath; } @@ -67,7 +67,7 @@ class NativeProcessLauncher { std::string* error_message); // Launches native messaging process. - static bool LaunchNativeProcess(const CommandLine& command_line, + static bool LaunchNativeProcess(const base::CommandLine& command_line, base::ProcessHandle* process_handle, base::PlatformFile* read_file, base::PlatformFile* write_file); diff --git a/chrome/browser/extensions/chrome_extensions_browser_client.h b/chrome/browser/extensions/chrome_extensions_browser_client.h index c81edf4..b720897 100644 --- a/chrome/browser/extensions/chrome_extensions_browser_client.h +++ b/chrome/browser/extensions/chrome_extensions_browser_client.h @@ -12,7 +12,9 @@ #include "chrome/browser/extensions/chrome_notification_observer.h" #include "extensions/browser/extensions_browser_client.h" +namespace base { class CommandLine; +} namespace content { class BrowserContext; @@ -35,7 +37,7 @@ class ChromeExtensionsBrowserClient : public ExtensionsBrowserClient { // BrowserClient overrides: virtual bool IsShuttingDown() OVERRIDE; - virtual bool AreExtensionsDisabled(const CommandLine& command_line, + virtual bool AreExtensionsDisabled(const base::CommandLine& command_line, content::BrowserContext* context) OVERRIDE; virtual bool IsValidContext(content::BrowserContext* context) OVERRIDE; virtual bool IsSameContext(content::BrowserContext* first, diff --git a/chrome/browser/extensions/extension_apitest.h b/chrome/browser/extensions/extension_apitest.h index a6518c6..1978b87 100644 --- a/chrome/browser/extensions/extension_apitest.h +++ b/chrome/browser/extensions/extension_apitest.h @@ -188,7 +188,7 @@ class ExtensionApiTest : public ExtensionBrowserTest { const extensions::Extension* GetSingleLoadedExtension(); // All extensions tested by ExtensionApiTest are in the "api_test" dir. - virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE; + virtual void SetUpCommandLine(base::CommandLine* command_line) OVERRIDE; // If it failed, what was the error message? std::string message_; diff --git a/chrome/browser/extensions/extension_browsertest.h b/chrome/browser/extensions/extension_browsertest.h index 0588a21..67c32cd 100644 --- a/chrome/browser/extensions/extension_browsertest.h +++ b/chrome/browser/extensions/extension_browsertest.h @@ -75,7 +75,7 @@ class ExtensionBrowserTest : virtual public InProcessBrowserTest { // InProcessBrowserTest virtual void SetUp() OVERRIDE; - virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE; + virtual void SetUpCommandLine(base::CommandLine* command_line) OVERRIDE; virtual void SetUpOnMainThread() OVERRIDE; const extensions::Extension* LoadExtension(const base::FilePath& path); diff --git a/chrome/browser/extensions/extension_service.h b/chrome/browser/extensions/extension_service.h index 6a859c5c..5956f48 100644 --- a/chrome/browser/extensions/extension_service.h +++ b/chrome/browser/extensions/extension_service.h @@ -36,13 +36,13 @@ #include "extensions/common/manifest_handlers/shared_module_info.h" #include "extensions/common/one_shot_event.h" -class CommandLine; class ExtensionErrorUI; class ExtensionToolbarModel; class GURL; class Profile; namespace base { +class CommandLine; class SequencedTaskRunner; class Version; } @@ -152,7 +152,7 @@ class ExtensionService // Constructor stores pointers to |profile| and |extension_prefs| but // ownership remains at caller. ExtensionService(Profile* profile, - const CommandLine* command_line, + const base::CommandLine* command_line, const base::FilePath& install_directory, extensions::ExtensionPrefs* extension_prefs, extensions::Blacklist* blacklist, diff --git a/chrome/browser/extensions/startup_helper.h b/chrome/browser/extensions/startup_helper.h index 6844194..9efb7cb 100644 --- a/chrome/browser/extensions/startup_helper.h +++ b/chrome/browser/extensions/startup_helper.h @@ -8,9 +8,12 @@ #include "base/memory/ref_counted.h" #include "chrome/browser/extensions/pack_extension_job.h" -class CommandLine; class Profile; +namespace base { +class CommandLine; +} + namespace extensions { // Initialization helpers for various Extension startup actions. @@ -27,23 +30,23 @@ class StartupHelper : public PackExtensionJob::Client { // Handle --pack-extension flag from the |cmd_line| by packing the specified // extension. Returns false if the pack job failed. - bool PackExtension(const CommandLine& cmd_line); + bool PackExtension(const base::CommandLine& cmd_line); // Validates a crx at the path given by the --validate-extension flag - can // it be installed? Returns true if the crx is valid, or false otherwise. // If the return value is false, a description of the problem may be written // into |error|. - bool ValidateCrx(const CommandLine& cmd_line, std::string* error); + bool ValidateCrx(const base::CommandLine& cmd_line, std::string* error); // Handle --uninstall-extension flag from the |cmd_line| by uninstalling the // specified extension from |profile|. Returns false if the uninstall job // could not be started. - bool UninstallExtension(const CommandLine& cmd_line, Profile* profile); + bool UninstallExtension(const base::CommandLine& cmd_line, Profile* profile); // Handle --install-from-webstore flag from |cmd_line| by downloading // metadata from the webstore for the given id, prompting the user to // confirm, and then downloading the crx and installing it. - bool InstallFromWebstore(const CommandLine& cmd_line, Profile* profile); + bool InstallFromWebstore(const base::CommandLine& cmd_line, Profile* profile); // Handle --limited-install-from-webstore flag from |cmd_line| by downloading // metadata from the webstore for the given id, prompting the user to @@ -51,12 +54,14 @@ class StartupHelper : public PackExtensionJob::Client { // This whole process is only kicked off by this function and completed // asynchronously unlike InstallFromWebstore which finishes everything before // returning. - void LimitedInstallFromWebstore(const CommandLine& cmd_line, Profile* profile, + void LimitedInstallFromWebstore(const base::CommandLine& cmd_line, + Profile* profile, base::Callback<void()> done_callback); // Maps the command line argument to the extension id. Returns an empty string // in the case when there is no mapping. - std::string WebStoreIdFromLimitedInstallCmdLine(const CommandLine& cmd_line); + std::string WebStoreIdFromLimitedInstallCmdLine( + const base::CommandLine& cmd_line); private: scoped_refptr<PackExtensionJob> pack_job_; bool pack_job_succeeded_; diff --git a/chrome/browser/extensions/test_extension_system.h b/chrome/browser/extensions/test_extension_system.h index 6732f68..ad5375a 100644 --- a/chrome/browser/extensions/test_extension_system.h +++ b/chrome/browser/extensions/test_extension_system.h @@ -8,11 +8,11 @@ #include "extensions/browser/extension_system.h" #include "extensions/common/one_shot_event.h" -class CommandLine; class Profile; class TestingValueStore; namespace base { +class CommandLine; class FilePath; class Time; } @@ -38,13 +38,13 @@ class TestExtensionSystem : public ExtensionSystem { // Creates an ExtensionPrefs with the testing profile and returns it. // Useful for tests that need to modify prefs before creating the // ExtensionService. - ExtensionPrefs* CreateExtensionPrefs(const CommandLine* command_line, + ExtensionPrefs* CreateExtensionPrefs(const base::CommandLine* command_line, const base::FilePath& install_directory); // Creates an ExtensionService initialized with the testing profile and // returns it, and creates ExtensionPrefs if it hasn't been created yet. ExtensionService* CreateExtensionService( - const CommandLine* command_line, + const base::CommandLine* command_line, const base::FilePath& install_directory, bool autoupdate_enabled); diff --git a/chrome/browser/extensions/webstore_installer_test.h b/chrome/browser/extensions/webstore_installer_test.h index 40518ba..00a7ae8 100644 --- a/chrome/browser/extensions/webstore_installer_test.h +++ b/chrome/browser/extensions/webstore_installer_test.h @@ -23,7 +23,7 @@ class WebstoreInstallerTest : public InProcessBrowserTest { const std::string& unverified_domain); virtual ~WebstoreInstallerTest(); - virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE; + virtual void SetUpCommandLine(base::CommandLine* command_line) OVERRIDE; virtual void SetUpInProcessBrowserTestFixture() OVERRIDE; protected: diff --git a/chrome/browser/extensions/webstore_startup_installer_browsertest.cc b/chrome/browser/extensions/webstore_startup_installer_browsertest.cc index ed5ea91..77443a6 100644 --- a/chrome/browser/extensions/webstore_startup_installer_browsertest.cc +++ b/chrome/browser/extensions/webstore_startup_installer_browsertest.cc @@ -56,7 +56,7 @@ class WebstoreStartupInstallerTest : public WebstoreInstallerTest { }; IN_PROC_BROWSER_TEST_F(WebstoreStartupInstallerTest, Install) { - CommandLine::ForCurrentProcess()->AppendSwitchASCII( + base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( switches::kAppsGalleryInstallAutoConfirmForTests, "accept"); ui_test_utils::NavigateToURL( @@ -71,7 +71,7 @@ IN_PROC_BROWSER_TEST_F(WebstoreStartupInstallerTest, Install) { IN_PROC_BROWSER_TEST_F(WebstoreStartupInstallerTest, InstallNotAllowedFromNonVerifiedDomains) { - CommandLine::ForCurrentProcess()->AppendSwitchASCII( + base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( switches::kAppsGalleryInstallAutoConfirmForTests, "cancel"); ui_test_utils::NavigateToURL( browser(), @@ -91,7 +91,7 @@ IN_PROC_BROWSER_TEST_F(WebstoreStartupInstallerTest, FindLink) { // Flakes on all platforms: http://crbug.com/95713, http://crbug.com/229947 IN_PROC_BROWSER_TEST_F(WebstoreStartupInstallerTest, DISABLED_ArgumentValidation) { - CommandLine::ForCurrentProcess()->AppendSwitchASCII( + base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( switches::kAppsGalleryInstallAutoConfirmForTests, "cancel"); // Each of these tests has to run separately, since one page/tab can @@ -108,7 +108,7 @@ IN_PROC_BROWSER_TEST_F(WebstoreStartupInstallerTest, } IN_PROC_BROWSER_TEST_F(WebstoreStartupInstallerTest, MultipleInstallCalls) { - CommandLine::ForCurrentProcess()->AppendSwitchASCII( + base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( switches::kAppsGalleryInstallAutoConfirmForTests, "cancel"); ui_test_utils::NavigateToURL( @@ -118,7 +118,7 @@ IN_PROC_BROWSER_TEST_F(WebstoreStartupInstallerTest, MultipleInstallCalls) { } IN_PROC_BROWSER_TEST_F(WebstoreStartupInstallerTest, InstallNotSupported) { - CommandLine::ForCurrentProcess()->AppendSwitchASCII( + base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( switches::kAppsGalleryInstallAutoConfirmForTests, "cancel"); ui_test_utils::NavigateToURL( browser(), @@ -138,7 +138,7 @@ IN_PROC_BROWSER_TEST_F(WebstoreStartupInstallerTest, InstallNotSupported) { // Regression test for http://crbug.com/144991. IN_PROC_BROWSER_TEST_F(WebstoreStartupInstallerTest, InstallFromHostedApp) { - CommandLine::ForCurrentProcess()->AppendSwitchASCII( + base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( switches::kAppsGalleryInstallAutoConfirmForTests, "accept"); const GURL kInstallUrl = GenerateTestServerUrl(kAppDomain, "install.html"); @@ -175,7 +175,7 @@ class WebstoreStartupInstallerManagedUsersTest : public WebstoreStartupInstallerTest { public: // InProcessBrowserTest overrides: - virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { + virtual void SetUpCommandLine(base::CommandLine* command_line) OVERRIDE { WebstoreStartupInstallerTest::SetUpCommandLine(command_line); command_line->AppendSwitchASCII(switches::kManagedUserId, "asdf"); } @@ -185,11 +185,12 @@ IN_PROC_BROWSER_TEST_F(WebstoreStartupInstallerManagedUsersTest, InstallProhibited) { #if defined(OS_WIN) && defined(USE_ASH) // Disable this test in Metro+Ash for now (http://crbug.com/262796). - if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) + if (base::CommandLine::ForCurrentProcess()->HasSwitch( + switches::kAshBrowserTests)) return; #endif - CommandLine::ForCurrentProcess()->AppendSwitchASCII( + base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( switches::kAppsGalleryInstallAutoConfirmForTests, "accept"); ui_test_utils::NavigateToURL( @@ -208,12 +209,12 @@ IN_PROC_BROWSER_TEST_F(WebstoreStartupInstallerManagedUsersTest, class WebstoreStartupInstallUnpackFailureTest : public WebstoreStartupInstallerTest { public: - virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { + virtual void SetUpCommandLine(base::CommandLine* command_line) OVERRIDE { WebstoreStartupInstallerTest::SetUpCommandLine(command_line); GURL crx_url = GenerateTestServerUrl( kWebstoreDomain, "malformed_extension.crx"); - CommandLine::ForCurrentProcess()->AppendSwitchASCII( + base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( switches::kAppsGalleryUpdateURL, crx_url.spec()); } @@ -225,7 +226,7 @@ class WebstoreStartupInstallUnpackFailureTest IN_PROC_BROWSER_TEST_F(WebstoreStartupInstallUnpackFailureTest, WebstoreStartupInstallUnpackFailureTest) { - CommandLine::ForCurrentProcess()->AppendSwitchASCII( + base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( switches::kAppsGalleryInstallAutoConfirmForTests, "accept"); ui_test_utils::NavigateToURL(browser(), @@ -280,7 +281,7 @@ class CommandLineWebstoreInstall : public WebstoreStartupInstallerTest, }; IN_PROC_BROWSER_TEST_F(CommandLineWebstoreInstall, Accept) { - CommandLine* command_line = CommandLine::ForCurrentProcess(); + base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); command_line->AppendSwitchASCII( switches::kInstallFromWebstore, kTestExtensionId); command_line->AppendSwitchASCII( @@ -292,7 +293,7 @@ IN_PROC_BROWSER_TEST_F(CommandLineWebstoreInstall, Accept) { } IN_PROC_BROWSER_TEST_F(CommandLineWebstoreInstall, Cancel) { - CommandLine* command_line = CommandLine::ForCurrentProcess(); + base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); command_line->AppendSwitchASCII( switches::kInstallFromWebstore, kTestExtensionId); command_line->AppendSwitchASCII( @@ -308,20 +309,20 @@ IN_PROC_BROWSER_TEST_F(CommandLineWebstoreInstall, LimitedAccept) { // Small test of "WebStoreIdFromLimitedInstallCmdLine" which made more // sense together with the rest of the test for "LimitedInstallFromWebstore". - CommandLine command_line_test1(CommandLine::NO_PROGRAM); + base::CommandLine command_line_test1(base::CommandLine::NO_PROGRAM); command_line_test1.AppendSwitchASCII(switches::kLimitedInstallFromWebstore, "1"); EXPECT_EQ("nckgahadagoaajjgafhacjanaoiihapd", helper.WebStoreIdFromLimitedInstallCmdLine(command_line_test1)); - CommandLine command_line_test2(CommandLine::NO_PROGRAM); + base::CommandLine command_line_test2(base::CommandLine::NO_PROGRAM); command_line_test1.AppendSwitchASCII(switches::kLimitedInstallFromWebstore, "2"); EXPECT_EQ(kTestExtensionId, helper.WebStoreIdFromLimitedInstallCmdLine(command_line_test1)); // Now, on to the real test for LimitedInstallFromWebstore. - CommandLine* command_line = CommandLine::ForCurrentProcess(); + base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); command_line->AppendSwitchASCII( switches::kLimitedInstallFromWebstore, "2"); helper.LimitedInstallFromWebstore(*command_line, browser()->profile(), |