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 /chrome/browser/extensions | |
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
Diffstat (limited to 'chrome/browser/extensions')
9 files changed, 44 insertions, 44 deletions
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" |