diff options
author | derat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-08 01:21:00 +0000 |
---|---|---|
committer | derat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-08 01:21:00 +0000 |
commit | 667f542e33c7eabaabc60507499e427db2056fef (patch) | |
tree | 1a260e6a89ed61b42a098a02d1aa5cad736b9d65 | |
parent | edafd62e2a5ca1a8e973f9dae82bad30ee7d1759 (diff) | |
download | chromium_src-667f542e33c7eabaabc60507499e427db2056fef.zip chromium_src-667f542e33c7eabaabc60507499e427db2056fef.tar.gz chromium_src-667f542e33c7eabaabc60507499e427db2056fef.tar.bz2 |
Move LaunchContainer enum out of chrome/.
Move the LaunchContainer enum from
chrome/common/extensions/extension_constants.h's
extension_misc namespace to extensions/common/constants.h's
extensions namespace.
Also rename the LAUNCH_* values in the
ExtensionPref::LaunchType enum to LAUNCH_TYPE_* to make them
less likely to get confused with LaunchContainer's values.
BUG=313284
TBR=isherman@chromium.org, sky@chromium.org
Review URL: https://codereview.chromium.org/60353011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@233747 0039d316-1c4b-4281-b951-d872f2087c98
39 files changed, 184 insertions, 202 deletions
diff --git a/chrome/browser/apps/app_browsertest.cc b/chrome/browser/apps/app_browsertest.cc index a009fa7..c87ffd8 100644 --- a/chrome/browser/apps/app_browsertest.cc +++ b/chrome/browser/apps/app_browsertest.cc @@ -513,8 +513,8 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, LaunchWithRelativeFile) { ASSERT_TRUE(extension); // Run the test - AppLaunchParams params(browser()->profile(), extension, - extension_misc::LAUNCH_NONE, NEW_WINDOW); + AppLaunchParams params(browser()->profile(), extension, LAUNCH_NONE, + NEW_WINDOW); params.command_line = CommandLine::ForCurrentProcess(); params.current_directory = test_data_dir_; OpenApplication(params); @@ -841,10 +841,8 @@ void PlatformAppDevToolsBrowserTest::RunTestWithDevTools( content::WindowedNotificationObserver app_loaded_observer( content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, content::NotificationService::AllSources()); - OpenApplication(AppLaunchParams(browser()->profile(), - extension, - extension_misc::LAUNCH_NONE, - NEW_WINDOW)); + OpenApplication(AppLaunchParams(browser()->profile(), extension, + LAUNCH_NONE, NEW_WINDOW)); app_loaded_observer.Wait(); window = GetFirstShellWindow(); ASSERT_TRUE(window); @@ -986,9 +984,7 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, ASSERT_TRUE(should_install.seen()); ExtensionTestMessageListener launched_listener("Launched", false); - OpenApplication(AppLaunchParams(browser()->profile(), - extension, - extension_misc::LAUNCH_NONE, + OpenApplication(AppLaunchParams(browser()->profile(), extension, LAUNCH_NONE, NEW_WINDOW)); ASSERT_TRUE(launched_listener.WaitUntilSatisfied()); @@ -1011,9 +1007,7 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, ASSERT_TRUE(extension); ExtensionTestMessageListener launched_listener("Launched", false); - OpenApplication(AppLaunchParams(browser()->profile(), - extension, - extension_misc::LAUNCH_NONE, + OpenApplication(AppLaunchParams(browser()->profile(), extension, LAUNCH_NONE, NEW_WINDOW)); ASSERT_TRUE(launched_listener.WaitUntilSatisfied()); @@ -1052,9 +1046,7 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, ComponentAppBackgroundPage) { ASSERT_TRUE(should_install.seen()); ExtensionTestMessageListener launched_listener("Launched", false); - OpenApplication(AppLaunchParams(browser()->profile(), - extension, - extension_misc::LAUNCH_NONE, + OpenApplication(AppLaunchParams(browser()->profile(), extension, LAUNCH_NONE, NEW_WINDOW)); ASSERT_TRUE(launched_listener.WaitUntilSatisfied()); diff --git a/chrome/browser/apps/app_browsertest_util.cc b/chrome/browser/apps/app_browsertest_util.cc index 9a04d3c..9900070 100644 --- a/chrome/browser/apps/app_browsertest_util.cc +++ b/chrome/browser/apps/app_browsertest_util.cc @@ -65,9 +65,7 @@ const Extension* PlatformAppBrowserTest::LoadAndLaunchPlatformApp( test_data_dir_.AppendASCII("platform_apps").AppendASCII(name)); EXPECT_TRUE(extension); - OpenApplication(AppLaunchParams(browser()->profile(), - extension, - extension_misc::LAUNCH_NONE, + OpenApplication(AppLaunchParams(browser()->profile(), extension, LAUNCH_NONE, NEW_WINDOW)); app_loaded_observer.Wait(); @@ -92,9 +90,7 @@ const Extension* PlatformAppBrowserTest::InstallAndLaunchPlatformApp( const Extension* extension = InstallPlatformApp(name); - OpenApplication(AppLaunchParams(browser()->profile(), - extension, - extension_misc::LAUNCH_NONE, + OpenApplication(AppLaunchParams(browser()->profile(), extension, LAUNCH_NONE, NEW_WINDOW)); app_loaded_observer.Wait(); diff --git a/chrome/browser/automation/automation_provider_observers.cc b/chrome/browser/automation/automation_provider_observers.cc index 09e4380..b6db935 100644 --- a/chrome/browser/automation/automation_provider_observers.cc +++ b/chrome/browser/automation/automation_provider_observers.cc @@ -1768,13 +1768,16 @@ std::vector<DictionaryValue*>* GetAppInfoFromExtensions( NOTREACHED() << "Can't get integer from key " << kLaunchType; continue; } - if (launch_type == extensions::ExtensionPrefs::LAUNCH_PINNED) { + if (launch_type == extensions::ExtensionPrefs::LAUNCH_TYPE_PINNED) { app_info->SetString(kLaunchType, "pinned"); - } else if (launch_type == extensions::ExtensionPrefs::LAUNCH_REGULAR) { + } else if (launch_type == + extensions::ExtensionPrefs::LAUNCH_TYPE_REGULAR) { app_info->SetString(kLaunchType, "regular"); - } else if (launch_type == extensions::ExtensionPrefs::LAUNCH_FULLSCREEN) { + } else if (launch_type == + extensions::ExtensionPrefs::LAUNCH_TYPE_FULLSCREEN) { app_info->SetString(kLaunchType, "fullscreen"); - } else if (launch_type == extensions::ExtensionPrefs::LAUNCH_WINDOW) { + } else if (launch_type == + extensions::ExtensionPrefs::LAUNCH_TYPE_WINDOW) { app_info->SetString(kLaunchType, "window"); } else { app_info->SetString(kLaunchType, "unknown"); @@ -1924,13 +1927,13 @@ AppLaunchObserver::AppLaunchObserver( NavigationController* controller, AutomationProvider* automation, IPC::Message* reply_message, - extension_misc::LaunchContainer launch_container) + extensions::LaunchContainer launch_container) : controller_(controller), automation_(automation->AsWeakPtr()), reply_message_(reply_message), launch_container_(launch_container), new_window_id_(extension_misc::kUnknownWindowId) { - if (launch_container_ == extension_misc::LAUNCH_TAB) { + if (launch_container_ == extensions::LAUNCH_TAB) { // Need to wait for the currently-active tab to reload. content::Source<NavigationController> source(controller_); registrar_.Add(this, content::NOTIFICATION_LOAD_STOP, source); @@ -1957,7 +1960,7 @@ void AppLaunchObserver::Observe(int type, DCHECK_EQ(content::NOTIFICATION_LOAD_STOP, type); SessionTabHelper* session_tab_helper = SessionTabHelper::FromWebContents( content::Source<NavigationController>(source)->GetWebContents()); - if ((launch_container_ == extension_misc::LAUNCH_TAB) || + if ((launch_container_ == extensions::LAUNCH_TAB) || (session_tab_helper && (session_tab_helper->window_id().id() == new_window_id_))) { if (automation_.get()) { diff --git a/chrome/browser/automation/automation_provider_observers.h b/chrome/browser/automation/automation_provider_observers.h index 57d5383..f7dd78b 100644 --- a/chrome/browser/automation/automation_provider_observers.h +++ b/chrome/browser/automation/automation_provider_observers.h @@ -39,7 +39,6 @@ #include "chrome/browser/search_engines/template_url_service_observer.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/common/automation_constants.h" -#include "chrome/common/extensions/extension_constants.h" #include "chrome/common/importer/importer_data_types.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/download_item.h" @@ -47,6 +46,7 @@ #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" #include "content/public/browser/notification_types.h" +#include "extensions/common/constants.h" #include "ui/gfx/point.h" #include "ui/gfx/size.h" @@ -1099,7 +1099,7 @@ class AppLaunchObserver : public content::NotificationObserver { AppLaunchObserver(content::NavigationController* controller, AutomationProvider* automation, IPC::Message* reply_message, - extension_misc::LaunchContainer launch_container); + extensions::LaunchContainer launch_container); virtual ~AppLaunchObserver(); // Overridden from content::NotificationObserver: @@ -1112,7 +1112,7 @@ class AppLaunchObserver : public content::NotificationObserver { base::WeakPtr<AutomationProvider> automation_; scoped_ptr<IPC::Message> reply_message_; content::NotificationRegistrar registrar_; - extension_misc::LaunchContainer launch_container_; + extensions::LaunchContainer launch_container_; int new_window_id_; DISALLOW_COPY_AND_ASSIGN(AppLaunchObserver); diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc index 7be896f..389e86f 100644 --- a/chrome/browser/automation/testing_automation_provider.cc +++ b/chrome/browser/automation/testing_automation_provider.cc @@ -4321,13 +4321,13 @@ void TestingAutomationProvider::SetAppLaunchType( extensions::ExtensionPrefs::LaunchType launch_type; if (launch_type_str == "pinned") { - launch_type = extensions::ExtensionPrefs::LAUNCH_PINNED; + launch_type = extensions::ExtensionPrefs::LAUNCH_TYPE_PINNED; } else if (launch_type_str == "regular") { - launch_type = extensions::ExtensionPrefs::LAUNCH_REGULAR; + launch_type = extensions::ExtensionPrefs::LAUNCH_TYPE_REGULAR; } else if (launch_type_str == "fullscreen") { - launch_type = extensions::ExtensionPrefs::LAUNCH_FULLSCREEN; + launch_type = extensions::ExtensionPrefs::LAUNCH_TYPE_FULLSCREEN; } else if (launch_type_str == "window") { - launch_type = extensions::ExtensionPrefs::LAUNCH_WINDOW; + launch_type = extensions::ExtensionPrefs::LAUNCH_TYPE_WINDOW; } else { reply.SendError(base::StringPrintf( "Unexpected launch type '%s'.", launch_type_str.c_str())); diff --git a/chrome/browser/chromeos/app_mode/startup_app_launcher.cc b/chrome/browser/chromeos/app_mode/startup_app_launcher.cc index 6418cff..a7bcc75 100644 --- a/chrome/browser/chromeos/app_mode/startup_app_launcher.cc +++ b/chrome/browser/chromeos/app_mode/startup_app_launcher.cc @@ -229,7 +229,7 @@ void StartupAppLauncher::LaunchApp() { // Always open the app in a window. OpenApplication(AppLaunchParams(profile_, extension, - extension_misc::LAUNCH_WINDOW, NEW_WINDOW)); + extensions::LAUNCH_WINDOW, NEW_WINDOW)); InitAppSession(profile_, app_id_); UserManager::Get()->SessionStarted(); diff --git a/chrome/browser/chromeos/extensions/wallpaper_manager_util.cc b/chrome/browser/chromeos/extensions/wallpaper_manager_util.cc index b43328c..bf7a071 100644 --- a/chrome/browser/chromeos/extensions/wallpaper_manager_util.cc +++ b/chrome/browser/chromeos/extensions/wallpaper_manager_util.cc @@ -16,7 +16,7 @@ #include "chrome/browser/ui/extensions/application_launch.h" #include "chrome/browser/ui/host_desktop.h" #include "chrome/common/chrome_switches.h" -#include "chrome/common/extensions/extension_constants.h" +#include "extensions/common/constants.h" namespace wallpaper_manager_util { @@ -32,8 +32,8 @@ void OpenWallpaperManager() { if (!extension) return; - OpenApplication(AppLaunchParams(profile, extension, - extension_misc::LAUNCH_WINDOW, NEW_WINDOW)); + OpenApplication(AppLaunchParams(profile, extension, extensions::LAUNCH_WINDOW, + NEW_WINDOW)); } } // namespace wallpaper_manager_util diff --git a/chrome/browser/chromeos/file_manager/action_choice_dialog.cc b/chrome/browser/chromeos/file_manager/action_choice_dialog.cc index bba4155..99f81aa 100644 --- a/chrome/browser/chromeos/file_manager/action_choice_dialog.cc +++ b/chrome/browser/chromeos/file_manager/action_choice_dialog.cc @@ -81,8 +81,7 @@ void OpenActionChoiceDialog(const base::FilePath& file_path, if (!extension) return; - AppLaunchParams params(profile, extension, - extension_misc::LAUNCH_WINDOW, + AppLaunchParams params(profile, extension, extensions::LAUNCH_WINDOW, NEW_FOREGROUND_TAB); params.override_url = dialog_url; params.override_bounds = bounds; diff --git a/chrome/browser/extensions/api/management/management_api.cc b/chrome/browser/extensions/api/management/management_api.cc index b12bad2..94001d4 100644 --- a/chrome/browser/extensions/api/management/management_api.cc +++ b/chrome/browser/extensions/api/management/management_api.cc @@ -32,7 +32,6 @@ #include "chrome/common/chrome_utility_messages.h" #include "chrome/common/extensions/api/management.h" #include "chrome/common/extensions/extension.h" -#include "chrome/common/extensions/extension_constants.h" #include "chrome/common/extensions/extension_icon_set.h" #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" #include "chrome/common/extensions/manifest_handlers/icons_handler.h" @@ -43,6 +42,7 @@ #include "content/public/browser/notification_source.h" #include "content/public/browser/utility_process_host.h" #include "content/public/browser/utility_process_host_client.h" +#include "extensions/common/constants.h" #include "extensions/common/error_utils.h" #include "extensions/common/permissions/permission_set.h" #include "extensions/common/url_pattern.h" @@ -434,9 +434,9 @@ bool ManagementLaunchAppFunction::RunImpl() { // Look at prefs to find the right launch container. // |default_pref_value| is set to LAUNCH_DEFAULT so that if // the user has not set a preference, we open the app in a tab. - extension_misc::LaunchContainer launch_container = + LaunchContainer launch_container = service()->extension_prefs()->GetLaunchContainer( - extension, ExtensionPrefs::LAUNCH_DEFAULT); + extension, ExtensionPrefs::LAUNCH_TYPE_DEFAULT); OpenApplication(AppLaunchParams( GetProfile(), extension, launch_container, NEW_FOREGROUND_TAB)); #if !defined(OS_ANDROID) diff --git a/chrome/browser/extensions/api/management/management_apitest.cc b/chrome/browser/extensions/api/management/management_apitest.cc index 3a0fccb..9f8c532 100644 --- a/chrome/browser/extensions/api/management/management_apitest.cc +++ b/chrome/browser/extensions/api/management/management_apitest.cc @@ -219,7 +219,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementApiTest, DISABLED_LaunchPanelApp) { // Set a pref indicating that the user wants to launch in a regular tab. // This should be ignored, because panel apps always load in a popup. service->extension_prefs()->SetLaunchType( - app_id, extensions::ExtensionPrefs::LAUNCH_REGULAR); + app_id, extensions::ExtensionPrefs::LAUNCH_TYPE_REGULAR); // Load the extension again. std::string app_id_new; @@ -279,7 +279,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementApiTest, MAYBE_LaunchTabApp) { // Set a pref indicating that the user wants to launch in a window. service->extension_prefs()->SetLaunchType( - app_id, extensions::ExtensionPrefs::LAUNCH_WINDOW); + app_id, extensions::ExtensionPrefs::LAUNCH_TYPE_WINDOW); std::string app_id_new; LoadAndWaitForLaunch("management/launch_app_tab", &app_id_new); diff --git a/chrome/browser/extensions/api/socket/socket_apitest.cc b/chrome/browser/extensions/api/socket/socket_apitest.cc index 93e6f99..98371c0 100644 --- a/chrome/browser/extensions/api/socket/socket_apitest.cc +++ b/chrome/browser/extensions/api/socket/socket_apitest.cc @@ -91,8 +91,7 @@ class SocketPpapiTest : public SocketApiTest { ASSERT_TRUE(extension); AppLaunchParams params(browser()->profile(), extension, - extension_misc::LAUNCH_NONE, - NEW_WINDOW); + extensions::LAUNCH_NONE, NEW_WINDOW); params.command_line = CommandLine::ForCurrentProcess(); OpenApplication(params); } diff --git a/chrome/browser/extensions/convert_web_app_browsertest.cc b/chrome/browser/extensions/convert_web_app_browsertest.cc index ec7d423..b640ae9 100644 --- a/chrome/browser/extensions/convert_web_app_browsertest.cc +++ b/chrome/browser/extensions/convert_web_app_browsertest.cc @@ -92,7 +92,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionFromWebAppTest, MAYBE_Basic) { EXPECT_EQ("", installed_extension_->description()); EXPECT_EQ(GURL("http://www.example.com/"), AppLaunchInfo::GetLaunchWebURL(installed_extension_)); - EXPECT_EQ(extension_misc::LAUNCH_TAB, + EXPECT_EQ(LAUNCH_TAB, AppLaunchInfo::GetLaunchContainer(installed_extension_)); EXPECT_EQ(0u, installed_extension_->GetActivePermissions()->apis().size()); EXPECT_EQ(0u, IconsInfo::GetIcons(installed_extension_).map().size()); diff --git a/chrome/browser/extensions/extension_apitest.cc b/chrome/browser/extensions/extension_apitest.cc index 638b101..0df5462 100644 --- a/chrome/browser/extensions/extension_apitest.cc +++ b/chrome/browser/extensions/extension_apitest.cc @@ -366,8 +366,7 @@ bool ExtensionApiTest::RunExtensionTestImpl(const std::string& extension_name, ui_test_utils::NavigateToURL(browser(), url); } else if (launch_platform_app) { AppLaunchParams params(browser()->profile(), extension, - extension_misc::LAUNCH_NONE, - NEW_WINDOW); + extensions::LAUNCH_NONE, NEW_WINDOW); params.command_line = CommandLine::ForCurrentProcess(); OpenApplication(params); } diff --git a/chrome/browser/extensions/extension_prefs.cc b/chrome/browser/extensions/extension_prefs.cc index 7f34c42..29b7c6a 100644 --- a/chrome/browser/extensions/extension_prefs.cc +++ b/chrome/browser/extensions/extension_prefs.cc @@ -1031,50 +1031,50 @@ ExtensionPrefs::LaunchType ExtensionPrefs::GetLaunchType( const Extension* extension, ExtensionPrefs::LaunchType default_pref_value) { int value = -1; - LaunchType result = LAUNCH_REGULAR; + LaunchType result = LAUNCH_TYPE_REGULAR; if (ReadPrefAsInteger(extension->id(), kPrefLaunchType, &value) && - (value == LAUNCH_PINNED || - value == LAUNCH_REGULAR || - value == LAUNCH_FULLSCREEN || - value == LAUNCH_WINDOW)) { + (value == LAUNCH_TYPE_PINNED || + value == LAUNCH_TYPE_REGULAR || + value == LAUNCH_TYPE_FULLSCREEN || + value == LAUNCH_TYPE_WINDOW)) { result = static_cast<LaunchType>(value); } else { result = default_pref_value; } #if defined(OS_MACOSX) // App windows are not yet supported on mac. Pref sync could make - // the launch type LAUNCH_WINDOW, even if there is no UI to set it + // the launch type LAUNCH_TYPE_WINDOW, even if there is no UI to set it // on mac. - if (!extension->is_platform_app() && result == LAUNCH_WINDOW) - result = LAUNCH_REGULAR; + if (!extension->is_platform_app() && result == LAUNCH_TYPE_WINDOW) + result = LAUNCH_TYPE_REGULAR; #endif #if defined(OS_WIN) // We don't support app windows in Windows 8 single window Metro mode. - if (win8::IsSingleWindowMetroMode() && result == LAUNCH_WINDOW) - result = LAUNCH_REGULAR; + if (win8::IsSingleWindowMetroMode() && result == LAUNCH_TYPE_WINDOW) + result = LAUNCH_TYPE_REGULAR; #endif // OS_WIN return result; } -extension_misc::LaunchContainer ExtensionPrefs::GetLaunchContainer( +LaunchContainer ExtensionPrefs::GetLaunchContainer( const Extension* extension, ExtensionPrefs::LaunchType default_pref_value) { - extension_misc::LaunchContainer manifest_launch_container = + LaunchContainer manifest_launch_container = AppLaunchInfo::GetLaunchContainer(extension); - const extension_misc::LaunchContainer kInvalidLaunchContainer = - static_cast<extension_misc::LaunchContainer>(-1); + const LaunchContainer kInvalidLaunchContainer = + static_cast<LaunchContainer>(-1); - extension_misc::LaunchContainer result = kInvalidLaunchContainer; + LaunchContainer result = kInvalidLaunchContainer; - if (manifest_launch_container == extension_misc::LAUNCH_PANEL) { + if (manifest_launch_container == LAUNCH_PANEL) { // Apps with app.launch.container = 'panel' should always respect the // manifest setting. result = manifest_launch_container; - } else if (manifest_launch_container == extension_misc::LAUNCH_TAB) { + } else if (manifest_launch_container == LAUNCH_TAB) { // Look for prefs that indicate the user's choice of launch // container. The app's menu on the NTP provides a UI to set // this preference. If no preference is set, |default_pref_value| @@ -1082,35 +1082,35 @@ extension_misc::LaunchContainer ExtensionPrefs::GetLaunchContainer( ExtensionPrefs::LaunchType prefs_launch_type = GetLaunchType(extension, default_pref_value); - if (prefs_launch_type == ExtensionPrefs::LAUNCH_WINDOW) { + if (prefs_launch_type == LAUNCH_TYPE_WINDOW) { // If the pref is set to launch a window (or no pref is set, and // window opening is the default), make the container a window. - result = extension_misc::LAUNCH_WINDOW; + result = LAUNCH_WINDOW; #if defined(USE_ASH) - } else if (prefs_launch_type == ExtensionPrefs::LAUNCH_FULLSCREEN && + } else if (prefs_launch_type == LAUNCH_TYPE_FULLSCREEN && chrome::GetActiveDesktop() == chrome::HOST_DESKTOP_TYPE_ASH) { - // LAUNCH_FULLSCREEN launches in a maximized app window in ash. + // LAUNCH_TYPE_FULLSCREEN launches in a maximized app window in ash. // For desktop chrome AURA on all platforms we should open the // application in full screen mode in the current tab, on the same // lines as non AURA chrome. - result = extension_misc::LAUNCH_WINDOW; + result = LAUNCH_WINDOW; #endif } else { // All other launch types (tab, pinned, fullscreen) are // implemented as tabs in a window. - result = extension_misc::LAUNCH_TAB; + result = LAUNCH_TAB; } } else { - // If a new value for app.launch.container is added, logic - // for it should be added here. extension_misc::LAUNCH_WINDOW - // is not present because there is no way to set it in a manifest. + // If a new value for app.launch.container is added, logic for it should be + // added here. LAUNCH_WINDOW is not present because there is no way to set + // it in a manifest. NOTREACHED() << manifest_launch_container; } // All paths should set |result|. if (result == kInvalidLaunchContainer) { DLOG(FATAL) << "Failed to set a launch container."; - result = extension_misc::LAUNCH_TAB; + result = LAUNCH_TAB; } return result; diff --git a/chrome/browser/extensions/extension_prefs.h b/chrome/browser/extensions/extension_prefs.h index b89eae2..edc98fd 100644 --- a/chrome/browser/extensions/extension_prefs.h +++ b/chrome/browser/extensions/extension_prefs.h @@ -16,8 +16,8 @@ #include "base/values.h" #include "chrome/browser/extensions/extension_scoped_prefs.h" #include "chrome/common/extensions/extension.h" -#include "chrome/common/extensions/extension_constants.h" #include "components/browser_context_keyed_service/browser_context_keyed_service.h" +#include "extensions/common/constants.h" #include "extensions/common/url_pattern_set.h" #include "sync/api/string_ordinal.h" @@ -63,15 +63,15 @@ class ExtensionPrefs : public ExtensionScopedPrefs, // Do not remove items or re-order this enum as it is used in preferences // and histograms. enum LaunchType { - LAUNCH_PINNED, - LAUNCH_REGULAR, - LAUNCH_FULLSCREEN, - LAUNCH_WINDOW, + LAUNCH_TYPE_PINNED, + LAUNCH_TYPE_REGULAR, + LAUNCH_TYPE_FULLSCREEN, + LAUNCH_TYPE_WINDOW, // Launch an app in the in the way a click on the NTP would, // if no user pref were set. Update this constant to change // the default for the NTP and chrome.management.launchApp(). - LAUNCH_DEFAULT = LAUNCH_REGULAR + LAUNCH_TYPE_DEFAULT = LAUNCH_TYPE_REGULAR }; // This enum is used to store the reason an extension's install has been @@ -394,7 +394,7 @@ class ExtensionPrefs : public ExtensionScopedPrefs, // Find the right launch container based on the launch type. // If |extension|'s prefs do not have a launch type set, then // use |default_pref_value|. - extension_misc::LaunchContainer GetLaunchContainer( + LaunchContainer GetLaunchContainer( const Extension* extension, LaunchType default_pref_value); diff --git a/chrome/browser/extensions/extension_sorting.cc b/chrome/browser/extensions/extension_sorting.cc index ab4cf2d..fc44114 100644 --- a/chrome/browser/extensions/extension_sorting.cc +++ b/chrome/browser/extensions/extension_sorting.cc @@ -11,6 +11,7 @@ #include "chrome/browser/extensions/extension_scoped_prefs.h" #include "chrome/browser/extensions/extension_sync_service.h" #include "chrome/common/extensions/extension.h" +#include "chrome/common/extensions/extension_constants.h" #include "content/public/browser/notification_service.h" #if defined(OS_CHROMEOS) diff --git a/chrome/browser/extensions/extension_sorting_unittest.cc b/chrome/browser/extensions/extension_sorting_unittest.cc index 711c4a5..6588689 100644 --- a/chrome/browser/extensions/extension_sorting_unittest.cc +++ b/chrome/browser/extensions/extension_sorting_unittest.cc @@ -7,6 +7,7 @@ #include <map> #include "chrome/browser/extensions/extension_prefs_unittest.h" +#include "chrome/common/extensions/extension_constants.h" #include "extensions/common/manifest_constants.h" #include "sync/api/string_ordinal.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/chrome/browser/policy/policy_browsertest.cc b/chrome/browser/policy/policy_browsertest.cc index 5410550..85d113b 100644 --- a/chrome/browser/policy/policy_browsertest.cc +++ b/chrome/browser/policy/policy_browsertest.cc @@ -114,6 +114,7 @@ #include "content/public/test/test_utils.h" #include "content/test/net/url_request_failed_job.h" #include "content/test/net/url_request_mock_http_job.h" +#include "extensions/common/constants.h" #include "grit/generated_resources.h" #include "net/base/net_errors.h" #include "net/base/net_util.h" @@ -2022,10 +2023,8 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, FullscreenAllowedApp) { // Launch an app that tries to open a fullscreen window. TestAddShellWindowObserver add_window_observer( apps::ShellWindowRegistry::Get(browser()->profile())); - OpenApplication(AppLaunchParams(browser()->profile(), - extension, - extension_misc::LAUNCH_NONE, - NEW_WINDOW)); + OpenApplication(AppLaunchParams(browser()->profile(), extension, + extensions::LAUNCH_NONE, NEW_WINDOW)); apps::ShellWindow* window = add_window_observer.WaitForShellWindow(); ASSERT_TRUE(window); diff --git a/chrome/browser/ui/app_list/app_context_menu.cc b/chrome/browser/ui/app_list/app_context_menu.cc index 261a242..2d131e9 100644 --- a/chrome/browser/ui/app_list/app_context_menu.cc +++ b/chrome/browser/ui/app_list/app_context_menu.cc @@ -13,6 +13,7 @@ #include "chrome/browser/ui/app_list/app_context_menu_delegate.h" #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" #include "chrome/common/chrome_switches.h" +#include "chrome/common/extensions/extension_constants.h" #include "chrome/common/extensions/manifest_url_handler.h" #include "content/public/common/context_menu_params.h" #include "grit/chromium_strings.h" @@ -247,9 +248,9 @@ void AppContextMenu::ExecuteCommand(int command_id, int event_flags) { if (CommandLine::ForCurrentProcess()->HasSwitch( switches::kEnableStreamlinedHostedApps)) { launch_type = controller_->GetExtensionLaunchType(profile_, app_id_) == - extensions::ExtensionPrefs::LAUNCH_REGULAR - ? extensions::ExtensionPrefs::LAUNCH_WINDOW - : extensions::ExtensionPrefs::LAUNCH_REGULAR; + extensions::ExtensionPrefs::LAUNCH_TYPE_REGULAR + ? extensions::ExtensionPrefs::LAUNCH_TYPE_WINDOW + : extensions::ExtensionPrefs::LAUNCH_TYPE_REGULAR; } controller_->SetExtensionLaunchType(profile_, app_id_, diff --git a/chrome/browser/ui/app_list/app_list_controller_delegate.cc b/chrome/browser/ui/app_list/app_list_controller_delegate.cc index 0fbf29a..a4e3021 100644 --- a/chrome/browser/ui/app_list/app_list_controller_delegate.cc +++ b/chrome/browser/ui/app_list/app_list_controller_delegate.cc @@ -129,7 +129,7 @@ AppListControllerDelegate::GetExtensionLaunchType( extensions::ExtensionSystem::Get(profile)->extension_service(); return service->extension_prefs()-> GetLaunchType(GetExtension(profile, app_id), - extensions::ExtensionPrefs::LAUNCH_DEFAULT); + extensions::ExtensionPrefs::LAUNCH_TYPE_DEFAULT); } void AppListControllerDelegate::SetExtensionLaunchType( diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc index e07bae0..019736f 100644 --- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc +++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc @@ -709,11 +709,11 @@ extensions::ExtensionPrefs::LaunchType // An extension can be unloaded/updated/unavailable at any time. if (!extension) - return extensions::ExtensionPrefs::LAUNCH_DEFAULT; + return extensions::ExtensionPrefs::LAUNCH_TYPE_DEFAULT; return profile_->GetExtensionService()->extension_prefs()->GetLaunchType( extension, - extensions::ExtensionPrefs::LAUNCH_DEFAULT); + extensions::ExtensionPrefs::LAUNCH_TYPE_DEFAULT); } ash::LauncherID ChromeLauncherController::GetLauncherIDForAppID( diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc index 3fc2dbe..a2a9557 100644 --- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc +++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc @@ -46,12 +46,12 @@ #include "chrome/browser/ui/host_desktop.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/common/chrome_switches.h" -#include "chrome/common/extensions/extension_constants.h" #include "chrome/test/base/ui_test_utils.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_source.h" #include "content/public/browser/web_contents.h" #include "content/public/test/browser_test_utils.h" +#include "extensions/common/constants.h" #include "extensions/common/switches.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/app_list/views/apps_grid_view.h" @@ -214,7 +214,7 @@ class LauncherAppBrowserTest : public ExtensionBrowserTest { const Extension* LoadAndLaunchExtension( const char* name, - extension_misc::LaunchContainer container, + extensions::LaunchContainer container, WindowOpenDisposition disposition) { EXPECT_TRUE(LoadExtension(test_data_dir_.AppendASCII(name))); @@ -857,8 +857,7 @@ IN_PROC_BROWSER_TEST_F(LauncherAppBrowserTest, LaunchPinned) { IN_PROC_BROWSER_TEST_F(LauncherAppBrowserTest, LaunchUnpinned) { TabStripModel* tab_strip = browser()->tab_strip_model(); int tab_count = tab_strip->count(); - LoadAndLaunchExtension("app1", extension_misc::LAUNCH_TAB, - NEW_FOREGROUND_TAB); + LoadAndLaunchExtension("app1", extensions::LAUNCH_TAB, NEW_FOREGROUND_TAB); EXPECT_EQ(++tab_count, tab_strip->count()); ash::LauncherID shortcut_id = CreateShortcut("app1"); EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut_id)).status); @@ -875,8 +874,7 @@ IN_PROC_BROWSER_TEST_F(LauncherAppBrowserTest, LaunchUnpinned) { IN_PROC_BROWSER_TEST_F(LauncherAppBrowserTest, LaunchInBackground) { TabStripModel* tab_strip = browser()->tab_strip_model(); int tab_count = tab_strip->count(); - LoadAndLaunchExtension("app1", extension_misc::LAUNCH_TAB, - NEW_BACKGROUND_TAB); + LoadAndLaunchExtension("app1", extensions::LAUNCH_TAB, NEW_BACKGROUND_TAB); EXPECT_EQ(++tab_count, tab_strip->count()); ChromeLauncherController::instance()->LaunchApp(last_loaded_extension_id(), ash::LAUNCH_FROM_UNKNOWN, @@ -1247,13 +1245,13 @@ IN_PROC_BROWSER_TEST_F(LauncherAppBrowserTestNoDefaultBrowser, EXPECT_EQ(0u, items); EXPECT_EQ(0u, running_browser); - LoadAndLaunchExtension("app1", extension_misc::LAUNCH_WINDOW, NEW_WINDOW); + LoadAndLaunchExtension("app1", extensions::LAUNCH_WINDOW, NEW_WINDOW); // No new browser should get detected, even though one more is running. EXPECT_EQ(0u, NumberOfDetectedLauncherBrowsers(false)); EXPECT_EQ(++running_browser, chrome::GetTotalBrowserCount()); - LoadAndLaunchExtension("app1", extension_misc::LAUNCH_TAB, NEW_WINDOW); + LoadAndLaunchExtension("app1", extensions::LAUNCH_TAB, NEW_WINDOW); // A new browser should get detected and one more should be running. EXPECT_EQ(NumberOfDetectedLauncherBrowsers(false), 1u); @@ -1264,20 +1262,18 @@ IN_PROC_BROWSER_TEST_F(LauncherAppBrowserTestNoDefaultBrowser, IN_PROC_BROWSER_TEST_F(LauncherAppBrowserTestNoDefaultBrowser, EnumerateALlBrowsersAndTabs) { // Create at least one browser. - LoadAndLaunchExtension("app1", extension_misc::LAUNCH_TAB, NEW_WINDOW); + LoadAndLaunchExtension("app1", extensions::LAUNCH_TAB, NEW_WINDOW); size_t browsers = NumberOfDetectedLauncherBrowsers(false); size_t tabs = NumberOfDetectedLauncherBrowsers(true); // Create a second browser. - LoadAndLaunchExtension("app1", extension_misc::LAUNCH_TAB, NEW_WINDOW); + LoadAndLaunchExtension("app1", extensions::LAUNCH_TAB, NEW_WINDOW); EXPECT_EQ(++browsers, NumberOfDetectedLauncherBrowsers(false)); EXPECT_EQ(++tabs, NumberOfDetectedLauncherBrowsers(true)); // Create only a tab. - LoadAndLaunchExtension("app1", - extension_misc::LAUNCH_TAB, - NEW_FOREGROUND_TAB); + LoadAndLaunchExtension("app1", extensions::LAUNCH_TAB, NEW_FOREGROUND_TAB); EXPECT_EQ(browsers, NumberOfDetectedLauncherBrowsers(false)); EXPECT_EQ(++tabs, NumberOfDetectedLauncherBrowsers(true)); @@ -1469,7 +1465,7 @@ IN_PROC_BROWSER_TEST_F(LauncherAppBrowserTestNoDefaultBrowser, EXPECT_EQ(window1, ash::wm::GetActiveWindow()); // Create anther app and make sure that none of our browsers is active. - LoadAndLaunchExtension("app1", extension_misc::LAUNCH_TAB, NEW_WINDOW); + LoadAndLaunchExtension("app1", extensions::LAUNCH_TAB, NEW_WINDOW); EXPECT_NE(window1, ash::wm::GetActiveWindow()); EXPECT_NE(window2, ash::wm::GetActiveWindow()); diff --git a/chrome/browser/ui/ash/launcher/launcher_context_menu.cc b/chrome/browser/ui/ash/launcher/launcher_context_menu.cc index bc2c6d62..8aa6a19 100644 --- a/chrome/browser/ui/ash/launcher/launcher_context_menu.cc +++ b/chrome/browser/ui/ash/launcher/launcher_context_menu.cc @@ -166,11 +166,11 @@ string16 LauncherContextMenu::GetLabelForCommandId(int command_id) const { return l10n_util::GetStringUTF16(IDS_LAUNCHER_CONTEXT_MENU_NEW_WINDOW); } switch (controller_->GetLaunchType(item_.id)) { - case extensions::ExtensionPrefs::LAUNCH_PINNED: - case extensions::ExtensionPrefs::LAUNCH_REGULAR: + case extensions::ExtensionPrefs::LAUNCH_TYPE_PINNED: + case extensions::ExtensionPrefs::LAUNCH_TYPE_REGULAR: return l10n_util::GetStringUTF16(IDS_LAUNCHER_CONTEXT_MENU_NEW_TAB); - case extensions::ExtensionPrefs::LAUNCH_FULLSCREEN: - case extensions::ExtensionPrefs::LAUNCH_WINDOW: + case extensions::ExtensionPrefs::LAUNCH_TYPE_FULLSCREEN: + case extensions::ExtensionPrefs::LAUNCH_TYPE_WINDOW: return l10n_util::GetStringUTF16(IDS_LAUNCHER_CONTEXT_MENU_NEW_WINDOW); } } @@ -182,16 +182,16 @@ bool LauncherContextMenu::IsCommandIdChecked(int command_id) const { switch (command_id) { case LAUNCH_TYPE_PINNED_TAB: return controller_->GetLaunchType(item_.id) == - extensions::ExtensionPrefs::LAUNCH_PINNED; + extensions::ExtensionPrefs::LAUNCH_TYPE_PINNED; case LAUNCH_TYPE_REGULAR_TAB: return controller_->GetLaunchType(item_.id) == - extensions::ExtensionPrefs::LAUNCH_REGULAR; + extensions::ExtensionPrefs::LAUNCH_TYPE_REGULAR; case LAUNCH_TYPE_WINDOW: return controller_->GetLaunchType(item_.id) == - extensions::ExtensionPrefs::LAUNCH_WINDOW; + extensions::ExtensionPrefs::LAUNCH_TYPE_WINDOW; case LAUNCH_TYPE_FULLSCREEN: return controller_->GetLaunchType(item_.id) == - extensions::ExtensionPrefs::LAUNCH_FULLSCREEN; + extensions::ExtensionPrefs::LAUNCH_TYPE_FULLSCREEN; case MENU_AUTO_HIDE: return controller_->GetShelfAutoHideBehavior(root_window_) == ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS; @@ -244,20 +244,20 @@ void LauncherContextMenu::ExecuteCommand(int command_id, int event_flags) { controller_->TogglePinned(item_.id); break; case LAUNCH_TYPE_PINNED_TAB: - controller_->SetLaunchType(item_.id, - extensions::ExtensionPrefs::LAUNCH_PINNED); + controller_->SetLaunchType( + item_.id, extensions::ExtensionPrefs::LAUNCH_TYPE_PINNED); break; case LAUNCH_TYPE_REGULAR_TAB: - controller_->SetLaunchType(item_.id, - extensions::ExtensionPrefs::LAUNCH_REGULAR); + controller_->SetLaunchType( + item_.id, extensions::ExtensionPrefs::LAUNCH_TYPE_REGULAR); break; case LAUNCH_TYPE_WINDOW: - controller_->SetLaunchType(item_.id, - extensions::ExtensionPrefs::LAUNCH_WINDOW); + controller_->SetLaunchType( + item_.id, extensions::ExtensionPrefs::LAUNCH_TYPE_WINDOW); break; case LAUNCH_TYPE_FULLSCREEN: - controller_->SetLaunchType(item_.id, - extensions::ExtensionPrefs::LAUNCH_FULLSCREEN); + controller_->SetLaunchType( + item_.id, extensions::ExtensionPrefs::LAUNCH_TYPE_FULLSCREEN); break; case MENU_AUTO_HIDE: controller_->ToggleShelfAutoHideBehavior(root_window_); diff --git a/chrome/browser/ui/browser_browsertest.cc b/chrome/browser/ui/browser_browsertest.cc index d06aec4..b256df2 100644 --- a/chrome/browser/ui/browser_browsertest.cc +++ b/chrome/browser/ui/browser_browsertest.cc @@ -1410,7 +1410,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, OpenAppWindowLikeNtp) { // Launch it in a window, as AppLauncherHandler::HandleLaunchApp() would. WebContents* app_window = OpenApplication( AppLaunchParams(browser()->profile(), extension_app, - extension_misc::LAUNCH_WINDOW, NEW_WINDOW)); + extensions::LAUNCH_WINDOW, NEW_WINDOW)); ASSERT_TRUE(app_window); // Apps launched in a window from the NTP have an extensions tab helper but diff --git a/chrome/browser/ui/cocoa/apps/native_app_window_cocoa_browsertest.mm b/chrome/browser/ui/cocoa/apps/native_app_window_cocoa_browsertest.mm index 9b0541a..6c7dd03 100644 --- a/chrome/browser/ui/cocoa/apps/native_app_window_cocoa_browsertest.mm +++ b/chrome/browser/ui/cocoa/apps/native_app_window_cocoa_browsertest.mm @@ -31,7 +31,7 @@ class NativeAppWindowCocoaBrowserTest : public PlatformAppBrowserTest { content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, content::NotificationService::AllSources()); OpenApplication(AppLaunchParams( - profile(), app_, extension_misc::LAUNCH_NONE, NEW_WINDOW)); + profile(), app_, extensions::LAUNCH_NONE, NEW_WINDOW)); app_loaded_observer.Wait(); } } diff --git a/chrome/browser/ui/extensions/application_launch.cc b/chrome/browser/ui/extensions/application_launch.cc index 164d33a..5492c60 100644 --- a/chrome/browser/ui/extensions/application_launch.cc +++ b/chrome/browser/ui/extensions/application_launch.cc @@ -31,7 +31,6 @@ #include "chrome/browser/web_applications/web_app.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/extensions/extension.h" -#include "chrome/common/extensions/extension_constants.h" #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" #include "chrome/common/extensions/manifest_url_handler.h" #include "chrome/common/url_constants.h" @@ -39,6 +38,7 @@ #include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents_view.h" #include "content/public/common/renderer_preferences.h" +#include "extensions/common/constants.h" #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/window_open_disposition.h" @@ -145,10 +145,10 @@ GURL UrlForExtension(const Extension* extension, ui::WindowShowState DetermineWindowShowState( Profile* profile, - extension_misc::LaunchContainer container, + extensions::LaunchContainer container, const Extension* extension) { if (!extension || - container != extension_misc::LAUNCH_WINDOW) { + container != extensions::LAUNCH_WINDOW) { return ui::SHOW_STATE_DEFAULT; } @@ -162,10 +162,10 @@ ui::WindowShowState DetermineWindowShowState( extensions::ExtensionSystem::Get(profile)->extension_service(); ExtensionPrefs::LaunchType launch_type = service->extension_prefs()->GetLaunchType( - extension, ExtensionPrefs::LAUNCH_DEFAULT); - if (launch_type == ExtensionPrefs::LAUNCH_FULLSCREEN) + extension, ExtensionPrefs::LAUNCH_TYPE_DEFAULT); + if (launch_type == ExtensionPrefs::LAUNCH_TYPE_FULLSCREEN) return ui::SHOW_STATE_MAXIMIZED; - else if (launch_type == ExtensionPrefs::LAUNCH_WINDOW) + else if (launch_type == ExtensionPrefs::LAUNCH_TYPE_WINDOW) return ui::SHOW_STATE_NORMAL; #endif @@ -254,11 +254,11 @@ WebContents* OpenApplicationTab(const AppLaunchParams& launch_params) { ExtensionPrefs::LaunchType launch_type = extension_service->extension_prefs()->GetLaunchType( - extension, ExtensionPrefs::LAUNCH_DEFAULT); + extension, ExtensionPrefs::LAUNCH_TYPE_DEFAULT); UMA_HISTOGRAM_ENUMERATION("Extensions.AppTabLaunchType", launch_type, 100); int add_type = TabStripModel::ADD_ACTIVE; - if (launch_type == ExtensionPrefs::LAUNCH_PINNED) + if (launch_type == ExtensionPrefs::LAUNCH_TYPE_PINNED) add_type |= TabStripModel::ADD_PINNED; GURL extension_url = UrlForExtension(extension, launch_params.override_url); @@ -300,13 +300,13 @@ WebContents* OpenApplicationTab(const AppLaunchParams& launch_params) { if (browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH) { // In ash, LAUNCH_FULLSCREEN launches in the OpenApplicationWindow function // i.e. it should not reach here. - DCHECK(launch_type != ExtensionPrefs::LAUNCH_FULLSCREEN); + DCHECK(launch_type != ExtensionPrefs::LAUNCH_TYPE_FULLSCREEN); } else { // TODO(skerner): If we are already in full screen mode, and the user // set the app to open as a regular or pinned tab, what should happen? // Today we open the tab, but stay in full screen mode. Should we leave // full screen mode in this case? - if (launch_type == ExtensionPrefs::LAUNCH_FULLSCREEN && + if (launch_type == ExtensionPrefs::LAUNCH_TYPE_FULLSCREEN && !browser->window()->IsFullscreen()) { #if defined(OS_MACOSX) chrome::ToggleFullscreenWithChromeOrFallback(browser); @@ -363,15 +363,15 @@ WebContents* OpenEnabledApplication(const AppLaunchParams& params) { prefs->SetLastLaunchTime(extension->id(), base::Time::Now()); switch (params.container) { - case extension_misc::LAUNCH_NONE: { + case extensions::LAUNCH_NONE: { NOTREACHED(); break; } - case extension_misc::LAUNCH_PANEL: - case extension_misc::LAUNCH_WINDOW: + case extensions::LAUNCH_PANEL: + case extensions::LAUNCH_WINDOW: tab = OpenApplicationWindow(params); break; - case extension_misc::LAUNCH_TAB: { + case extensions::LAUNCH_TAB: { tab = OpenApplicationTab(params); break; } @@ -386,7 +386,7 @@ WebContents* OpenEnabledApplication(const AppLaunchParams& params) { AppLaunchParams::AppLaunchParams(Profile* profile, const extensions::Extension* extension, - extension_misc::LaunchContainer container, + extensions::LaunchContainer container, WindowOpenDisposition disposition) : profile(profile), extension(extension), @@ -402,7 +402,7 @@ AppLaunchParams::AppLaunchParams(Profile* profile, WindowOpenDisposition disposition) : profile(profile), extension(extension), - container(extension_misc::LAUNCH_NONE), + container(extensions::LAUNCH_NONE), disposition(disposition), desktop_type(chrome::GetActiveDesktop()), override_url(), @@ -415,7 +415,7 @@ AppLaunchParams::AppLaunchParams(Profile* profile, // Look up the app preference to find out the right launch container. Default // is to launch as a regular tab. container = service->extension_prefs()->GetLaunchContainer( - extension, extensions::ExtensionPrefs::LAUNCH_REGULAR); + extension, extensions::ExtensionPrefs::LAUNCH_TYPE_REGULAR); } AppLaunchParams::AppLaunchParams(Profile* profile, @@ -424,16 +424,16 @@ AppLaunchParams::AppLaunchParams(Profile* profile, chrome::HostDesktopType desktop_type) : profile(profile), extension(extension), - container(extension_misc::LAUNCH_NONE), + container(extensions::LAUNCH_NONE), disposition(ui::DispositionFromEventFlags(event_flags)), desktop_type(desktop_type), override_url(), override_bounds(), command_line(NULL) { if (disposition == NEW_FOREGROUND_TAB || disposition == NEW_BACKGROUND_TAB) { - container = extension_misc::LAUNCH_TAB; + container = extensions::LAUNCH_TAB; } else if (disposition == NEW_WINDOW) { - container = extension_misc::LAUNCH_WINDOW; + container = extensions::LAUNCH_WINDOW; } else { ExtensionService* service = extensions::ExtensionSystem::Get(profile)->extension_service(); @@ -442,7 +442,7 @@ AppLaunchParams::AppLaunchParams(Profile* profile, // Look at preference to find the right launch container. If no preference // is set, launch as a regular tab. container = service->extension_prefs()->GetLaunchContainer( - extension, extensions::ExtensionPrefs::LAUNCH_DEFAULT); + extension, extensions::ExtensionPrefs::LAUNCH_TYPE_DEFAULT); disposition = NEW_FOREGROUND_TAB; } } @@ -473,7 +473,7 @@ WebContents* OpenAppShortcutWindow(Profile* profile, AppLaunchParams launch_params( profile, NULL, // this is a URL app. No extension. - extension_misc::LAUNCH_WINDOW, + extensions::LAUNCH_WINDOW, NEW_WINDOW); launch_params.override_url = url; launch_params.override_bounds = override_bounds; diff --git a/chrome/browser/ui/extensions/application_launch.h b/chrome/browser/ui/extensions/application_launch.h index 69c5d67..58ae1c4 100644 --- a/chrome/browser/ui/extensions/application_launch.h +++ b/chrome/browser/ui/extensions/application_launch.h @@ -7,7 +7,7 @@ #include "base/files/file_path.h" #include "chrome/browser/ui/host_desktop.h" -#include "chrome/common/extensions/extension_constants.h" +#include "extensions/common/constants.h" #include "ui/base/window_open_disposition.h" #include "ui/gfx/rect.h" #include "url/gurl.h" @@ -27,11 +27,11 @@ class Extension; struct AppLaunchParams { AppLaunchParams(Profile* profile, const extensions::Extension* extension, - extension_misc::LaunchContainer container, + extensions::LaunchContainer container, WindowOpenDisposition disposition); // Helper to create AppLaunchParams using ExtensionPrefs::GetLaunchContainer - // with ExtensionPrefs::LAUNCH_REGULAR to check for a user-configured + // with ExtensionPrefs::LAUNCH_TYPE_REGULAR to check for a user-configured // container. AppLaunchParams(Profile* profile, const extensions::Extension* extension, @@ -53,7 +53,7 @@ struct AppLaunchParams { const extensions::Extension* extension; // The container type to launch the application in. - extension_misc::LaunchContainer container; + extensions::LaunchContainer container; // If container is TAB, this field controls how the tab is opened. WindowOpenDisposition disposition; diff --git a/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc b/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc index 94a2084..a118f74 100644 --- a/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc +++ b/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc @@ -300,7 +300,7 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, OpenAppShortcutWindowPref) { // Set a pref indicating that the user wants to open this app in a window. SetAppLaunchPref(extension_app->id(), - extensions::ExtensionPrefs::LAUNCH_WINDOW); + extensions::ExtensionPrefs::LAUNCH_TYPE_WINDOW); CommandLine command_line(CommandLine::NO_PROGRAM); command_line.AppendSwitchASCII(switches::kAppId, extension_app->id()); @@ -332,7 +332,7 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, OpenAppShortcutTabPref) { // Set a pref indicating that the user wants to open this app in a window. SetAppLaunchPref(extension_app->id(), - extensions::ExtensionPrefs::LAUNCH_REGULAR); + extensions::ExtensionPrefs::LAUNCH_TYPE_REGULAR); CommandLine command_line(CommandLine::NO_PROGRAM); command_line.AppendSwitchASCII(switches::kAppId, extension_app->id()); diff --git a/chrome/browser/ui/startup/startup_browser_creator_impl.cc b/chrome/browser/ui/startup/startup_browser_creator_impl.cc index d79b3ea..6761fcb 100644 --- a/chrome/browser/ui/startup/startup_browser_creator_impl.cc +++ b/chrome/browser/ui/startup/startup_browser_creator_impl.cc @@ -87,6 +87,7 @@ #include "content/public/browser/storage_partition.h" #include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents_view.h" +#include "extensions/common/constants.h" #include "grit/locale_settings.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" @@ -186,7 +187,7 @@ bool GetAppLaunchContainer( Profile* profile, const std::string& app_id, const Extension** out_extension, - extension_misc::LaunchContainer* out_launch_container) { + extensions::LaunchContainer* out_launch_container) { ExtensionService* extensions_service = profile->GetExtensionService(); const Extension* extension = @@ -202,9 +203,9 @@ bool GetAppLaunchContainer( // Look at preferences to find the right launch container. If no // preference is set, launch as a window. - extension_misc::LaunchContainer launch_container = + extensions::LaunchContainer launch_container = extensions_service->extension_prefs()->GetLaunchContainer( - extension, extensions::ExtensionPrefs::LAUNCH_WINDOW); + extension, extensions::ExtensionPrefs::LAUNCH_TYPE_WINDOW); *out_extension = extension; *out_launch_container = launch_container; @@ -366,7 +367,7 @@ bool StartupBrowserCreatorImpl::Launch(Profile* profile, if (extension) { RecordCmdLineAppHistogram(extensions::Manifest::TYPE_PLATFORM_APP); AppLaunchParams params(profile, extension, - extension_misc::LAUNCH_NONE, NEW_WINDOW); + extensions::LAUNCH_NONE, NEW_WINDOW); params.command_line = &command_line_; params.current_directory = cur_dir_; OpenApplicationWithReenablePrompt(params); @@ -471,19 +472,19 @@ bool StartupBrowserCreatorImpl::OpenApplicationTab(Profile* profile) { if (!IsAppLaunch(NULL, &app_id) || app_id.empty()) return false; - extension_misc::LaunchContainer launch_container; + extensions::LaunchContainer launch_container; const Extension* extension; if (!GetAppLaunchContainer(profile, app_id, &extension, &launch_container)) return false; // If the user doesn't want to open a tab, fail. - if (launch_container != extension_misc::LAUNCH_TAB) + if (launch_container != extensions::LAUNCH_TAB) return false; RecordCmdLineAppHistogram(extension->GetType()); WebContents* app_tab = OpenApplication(AppLaunchParams( - profile, extension, extension_misc::LAUNCH_TAB, NEW_FOREGROUND_TAB)); + profile, extension, extensions::LAUNCH_TAB, NEW_FOREGROUND_TAB)); return (app_tab != NULL); } @@ -503,7 +504,7 @@ bool StartupBrowserCreatorImpl::OpenApplicationWindow( // TODO(skerner): Do something reasonable here. Pop up a warning panel? // Open an URL to the gallery page of the extension id? if (!app_id.empty()) { - extension_misc::LaunchContainer launch_container; + extensions::LaunchContainer launch_container; const Extension* extension; if (!GetAppLaunchContainer(profile, app_id, &extension, &launch_container)) return false; @@ -512,7 +513,7 @@ bool StartupBrowserCreatorImpl::OpenApplicationWindow( // and avoid calling GetAppLaunchContainer() both here and in // OpenApplicationTab(). - if (launch_container == extension_misc::LAUNCH_TAB) + if (launch_container == extensions::LAUNCH_TAB) return false; RecordCmdLineAppHistogram(extension->GetType()); diff --git a/chrome/browser/ui/webui/extensions/extension_settings_handler.cc b/chrome/browser/ui/webui/extensions/extension_settings_handler.cc index 9483443..42a5684 100644 --- a/chrome/browser/ui/webui/extensions/extension_settings_handler.cc +++ b/chrome/browser/ui/webui/extensions/extension_settings_handler.cc @@ -790,10 +790,8 @@ void ExtensionSettingsHandler::HandleLaunchMessage( CHECK(args->GetString(0, &extension_id)); const Extension* extension = extension_service_->GetExtensionById(extension_id, false); - OpenApplication(AppLaunchParams(extension_service_->profile(), - extension, - extension_misc::LAUNCH_WINDOW, - NEW_WINDOW)); + OpenApplication(AppLaunchParams(extension_service_->profile(), extension, + extensions::LAUNCH_WINDOW, NEW_WINDOW)); } void ExtensionSettingsHandler::HandleReloadMessage( diff --git a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc index 538fbf8..7e02cf0 100644 --- a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc +++ b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc @@ -49,6 +49,7 @@ #include "content/public/browser/notification_service.h" #include "content/public/browser/web_ui.h" #include "content/public/common/favicon_url.h" +#include "extensions/common/constants.h" #include "grit/browser_resources.h" #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" @@ -154,7 +155,7 @@ void AppLauncherHandler::CreateAppInfo( ExtensionPrefs* prefs = service->extension_prefs(); value->SetInteger("launch_type", prefs->GetLaunchType(extension, - ExtensionPrefs::LAUNCH_DEFAULT)); + ExtensionPrefs::LAUNCH_TYPE_DEFAULT)); value->SetBoolean("is_component", extension->location() == extensions::Manifest::COMPONENT); value->SetBoolean("is_webstore", @@ -517,8 +518,8 @@ void AppLauncherHandler::HandleLaunchApp(const ListValue* args) { // TODO(jamescook): Proper support for background tabs. AppLaunchParams params(profile, extension, disposition == NEW_WINDOW ? - extension_misc::LAUNCH_WINDOW : - extension_misc::LAUNCH_TAB, + extensions::LAUNCH_WINDOW : + extensions::LAUNCH_TAB, disposition); params.override_url = GURL(url); OpenApplication(params); diff --git a/chrome/common/extensions/extension_constants.h b/chrome/common/extensions/extension_constants.h index b1cf82d8..6092e95 100644 --- a/chrome/common/extensions/extension_constants.h +++ b/chrome/common/extensions/extension_constants.h @@ -153,17 +153,6 @@ namespace extension_misc { 0xf7, 0x0d, 0x01, 0x01, 0x05, 0x05, 0x00 }; - // Don't remove items or change the order of this enum. It's used in - // histograms and preferences. - enum LaunchContainer { - LAUNCH_WINDOW, - LAUNCH_PANEL, - LAUNCH_TAB, - // For platform apps, which don't actually have a container (they just get a - // "onLaunched" event). - LAUNCH_NONE - }; - // The name of the app launch histogram. extern const char kAppLaunchHistogram[]; diff --git a/chrome/common/extensions/manifest_handlers/app_launch_info.cc b/chrome/common/extensions/manifest_handlers/app_launch_info.cc index dc22f1c..fe3fbea 100644 --- a/chrome/common/extensions/manifest_handlers/app_launch_info.cc +++ b/chrome/common/extensions/manifest_handlers/app_launch_info.cc @@ -10,6 +10,7 @@ #include "base/strings/utf_string_conversions.h" #include "base/values.h" #include "chrome/common/chrome_switches.h" +#include "chrome/common/extensions/extension_constants.h" #include "chrome/common/url_constants.h" #include "extensions/common/error_utils.h" #include "extensions/common/manifest_constants.h" @@ -58,7 +59,7 @@ const AppLaunchInfo& GetAppLaunchInfo(const Extension* extension) { } // namespace AppLaunchInfo::AppLaunchInfo() - : launch_container_(extension_misc::LAUNCH_TAB), + : launch_container_(LAUNCH_TAB), launch_width_(0), launch_height_(0) { } @@ -79,7 +80,7 @@ const GURL& AppLaunchInfo::GetLaunchWebURL( } // static -extension_misc::LaunchContainer AppLaunchInfo::GetLaunchContainer( +extensions::LaunchContainer AppLaunchInfo::GetLaunchContainer( const Extension* extension) { return GetAppLaunchInfo(extension).launch_container_; } @@ -237,16 +238,15 @@ bool AppLaunchInfo::LoadLaunchContainer(Extension* extension, } if (launch_container_string == values::kLaunchContainerPanel) { - launch_container_ = extension_misc::LAUNCH_PANEL; + launch_container_ = LAUNCH_PANEL; } else if (launch_container_string == values::kLaunchContainerTab) { - launch_container_ = extension_misc::LAUNCH_TAB; + launch_container_ = LAUNCH_TAB; } else { *error = ASCIIToUTF16(errors::kInvalidLaunchContainer); return false; } - bool can_specify_initial_size = - launch_container_ == extension_misc::LAUNCH_PANEL; + bool can_specify_initial_size = launch_container_ == LAUNCH_PANEL; // Validate the container width if present. if (!ReadLaunchDimension(extension->manifest(), diff --git a/chrome/common/extensions/manifest_handlers/app_launch_info.h b/chrome/common/extensions/manifest_handlers/app_launch_info.h index ba3a10b..f2357bf 100644 --- a/chrome/common/extensions/manifest_handlers/app_launch_info.h +++ b/chrome/common/extensions/manifest_handlers/app_launch_info.h @@ -9,7 +9,7 @@ #include <vector> #include "chrome/common/extensions/extension.h" -#include "chrome/common/extensions/extension_constants.h" +#include "extensions/common/constants.h" #include "extensions/common/manifest.h" #include "extensions/common/manifest_handler.h" #include "url/gurl.h" @@ -33,7 +33,7 @@ class AppLaunchInfo : public Extension::ManifestData { // users can override the way each app launches. See // ExtensionPrefs::GetLaunchContainer(), which looks at a per-app pref // to decide what container an app will launch in. - static extension_misc::LaunchContainer GetLaunchContainer( + static LaunchContainer GetLaunchContainer( const Extension* extension); // The default size of the container when launching. Only respected for @@ -55,7 +55,7 @@ class AppLaunchInfo : public Extension::ManifestData { GURL launch_web_url_; - extension_misc::LaunchContainer launch_container_; + LaunchContainer launch_container_; int launch_width_; int launch_height_; diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_launch_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_launch_unittest.cc index 18bba26..0b7f076 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifests_launch_unittest.cc +++ b/chrome/common/extensions/manifest_tests/extension_manifests_launch_unittest.cc @@ -23,16 +23,13 @@ TEST_F(AppLaunchManifestTest, AppLaunchContainer) { scoped_refptr<Extension> extension; extension = LoadAndExpectSuccess("launch_tab.json"); - EXPECT_EQ(extension_misc::LAUNCH_TAB, - AppLaunchInfo::GetLaunchContainer(extension.get())); + EXPECT_EQ(LAUNCH_TAB, AppLaunchInfo::GetLaunchContainer(extension.get())); extension = LoadAndExpectSuccess("launch_panel.json"); - EXPECT_EQ(extension_misc::LAUNCH_PANEL, - AppLaunchInfo::GetLaunchContainer(extension.get())); + EXPECT_EQ(LAUNCH_PANEL, AppLaunchInfo::GetLaunchContainer(extension.get())); extension = LoadAndExpectSuccess("launch_default.json"); - EXPECT_EQ(extension_misc::LAUNCH_TAB, - AppLaunchInfo::GetLaunchContainer(extension.get())); + EXPECT_EQ(LAUNCH_TAB, AppLaunchInfo::GetLaunchContainer(extension.get())); extension = LoadAndExpectSuccess("launch_width.json"); EXPECT_EQ(640, AppLaunchInfo::GetLaunchWidth(extension.get())); diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_validapp_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_validapp_unittest.cc index e63ce26..065bebc 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifests_validapp_unittest.cc +++ b/chrome/common/extensions/manifest_tests/extension_manifests_validapp_unittest.cc @@ -17,7 +17,7 @@ TEST_F(ValidAppManifestTest, ValidApp) { AddPattern(&expected_patterns, "http://www.google.com/mail/*"); AddPattern(&expected_patterns, "http://www.google.com/foobar/*"); EXPECT_EQ(expected_patterns, extension->web_extent()); - EXPECT_EQ(extension_misc::LAUNCH_TAB, + EXPECT_EQ(extensions::LAUNCH_TAB, extensions::AppLaunchInfo::GetLaunchContainer(extension.get())); EXPECT_EQ(GURL("http://www.google.com/mail/"), extensions::AppLaunchInfo::GetLaunchWebURL(extension.get())); diff --git a/chrome/test/remoting/remote_desktop_browsertest.cc b/chrome/test/remoting/remote_desktop_browsertest.cc index 280e363..7a02366 100644 --- a/chrome/test/remoting/remote_desktop_browsertest.cc +++ b/chrome/test/remoting/remote_desktop_browsertest.cc @@ -10,7 +10,6 @@ #include "chrome/browser/ui/extensions/application_launch.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/extensions/extension.h" -#include "chrome/common/extensions/extension_constants.h" #include "chrome/common/extensions/extension_file_util.h" #include "chrome/test/remoting/key_code_conv.h" #include "chrome/test/remoting/page_load_notification_observer.h" @@ -18,6 +17,7 @@ #include "content/public/browser/native_web_keyboard_event.h" #include "content/public/browser/render_view_host.h" #include "content/public/test/test_utils.h" +#include "extensions/common/constants.h" #include "ui/base/window_open_disposition.h" namespace remoting { @@ -161,8 +161,7 @@ void RemoteDesktopBrowserTest::LaunchChromotingApp() { OpenApplication(AppLaunchParams( browser()->profile(), extension_, - is_platform_app() ? extension_misc::LAUNCH_NONE : - extension_misc::LAUNCH_TAB, + is_platform_app() ? extensions::LAUNCH_NONE : extensions::LAUNCH_TAB, is_platform_app() ? NEW_WINDOW : CURRENT_TAB)); observer.Wait(); diff --git a/extensions/common/constants.h b/extensions/common/constants.h index 3113a17..6f4e803 100644 --- a/extensions/common/constants.h +++ b/extensions/common/constants.h @@ -83,6 +83,17 @@ extern const char kStateStoreName[]; // rules are stored. extern const char kRulesStoreName[]; +// Don't remove items or change the order of this enum. It's used in +// histograms and preferences. +enum LaunchContainer { + LAUNCH_WINDOW, + LAUNCH_PANEL, + LAUNCH_TAB, + // For platform apps, which don't actually have a container (they just get a + // "onLaunched" event). + LAUNCH_NONE +}; + } // namespace extensions #endif // EXTENSIONS_COMMON_CONSTANTS_H_ diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index 46c463c..1c25805 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml @@ -4143,7 +4143,7 @@ other types of suffix sets. <histogram name="Extensions.AppLaunchContainer" enum="AppLaunchContainer"> <summary> The number of times apps are launched grouped by - extension_misc::LaunchContainer. + extensions::LaunchContainer. </summary> </histogram> |