summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorderat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-06 14:05:27 +0000
committerderat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-06 14:05:27 +0000
commitec453fbed5e3047ef3b0e546e99a9e48786b8845 (patch)
tree73f71d76e4d0851acd77cbbe9464958af17c97de
parent29b7b3006b1a3b6dc375d3f1f60f9713b3f2c656 (diff)
downloadchromium_src-ec453fbed5e3047ef3b0e546e99a9e48786b8845.zip
chromium_src-ec453fbed5e3047ef3b0e546e99a9e48786b8845.tar.gz
chromium_src-ec453fbed5e3047ef3b0e546e99a9e48786b8845.tar.bz2
Move LaunchContainer enum to extension_constants.h.
Move the Chrome-specific LaunchContainer enum out of extensions/common/constants.h and into chrome/common/extensions/extension_constants.h (it can't live under chrome/browser/extensions since it's used by AppLaunchInfo). For consistency, also move the LaunchType enum to extension_constants.h. Rename LaunchContainer's values from LAUNCH_* to LAUNCH_CONTAINER_*, and also rename the LAUNCH_TYPE_* values in AppContextMenu to USE_LAUNCH_TYPE_* to avoid confusion with the LaunchType enum. BUG=180083 TBR=sky@chromium.org,jar@chromium.org Review URL: https://codereview.chromium.org/106713002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@239202 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/apps/app_browsertest.cc20
-rw-r--r--chrome/browser/apps/app_browsertest_util.cc8
-rw-r--r--chrome/browser/apps/app_window_browsertest.cc6
-rw-r--r--chrome/browser/automation/automation_provider_observers.cc6
-rw-r--r--chrome/browser/automation/automation_provider_observers.h2
-rw-r--r--chrome/browser/automation/testing_automation_provider.cc1
-rw-r--r--chrome/browser/chromeos/app_mode/startup_app_launcher.cc3
-rw-r--r--chrome/browser/chromeos/extensions/wallpaper_manager_util.cc3
-rw-r--r--chrome/browser/chromeos/first_run/first_run.cc2
-rw-r--r--chrome/browser/extensions/api/management/management_api.cc1
-rw-r--r--chrome/browser/extensions/api/management/management_apitest.cc1
-rw-r--r--chrome/browser/extensions/api/socket/socket_apitest.cc6
-rw-r--r--chrome/browser/extensions/convert_web_app_browsertest.cc2
-rw-r--r--chrome/browser/extensions/extension_apitest.cc6
-rw-r--r--chrome/browser/extensions/launch_util.cc20
-rw-r--r--chrome/browser/extensions/launch_util.h24
-rw-r--r--chrome/browser/policy/policy_browsertest.cc6
-rw-r--r--chrome/browser/ui/app_list/app_context_menu.cc52
-rw-r--r--chrome/browser/ui/app_list/app_list_controller_delegate.h2
-rw-r--r--chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc1
-rw-r--r--chrome/browser/ui/ash/launcher/chrome_launcher_controller.h6
-rw-r--r--chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc22
-rw-r--r--chrome/browser/ui/ash/launcher/launcher_context_menu.cc2
-rw-r--r--chrome/browser/ui/browser_browsertest.cc2
-rw-r--r--chrome/browser/ui/cocoa/apps/native_app_window_cocoa_browsertest.mm2
-rw-r--r--chrome/browser/ui/extensions/application_launch.cc27
-rw-r--r--chrome/browser/ui/extensions/application_launch.h8
-rw-r--r--chrome/browser/ui/startup/startup_browser_creator_browsertest.cc1
-rw-r--r--chrome/browser/ui/startup/startup_browser_creator_impl.cc11
-rw-r--r--chrome/browser/ui/webui/extensions/extension_settings_handler.cc3
-rw-r--r--chrome/browser/ui/webui/ntp/app_launcher_handler.cc4
-rw-r--r--chrome/common/extensions/extension_constants.h29
-rw-r--r--chrome/common/extensions/manifest_handlers/app_launch_info.cc8
-rw-r--r--chrome/common/extensions/manifest_handlers/app_launch_info.h2
-rw-r--r--chrome/common/extensions/manifest_tests/extension_manifests_launch_unittest.cc9
-rw-r--r--chrome/common/extensions/manifest_tests/extension_manifests_validapp_unittest.cc2
-rw-r--r--chrome/test/remoting/remote_desktop_browsertest.cc3
-rw-r--r--extensions/common/constants.h12
-rw-r--r--tools/metrics/histograms/histograms.xml8
39 files changed, 181 insertions, 152 deletions
diff --git a/chrome/browser/apps/app_browsertest.cc b/chrome/browser/apps/app_browsertest.cc
index f2c1ab5..6b536fc 100644
--- a/chrome/browser/apps/app_browsertest.cc
+++ b/chrome/browser/apps/app_browsertest.cc
@@ -522,8 +522,8 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, LaunchWithRelativeFile) {
ASSERT_TRUE(extension);
// Run the test
- AppLaunchParams params(browser()->profile(), extension, LAUNCH_NONE,
- NEW_WINDOW);
+ AppLaunchParams params(
+ browser()->profile(), extension, LAUNCH_CONTAINER_NONE, NEW_WINDOW);
params.command_line = CommandLine::ForCurrentProcess();
params.current_directory = test_data_dir_;
OpenApplication(params);
@@ -843,8 +843,8 @@ void PlatformAppDevToolsBrowserTest::RunTestWithDevTools(
content::WindowedNotificationObserver app_loaded_observer(
content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME,
content::NotificationService::AllSources());
- OpenApplication(AppLaunchParams(browser()->profile(), extension,
- LAUNCH_NONE, NEW_WINDOW));
+ OpenApplication(AppLaunchParams(
+ browser()->profile(), extension, LAUNCH_CONTAINER_NONE, NEW_WINDOW));
app_loaded_observer.Wait();
window = GetFirstShellWindow();
ASSERT_TRUE(window);
@@ -986,8 +986,8 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest,
ASSERT_TRUE(should_install.seen());
ExtensionTestMessageListener launched_listener("Launched", false);
- OpenApplication(AppLaunchParams(browser()->profile(), extension, LAUNCH_NONE,
- NEW_WINDOW));
+ OpenApplication(AppLaunchParams(
+ browser()->profile(), extension, LAUNCH_CONTAINER_NONE, NEW_WINDOW));
ASSERT_TRUE(launched_listener.WaitUntilSatisfied());
}
@@ -1009,8 +1009,8 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest,
ASSERT_TRUE(extension);
ExtensionTestMessageListener launched_listener("Launched", false);
- OpenApplication(AppLaunchParams(browser()->profile(), extension, LAUNCH_NONE,
- NEW_WINDOW));
+ OpenApplication(AppLaunchParams(
+ browser()->profile(), extension, LAUNCH_CONTAINER_NONE, NEW_WINDOW));
ASSERT_TRUE(launched_listener.WaitUntilSatisfied());
ASSERT_FALSE(should_not_install.seen());
@@ -1048,8 +1048,8 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, ComponentAppBackgroundPage) {
ASSERT_TRUE(should_install.seen());
ExtensionTestMessageListener launched_listener("Launched", false);
- OpenApplication(AppLaunchParams(browser()->profile(), extension, LAUNCH_NONE,
- NEW_WINDOW));
+ OpenApplication(AppLaunchParams(
+ browser()->profile(), extension, LAUNCH_CONTAINER_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 e84831f..8249056 100644
--- a/chrome/browser/apps/app_browsertest_util.cc
+++ b/chrome/browser/apps/app_browsertest_util.cc
@@ -65,8 +65,8 @@ const Extension* PlatformAppBrowserTest::LoadAndLaunchPlatformApp(
test_data_dir_.AppendASCII("platform_apps").AppendASCII(name));
EXPECT_TRUE(extension);
- OpenApplication(AppLaunchParams(browser()->profile(), extension, LAUNCH_NONE,
- NEW_WINDOW));
+ OpenApplication(AppLaunchParams(
+ browser()->profile(), extension, LAUNCH_CONTAINER_NONE, NEW_WINDOW));
app_loaded_observer.Wait();
@@ -90,8 +90,8 @@ const Extension* PlatformAppBrowserTest::InstallAndLaunchPlatformApp(
const Extension* extension = InstallPlatformApp(name);
- OpenApplication(AppLaunchParams(browser()->profile(), extension, LAUNCH_NONE,
- NEW_WINDOW));
+ OpenApplication(AppLaunchParams(
+ browser()->profile(), extension, LAUNCH_CONTAINER_NONE, NEW_WINDOW));
app_loaded_observer.Wait();
diff --git a/chrome/browser/apps/app_window_browsertest.cc b/chrome/browser/apps/app_window_browsertest.cc
index 588ad1b..e9c2fc6 100644
--- a/chrome/browser/apps/app_window_browsertest.cc
+++ b/chrome/browser/apps/app_window_browsertest.cc
@@ -132,8 +132,10 @@ IN_PROC_BROWSER_TEST_F(AppWindowAPI, DISABLED_TestRestoreGeometryCacheChange) {
test_data_dir_.AppendASCII("platform_apps").AppendASCII("window_api"));
EXPECT_TRUE(extension);
- OpenApplication(AppLaunchParams(
- browser()->profile(), extension, extensions::LAUNCH_NONE, NEW_WINDOW));
+ OpenApplication(AppLaunchParams(browser()->profile(),
+ extension,
+ extensions::LAUNCH_CONTAINER_NONE,
+ NEW_WINDOW));
ExtensionTestMessageListener geometry_listener("ListenGeometryChange", true);
diff --git a/chrome/browser/automation/automation_provider_observers.cc b/chrome/browser/automation/automation_provider_observers.cc
index 0fa5262..6ddf213 100644
--- a/chrome/browser/automation/automation_provider_observers.cc
+++ b/chrome/browser/automation/automation_provider_observers.cc
@@ -35,7 +35,6 @@
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/extension_system.h"
#include "chrome/browser/extensions/extension_tab_util.h"
-#include "chrome/browser/extensions/launch_util.h"
#include "chrome/browser/history/history_types.h"
#include "chrome/browser/history/top_sites.h"
#include "chrome/browser/infobars/confirm_infobar_delegate.h"
@@ -69,6 +68,7 @@
#include "chrome/common/automation_constants.h"
#include "chrome/common/automation_messages.h"
#include "chrome/common/content_settings_types.h"
+#include "chrome/common/extensions/extension_constants.h"
#include "content/public/browser/dom_operation_notification_details.h"
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/notification_service.h"
@@ -1931,7 +1931,7 @@ AppLaunchObserver::AppLaunchObserver(
reply_message_(reply_message),
launch_container_(launch_container),
new_window_id_(extension_misc::kUnknownWindowId) {
- if (launch_container_ == extensions::LAUNCH_TAB) {
+ if (launch_container_ == extensions::LAUNCH_CONTAINER_TAB) {
// Need to wait for the currently-active tab to reload.
content::Source<NavigationController> source(controller_);
registrar_.Add(this, content::NOTIFICATION_LOAD_STOP, source);
@@ -1958,7 +1958,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_ == extensions::LAUNCH_TAB) ||
+ if ((launch_container_ == extensions::LAUNCH_CONTAINER_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 03b7808..7fef530 100644
--- a/chrome/browser/automation/automation_provider_observers.h
+++ b/chrome/browser/automation/automation_provider_observers.h
@@ -39,6 +39,7 @@
#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"
@@ -46,7 +47,6 @@
#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"
diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc
index 28a55c9..1c4a35f 100644
--- a/chrome/browser/automation/testing_automation_provider.cc
+++ b/chrome/browser/automation/testing_automation_provider.cc
@@ -114,6 +114,7 @@
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
+#include "chrome/common/extensions/extension_constants.h"
#include "chrome/common/extensions/manifest_url_handler.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/render_messages.h"
diff --git a/chrome/browser/chromeos/app_mode/startup_app_launcher.cc b/chrome/browser/chromeos/app_mode/startup_app_launcher.cc
index 9c269b5..1339567 100644
--- a/chrome/browser/chromeos/app_mode/startup_app_launcher.cc
+++ b/chrome/browser/chromeos/app_mode/startup_app_launcher.cc
@@ -211,7 +211,8 @@ void StartupAppLauncher::LaunchApp() {
// Always open the app in a window.
OpenApplication(AppLaunchParams(profile_, extension,
- extensions::LAUNCH_WINDOW, NEW_WINDOW));
+ extensions::LAUNCH_CONTAINER_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 bf7a071..865a1c3 100644
--- a/chrome/browser/chromeos/extensions/wallpaper_manager_util.cc
+++ b/chrome/browser/chromeos/extensions/wallpaper_manager_util.cc
@@ -32,7 +32,8 @@ void OpenWallpaperManager() {
if (!extension)
return;
- OpenApplication(AppLaunchParams(profile, extension, extensions::LAUNCH_WINDOW,
+ OpenApplication(AppLaunchParams(profile, extension,
+ extensions::LAUNCH_CONTAINER_WINDOW,
NEW_WINDOW));
}
diff --git a/chrome/browser/chromeos/first_run/first_run.cc b/chrome/browser/chromeos/first_run/first_run.cc
index 4374628..11e5a12 100644
--- a/chrome/browser/chromeos/first_run/first_run.cc
+++ b/chrome/browser/chromeos/first_run/first_run.cc
@@ -29,7 +29,7 @@ void LaunchFirstRunDialog() {
return;
OpenApplication(AppLaunchParams(
- profile, extension, extensions::LAUNCH_WINDOW, NEW_WINDOW));
+ profile, extension, extensions::LAUNCH_CONTAINER_WINDOW, NEW_WINDOW));
}
void LaunchFirstRunTutorial() {
diff --git a/chrome/browser/extensions/api/management/management_api.cc b/chrome/browser/extensions/api/management/management_api.cc
index 583304a..26ce8d0 100644
--- a/chrome/browser/extensions/api/management/management_api.cc
+++ b/chrome/browser/extensions/api/management/management_api.cc
@@ -30,6 +30,7 @@
#include "chrome/browser/ui/webui/extensions/extension_icon_source.h"
#include "chrome/common/chrome_utility_messages.h"
#include "chrome/common/extensions/api/management.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"
diff --git a/chrome/browser/extensions/api/management/management_apitest.cc b/chrome/browser/extensions/api/management/management_apitest.cc
index df736b0..7d28505 100644
--- a/chrome/browser/extensions/api/management/management_apitest.cc
+++ b/chrome/browser/extensions/api/management/management_apitest.cc
@@ -17,6 +17,7 @@
#include "chrome/browser/ui/browser_iterator.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/chrome_switches.h"
+#include "chrome/common/extensions/extension_constants.h"
#include "content/public/test/test_utils.h"
#include "extensions/browser/test_management_policy.h"
#include "extensions/common/manifest.h"
diff --git a/chrome/browser/extensions/api/socket/socket_apitest.cc b/chrome/browser/extensions/api/socket/socket_apitest.cc
index 0ffa3e9..acf6cb9 100644
--- a/chrome/browser/extensions/api/socket/socket_apitest.cc
+++ b/chrome/browser/extensions/api/socket/socket_apitest.cc
@@ -83,8 +83,10 @@ class SocketPpapiTest : public SocketApiTest {
const Extension* extension = LoadExtension(app_dir_);
ASSERT_TRUE(extension);
- AppLaunchParams params(browser()->profile(), extension,
- extensions::LAUNCH_NONE, NEW_WINDOW);
+ AppLaunchParams params(browser()->profile(),
+ extension,
+ extensions::LAUNCH_CONTAINER_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 d834187..978110c 100644
--- a/chrome/browser/extensions/convert_web_app_browsertest.cc
+++ b/chrome/browser/extensions/convert_web_app_browsertest.cc
@@ -86,7 +86,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionFromWebAppTest, DISABLED_Basic) {
EXPECT_EQ("", installed_extension_->description());
EXPECT_EQ(GURL("http://www.example.com/"),
AppLaunchInfo::GetLaunchWebURL(installed_extension_));
- EXPECT_EQ(LAUNCH_TAB,
+ EXPECT_EQ(LAUNCH_CONTAINER_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 f7e1cea..79d4711 100644
--- a/chrome/browser/extensions/extension_apitest.cc
+++ b/chrome/browser/extensions/extension_apitest.cc
@@ -371,8 +371,10 @@ bool ExtensionApiTest::RunExtensionTestImpl(const std::string& extension_name,
else
ui_test_utils::NavigateToURL(browser(), url);
} else if (launch_platform_app) {
- AppLaunchParams params(browser()->profile(), extension,
- extensions::LAUNCH_NONE, NEW_WINDOW);
+ AppLaunchParams params(browser()->profile(),
+ extension,
+ extensions::LAUNCH_CONTAINER_NONE,
+ NEW_WINDOW);
params.command_line = CommandLine::ForCurrentProcess();
OpenApplication(params);
}
diff --git a/chrome/browser/extensions/launch_util.cc b/chrome/browser/extensions/launch_util.cc
index 826f0df..56c749e 100644
--- a/chrome/browser/extensions/launch_util.cc
+++ b/chrome/browser/extensions/launch_util.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -81,11 +81,11 @@ LaunchContainer GetLaunchContainer(const ExtensionPrefs* prefs,
LaunchContainer result = kInvalidLaunchContainer;
- if (manifest_launch_container == LAUNCH_PANEL) {
+ if (manifest_launch_container == LAUNCH_CONTAINER_PANEL) {
// Apps with app.launch.container = 'panel' should always respect the
// manifest setting.
result = manifest_launch_container;
- } else if (manifest_launch_container == LAUNCH_TAB) {
+ } else if (manifest_launch_container == LAUNCH_CONTAINER_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.
LaunchType prefs_launch_type = GetLaunchType(prefs, extension);
@@ -93,7 +93,7 @@ LaunchContainer GetLaunchContainer(const ExtensionPrefs* prefs,
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 = LAUNCH_WINDOW;
+ result = LAUNCH_CONTAINER_WINDOW;
#if defined(USE_ASH)
} else if (prefs_launch_type == LAUNCH_TYPE_FULLSCREEN &&
chrome::GetActiveDesktop() == chrome::HOST_DESKTOP_TYPE_ASH) {
@@ -101,24 +101,24 @@ LaunchContainer GetLaunchContainer(const ExtensionPrefs* prefs,
// 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 = LAUNCH_WINDOW;
+ result = LAUNCH_CONTAINER_WINDOW;
#endif
} else {
// All other launch types (tab, pinned, fullscreen) are
// implemented as tabs in a window.
- result = LAUNCH_TAB;
+ result = LAUNCH_CONTAINER_TAB;
}
} else {
// 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.
+ // added here. LAUNCH_CONTAINER_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 = LAUNCH_TAB;
+ result = LAUNCH_CONTAINER_TAB;
}
return result;
@@ -129,7 +129,7 @@ bool HasPreferredLaunchContainer(const ExtensionPrefs* prefs,
int value = -1;
LaunchContainer manifest_launch_container =
AppLaunchInfo::GetLaunchContainer(extension);
- return manifest_launch_container == LAUNCH_TAB &&
+ return manifest_launch_container == LAUNCH_CONTAINER_TAB &&
prefs->ReadPrefAsInteger(extension->id(), kPrefLaunchType, &value);
}
diff --git a/chrome/browser/extensions/launch_util.h b/chrome/browser/extensions/launch_util.h
index a429c7e..0cdfb72 100644
--- a/chrome/browser/extensions/launch_util.h
+++ b/chrome/browser/extensions/launch_util.h
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -7,32 +7,16 @@
#include <string>
-#include "extensions/common/constants.h"
+#include "chrome/common/extensions/extension_constants.h"
namespace extensions {
class Extension;
class ExtensionPrefs;
-// This enum is used for the launch type the user wants to use for an
-// application.
-// Do not remove items or re-order this enum as it is used in preferences
-// and histograms.
-enum LaunchType {
- 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_TYPE_DEFAULT = LAUNCH_TYPE_REGULAR
-};
-
// Gets the launch type preference. If no preference is set, returns
-// LAUNCH_DEFAULT.
-// Returns LAUNCH_WINDOW if there's no preference and
+// LAUNCH_TYPE_DEFAULT.
+// Returns LAUNCH_TYPE_WINDOW if there's no preference and
// 'streamlined hosted apps' are enabled.
LaunchType GetLaunchType(const ExtensionPrefs* prefs,
const Extension* extension);
diff --git a/chrome/browser/policy/policy_browsertest.cc b/chrome/browser/policy/policy_browsertest.cc
index f9bfddd..f5453db 100644
--- a/chrome/browser/policy/policy_browsertest.cc
+++ b/chrome/browser/policy/policy_browsertest.cc
@@ -2054,8 +2054,10 @@ 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,
- extensions::LAUNCH_NONE, NEW_WINDOW));
+ OpenApplication(AppLaunchParams(browser()->profile(),
+ extension,
+ extensions::LAUNCH_CONTAINER_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 27345bd..4fbaee3 100644
--- a/chrome/browser/ui/app_list/app_context_menu.cc
+++ b/chrome/browser/ui/app_list/app_context_menu.cc
@@ -8,7 +8,6 @@
#include "base/command_line.h"
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/extensions/context_menu_matcher.h"
-#include "chrome/browser/extensions/launch_util.h"
#include "chrome/browser/prefs/incognito_mode_prefs.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/app_list/app_context_menu_delegate.h"
@@ -38,13 +37,13 @@ enum CommandId {
DETAILS,
MENU_NEW_WINDOW,
MENU_NEW_INCOGNITO_WINDOW,
- // Order matters in LAUNCHER_TYPE_xxxx and must match LaunchType.
- LAUNCH_TYPE_START = 200,
- LAUNCH_TYPE_PINNED_TAB = LAUNCH_TYPE_START,
- LAUNCH_TYPE_REGULAR_TAB,
- LAUNCH_TYPE_FULLSCREEN,
- LAUNCH_TYPE_WINDOW,
- LAUNCH_TYPE_LAST,
+ // Order matters in USE_LAUNCH_TYPE_* and must match the LaunchType enum.
+ USE_LAUNCH_TYPE_COMMAND_START = 200,
+ USE_LAUNCH_TYPE_PINNED = USE_LAUNCH_TYPE_COMMAND_START,
+ USE_LAUNCH_TYPE_REGULAR,
+ USE_LAUNCH_TYPE_FULLSCREEN,
+ USE_LAUNCH_TYPE_WINDOW,
+ USE_LAUNCH_TYPE_COMMAND_END,
};
bool MenuItemHasLauncherContext(const extensions::MenuItem* item) {
@@ -116,33 +115,33 @@ ui::MenuModel* AppContextMenu::GetMenuModel() {
if (!is_platform_app_) {
menu_model_->AddSeparator(ui::NORMAL_SEPARATOR);
- // Streamlined hosted apps can only toggle between LAUNCH_WINDOW and
- // LAUNCH_REGULAR.
+ // Streamlined hosted apps can only toggle between USE_LAUNCH_TYPE_WINDOW
+ // and USE_LAUNCH_TYPE_REGULAR.
if (CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableStreamlinedHostedApps)) {
menu_model_->AddCheckItemWithStringId(
- LAUNCH_TYPE_REGULAR_TAB,
+ USE_LAUNCH_TYPE_REGULAR,
IDS_APP_CONTEXT_MENU_OPEN_TAB);
} else {
menu_model_->AddCheckItemWithStringId(
- LAUNCH_TYPE_REGULAR_TAB,
+ USE_LAUNCH_TYPE_REGULAR,
IDS_APP_CONTEXT_MENU_OPEN_REGULAR);
menu_model_->AddCheckItemWithStringId(
- LAUNCH_TYPE_PINNED_TAB,
+ USE_LAUNCH_TYPE_PINNED,
IDS_APP_CONTEXT_MENU_OPEN_PINNED);
#if defined(OS_MACOSX)
// Mac does not support standalone web app browser windows or maximize.
menu_model_->AddCheckItemWithStringId(
- LAUNCH_TYPE_FULLSCREEN,
+ USE_LAUNCH_TYPE_FULLSCREEN,
IDS_APP_CONTEXT_MENU_OPEN_FULLSCREEN);
#else
menu_model_->AddCheckItemWithStringId(
- LAUNCH_TYPE_WINDOW,
+ USE_LAUNCH_TYPE_WINDOW,
IDS_APP_CONTEXT_MENU_OPEN_WINDOW);
// Even though the launch type is Full Screen it is more accurately
// described as Maximized in Ash.
menu_model_->AddCheckItemWithStringId(
- LAUNCH_TYPE_FULLSCREEN,
+ USE_LAUNCH_TYPE_FULLSCREEN,
IDS_APP_CONTEXT_MENU_OPEN_MAXIMIZED);
#endif
}
@@ -174,8 +173,8 @@ string16 AppContextMenu::GetLabelForCommandId(int command_id) const {
// Even fullscreen windows launch in a browser tab on Mac.
const bool launches_in_tab = true;
#else
- const bool launches_in_tab = IsCommandIdChecked(LAUNCH_TYPE_PINNED_TAB) ||
- IsCommandIdChecked(LAUNCH_TYPE_REGULAR_TAB);
+ const bool launches_in_tab = IsCommandIdChecked(USE_LAUNCH_TYPE_PINNED) ||
+ IsCommandIdChecked(USE_LAUNCH_TYPE_REGULAR);
#endif
return launches_in_tab ?
l10n_util::GetStringUTF16(IDS_APP_LIST_CONTEXT_MENU_NEW_TAB) :
@@ -187,9 +186,10 @@ string16 AppContextMenu::GetLabelForCommandId(int command_id) const {
}
bool AppContextMenu::IsCommandIdChecked(int command_id) const {
- if (command_id >= LAUNCH_TYPE_START && command_id < LAUNCH_TYPE_LAST) {
+ if (command_id >= USE_LAUNCH_TYPE_COMMAND_START &&
+ command_id < USE_LAUNCH_TYPE_COMMAND_END) {
return static_cast<int>(controller_->GetExtensionLaunchType(
- profile_, app_id_)) + LAUNCH_TYPE_START == command_id;
+ profile_, app_id_)) + USE_LAUNCH_TYPE_COMMAND_START == command_id;
} else if (command_id >= IDC_EXTENSIONS_CONTEXT_CUSTOM_FIRST &&
command_id <= IDC_EXTENSIONS_CONTEXT_CUSTOM_LAST) {
return extension_menu_items_->IsCommandIdChecked(command_id);
@@ -239,12 +239,12 @@ void AppContextMenu::ExecuteCommand(int command_id, int event_flags) {
controller_->PinApp(app_id_);
} else if (command_id == CREATE_SHORTCUTS) {
controller_->DoCreateShortcutsFlow(profile_, app_id_);
- } else if (command_id >= LAUNCH_TYPE_START &&
- command_id < LAUNCH_TYPE_LAST) {
- extensions::LaunchType launch_type =
- static_cast<extensions::LaunchType>(command_id - LAUNCH_TYPE_START);
- // Streamlined hosted apps can only toggle between LAUNCH_WINDOW and
- // LAUNCH_REGULAR.
+ } else if (command_id >= USE_LAUNCH_TYPE_COMMAND_START &&
+ command_id < USE_LAUNCH_TYPE_COMMAND_END) {
+ extensions::LaunchType launch_type = static_cast<extensions::LaunchType>(
+ command_id - USE_LAUNCH_TYPE_COMMAND_START);
+ // Streamlined hosted apps can only toggle between LAUNCH_TYPE_WINDOW and
+ // LAUNCH_TYPE_REGULAR.
if (CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableStreamlinedHostedApps)) {
launch_type = (controller_->GetExtensionLaunchType(profile_, app_id_) ==
diff --git a/chrome/browser/ui/app_list/app_list_controller_delegate.h b/chrome/browser/ui/app_list/app_list_controller_delegate.h
index 73dbca4..9f2ad21 100644
--- a/chrome/browser/ui/app_list/app_list_controller_delegate.h
+++ b/chrome/browser/ui/app_list/app_list_controller_delegate.h
@@ -7,7 +7,7 @@
#include <string>
-#include "chrome/browser/extensions/launch_util.h"
+#include "chrome/common/extensions/extension_constants.h"
#include "ui/gfx/native_widget_types.h"
class ExtensionSet;
diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc
index fc91631..9c7a2ed 100644
--- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc
+++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc
@@ -29,6 +29,7 @@
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/extension_system.h"
#include "chrome/browser/extensions/extension_util.h"
+#include "chrome/browser/extensions/launch_util.h"
#include "chrome/browser/favicon/favicon_tab_helper.h"
#include "chrome/browser/prefs/incognito_mode_prefs.h"
#include "chrome/browser/prefs/pref_service_syncable.h"
diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller.h b/chrome/browser/ui/ash/launcher/chrome_launcher_controller.h
index 3abf5da..35d93aa3 100644
--- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller.h
+++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller.h
@@ -25,12 +25,12 @@
#include "base/memory/scoped_vector.h"
#include "base/prefs/pref_change_registrar.h"
#include "chrome/browser/extensions/app_icon_loader.h"
-#include "chrome/browser/extensions/launch_util.h"
#include "chrome/browser/prefs/pref_service_syncable_observer.h"
#include "chrome/browser/ui/ash/app_sync_ui_state_observer.h"
#include "chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item.h"
#include "chrome/browser/ui/ash/launcher/chrome_launcher_types.h"
#include "chrome/browser/ui/extensions/extension_enable_flow_delegate.h"
+#include "chrome/common/extensions/extension_constants.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
#include "ui/aura/window_observer.h"
@@ -59,6 +59,10 @@ namespace content {
class WebContents;
}
+namespace extensions {
+class Extension;
+}
+
namespace ui {
class BaseWindow;
}
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 8d73c19..bf4ad29 100644
--- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc
+++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc
@@ -850,7 +850,8 @@ 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", extensions::LAUNCH_TAB, NEW_FOREGROUND_TAB);
+ LoadAndLaunchExtension("app1", extensions::LAUNCH_CONTAINER_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);
@@ -867,7 +868,8 @@ 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", extensions::LAUNCH_TAB, NEW_BACKGROUND_TAB);
+ LoadAndLaunchExtension("app1", extensions::LAUNCH_CONTAINER_TAB,
+ NEW_BACKGROUND_TAB);
EXPECT_EQ(++tab_count, tab_strip->count());
ChromeLauncherController::instance()->LaunchApp(last_loaded_extension_id(),
ash::LAUNCH_FROM_UNKNOWN,
@@ -1238,13 +1240,14 @@ IN_PROC_BROWSER_TEST_F(LauncherAppBrowserTestNoDefaultBrowser,
EXPECT_EQ(0u, items);
EXPECT_EQ(0u, running_browser);
- LoadAndLaunchExtension("app1", extensions::LAUNCH_WINDOW, NEW_WINDOW);
+ LoadAndLaunchExtension(
+ "app1", extensions::LAUNCH_CONTAINER_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", extensions::LAUNCH_TAB, NEW_WINDOW);
+ LoadAndLaunchExtension("app1", extensions::LAUNCH_CONTAINER_TAB, NEW_WINDOW);
// A new browser should get detected and one more should be running.
EXPECT_EQ(NumberOfDetectedLauncherBrowsers(false), 1u);
@@ -1255,18 +1258,19 @@ IN_PROC_BROWSER_TEST_F(LauncherAppBrowserTestNoDefaultBrowser,
IN_PROC_BROWSER_TEST_F(LauncherAppBrowserTestNoDefaultBrowser,
EnumerateALlBrowsersAndTabs) {
// Create at least one browser.
- LoadAndLaunchExtension("app1", extensions::LAUNCH_TAB, NEW_WINDOW);
+ LoadAndLaunchExtension("app1", extensions::LAUNCH_CONTAINER_TAB, NEW_WINDOW);
size_t browsers = NumberOfDetectedLauncherBrowsers(false);
size_t tabs = NumberOfDetectedLauncherBrowsers(true);
// Create a second browser.
- LoadAndLaunchExtension("app1", extensions::LAUNCH_TAB, NEW_WINDOW);
+ LoadAndLaunchExtension("app1", extensions::LAUNCH_CONTAINER_TAB, NEW_WINDOW);
EXPECT_EQ(++browsers, NumberOfDetectedLauncherBrowsers(false));
EXPECT_EQ(++tabs, NumberOfDetectedLauncherBrowsers(true));
// Create only a tab.
- LoadAndLaunchExtension("app1", extensions::LAUNCH_TAB, NEW_FOREGROUND_TAB);
+ LoadAndLaunchExtension("app1", extensions::LAUNCH_CONTAINER_TAB,
+ NEW_FOREGROUND_TAB);
EXPECT_EQ(browsers, NumberOfDetectedLauncherBrowsers(false));
EXPECT_EQ(++tabs, NumberOfDetectedLauncherBrowsers(true));
@@ -1458,7 +1462,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", extensions::LAUNCH_TAB, NEW_WINDOW);
+ LoadAndLaunchExtension("app1", extensions::LAUNCH_CONTAINER_TAB, NEW_WINDOW);
EXPECT_NE(window1, ash::wm::GetActiveWindow());
EXPECT_NE(window2, ash::wm::GetActiveWindow());
@@ -2001,7 +2005,7 @@ IN_PROC_BROWSER_TEST_F(LauncherAppBrowserTest, V1AppNavigation) {
controller_->GetExtensionForAppID(extension_misc::kWebStoreAppId),
0,
chrome::HOST_DESKTOP_TYPE_ASH);
- params.container = extensions::LAUNCH_WINDOW;
+ params.container = extensions::LAUNCH_CONTAINER_WINDOW;
OpenApplication(params);
EXPECT_EQ(ash::STATUS_ACTIVE, model_->ItemByID(id)->status);
diff --git a/chrome/browser/ui/ash/launcher/launcher_context_menu.cc b/chrome/browser/ui/ash/launcher/launcher_context_menu.cc
index f38b380..620ca95 100644
--- a/chrome/browser/ui/ash/launcher/launcher_context_menu.cc
+++ b/chrome/browser/ui/ash/launcher/launcher_context_menu.cc
@@ -15,13 +15,13 @@
#include "base/command_line.h"
#include "base/prefs/pref_service.h"
#include "chrome/browser/extensions/context_menu_matcher.h"
-#include "chrome/browser/extensions/launch_util.h"
#include "chrome/browser/fullscreen.h"
#include "chrome/browser/prefs/incognito_mode_prefs.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/ash/chrome_shell_delegate.h"
#include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h"
#include "chrome/common/chrome_switches.h"
+#include "chrome/common/extensions/extension_constants.h"
#include "content/public/common/context_menu_params.h"
#include "grit/ash_strings.h"
#include "grit/generated_resources.h"
diff --git a/chrome/browser/ui/browser_browsertest.cc b/chrome/browser/ui/browser_browsertest.cc
index 36e78d8..618de84 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,
- extensions::LAUNCH_WINDOW, NEW_WINDOW));
+ extensions::LAUNCH_CONTAINER_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 6c7dd03..13afc2e 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_, extensions::LAUNCH_NONE, NEW_WINDOW));
+ profile(), app_, extensions::LAUNCH_CONTAINER_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 0fd010a..6290323 100644
--- a/chrome/browser/ui/extensions/application_launch.cc
+++ b/chrome/browser/ui/extensions/application_launch.cc
@@ -31,6 +31,7 @@
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/web_applications/web_app.h"
#include "chrome/common/chrome_switches.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"
@@ -148,17 +149,15 @@ ui::WindowShowState DetermineWindowShowState(
Profile* profile,
extensions::LaunchContainer container,
const Extension* extension) {
- if (!extension ||
- container != extensions::LAUNCH_WINDOW) {
+ if (!extension || container != extensions::LAUNCH_CONTAINER_WINDOW)
return ui::SHOW_STATE_DEFAULT;
- }
if (chrome::IsRunningInForcedAppMode())
return ui::SHOW_STATE_FULLSCREEN;
#if defined(USE_ASH)
- // In ash, LAUNCH_FULLSCREEN launches in a maximized app window and
- // LAUNCH_WINDOW launches in a normal app window.
+ // In ash, LAUNCH_TYPE_FULLSCREEN launches in a maximized app window and
+ // LAUNCH_TYPE_WINDOW launches in a normal app window.
ExtensionService* service =
extensions::ExtensionSystem::Get(profile)->extension_service();
extensions::LaunchType launch_type = extensions::GetLaunchType(
@@ -362,15 +361,15 @@ WebContents* OpenEnabledApplication(const AppLaunchParams& params) {
prefs->SetLastLaunchTime(extension->id(), base::Time::Now());
switch (params.container) {
- case extensions::LAUNCH_NONE: {
+ case extensions::LAUNCH_CONTAINER_NONE: {
NOTREACHED();
break;
}
- case extensions::LAUNCH_PANEL:
- case extensions::LAUNCH_WINDOW:
+ case extensions::LAUNCH_CONTAINER_PANEL:
+ case extensions::LAUNCH_CONTAINER_WINDOW:
tab = OpenApplicationWindow(params);
break;
- case extensions::LAUNCH_TAB: {
+ case extensions::LAUNCH_CONTAINER_TAB: {
tab = OpenApplicationTab(params);
break;
}
@@ -401,7 +400,7 @@ AppLaunchParams::AppLaunchParams(Profile* profile,
WindowOpenDisposition disposition)
: profile(profile),
extension(extension),
- container(extensions::LAUNCH_NONE),
+ container(extensions::LAUNCH_CONTAINER_NONE),
disposition(disposition),
desktop_type(chrome::GetActiveDesktop()),
override_url(),
@@ -423,16 +422,16 @@ AppLaunchParams::AppLaunchParams(Profile* profile,
chrome::HostDesktopType desktop_type)
: profile(profile),
extension(extension),
- container(extensions::LAUNCH_NONE),
+ container(extensions::LAUNCH_CONTAINER_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 = extensions::LAUNCH_TAB;
+ container = extensions::LAUNCH_CONTAINER_TAB;
} else if (disposition == NEW_WINDOW) {
- container = extensions::LAUNCH_WINDOW;
+ container = extensions::LAUNCH_CONTAINER_WINDOW;
} else {
ExtensionService* service =
extensions::ExtensionSystem::Get(profile)->extension_service();
@@ -472,7 +471,7 @@ WebContents* OpenAppShortcutWindow(Profile* profile,
AppLaunchParams launch_params(
profile,
NULL, // this is a URL app. No extension.
- extensions::LAUNCH_WINDOW,
+ extensions::LAUNCH_CONTAINER_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 e0d5844..630f9e9 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 "extensions/common/constants.h"
+#include "chrome/common/extensions/extension_constants.h"
#include "ui/base/window_open_disposition.h"
#include "ui/gfx/rect.h"
#include "url/gurl.h"
@@ -30,15 +30,15 @@ struct AppLaunchParams {
extensions::LaunchContainer container,
WindowOpenDisposition disposition);
- // Helper to create AppLaunchParams using ExtensionPrefs::GetLaunchContainer
- // with LAUNCH_TYPE_REGULAR to check for a user-configured container.
+ // Helper to create AppLaunchParams using extensions::GetLaunchContainer with
+ // LAUNCH_TYPE_REGULAR to check for a user-configured container.
AppLaunchParams(Profile* profile,
const extensions::Extension* extension,
WindowOpenDisposition disposition);
// Helper to create AppLaunchParams using event flags that allows user to
// override the user-configured container using modifier keys, falling back to
- // ExtensionPrefs::GetLaunchContainer() with no modifiers. |desktop_type|
+ // extensions::GetLaunchContainer() with no modifiers. |desktop_type|
// indicates the desktop upon which to launch (Ash or Native).
AppLaunchParams(Profile* profile,
const extensions::Extension* extension,
diff --git a/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc b/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc
index 972990f..89c79e8 100644
--- a/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc
+++ b/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc
@@ -36,6 +36,7 @@
#include "chrome/browser/ui/startup/startup_browser_creator_impl.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/common/pref_names.h"
#include "chrome/common/url_constants.h"
#include "chrome/test/base/in_process_browser_test.h"
diff --git a/chrome/browser/ui/startup/startup_browser_creator_impl.cc b/chrome/browser/ui/startup/startup_browser_creator_impl.cc
index 22dc2b8..b6b9833 100644
--- a/chrome/browser/ui/startup/startup_browser_creator_impl.cc
+++ b/chrome/browser/ui/startup/startup_browser_creator_impl.cc
@@ -208,7 +208,7 @@ bool GetAppLaunchContainer(
if (!extensions::HasPreferredLaunchContainer(
extensions_service->extension_prefs(), extension))
- launch_container = extensions::LAUNCH_WINDOW;
+ launch_container = extensions::LAUNCH_CONTAINER_WINDOW;
*out_extension = extension;
*out_launch_container = launch_container;
@@ -370,7 +370,7 @@ bool StartupBrowserCreatorImpl::Launch(Profile* profile,
if (extension) {
RecordCmdLineAppHistogram(extensions::Manifest::TYPE_PLATFORM_APP);
AppLaunchParams params(profile, extension,
- extensions::LAUNCH_NONE, NEW_WINDOW);
+ extensions::LAUNCH_CONTAINER_NONE, NEW_WINDOW);
params.command_line = &command_line_;
params.current_directory = cur_dir_;
OpenApplicationWithReenablePrompt(params);
@@ -481,13 +481,14 @@ bool StartupBrowserCreatorImpl::OpenApplicationTab(Profile* profile) {
return false;
// If the user doesn't want to open a tab, fail.
- if (launch_container != extensions::LAUNCH_TAB)
+ if (launch_container != extensions::LAUNCH_CONTAINER_TAB)
return false;
RecordCmdLineAppHistogram(extension->GetType());
WebContents* app_tab = OpenApplication(AppLaunchParams(
- profile, extension, extensions::LAUNCH_TAB, NEW_FOREGROUND_TAB));
+ profile, extension, extensions::LAUNCH_CONTAINER_TAB,
+ NEW_FOREGROUND_TAB));
return (app_tab != NULL);
}
@@ -516,7 +517,7 @@ bool StartupBrowserCreatorImpl::OpenApplicationWindow(
// and avoid calling GetAppLaunchContainer() both here and in
// OpenApplicationTab().
- if (launch_container == extensions::LAUNCH_TAB)
+ if (launch_container == extensions::LAUNCH_CONTAINER_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 dd9758b..736d894 100644
--- a/chrome/browser/ui/webui/extensions/extension_settings_handler.cc
+++ b/chrome/browser/ui/webui/extensions/extension_settings_handler.cc
@@ -807,7 +807,8 @@ void ExtensionSettingsHandler::HandleLaunchMessage(
const Extension* extension =
extension_service_->GetExtensionById(extension_id, false);
OpenApplication(AppLaunchParams(extension_service_->profile(), extension,
- extensions::LAUNCH_WINDOW, NEW_WINDOW));
+ extensions::LAUNCH_CONTAINER_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 f7f0001..0d6383a 100644
--- a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
+++ b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
@@ -518,8 +518,8 @@ void AppLauncherHandler::HandleLaunchApp(const ListValue* args) {
// TODO(jamescook): Proper support for background tabs.
AppLaunchParams params(profile, extension,
disposition == NEW_WINDOW ?
- extensions::LAUNCH_WINDOW :
- extensions::LAUNCH_TAB,
+ extensions::LAUNCH_CONTAINER_WINDOW :
+ extensions::LAUNCH_CONTAINER_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 50920e8..ee1dc9f6 100644
--- a/chrome/common/extensions/extension_constants.h
+++ b/chrome/common/extensions/extension_constants.h
@@ -309,4 +309,33 @@ namespace extension_misc {
extern const size_t kNumScriptBadgeIconSizes;
} // namespace extension_misc
+namespace extensions {
+ // This enum is used for the launch type the user wants to use for an
+ // application.
+ // Do not remove items or re-order this enum as it is used in preferences
+ // and histograms.
+ enum LaunchType {
+ 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_TYPE_DEFAULT = LAUNCH_TYPE_REGULAR
+ };
+
+ // Don't remove items or change the order of this enum. It's used in
+ // histograms and preferences.
+ enum LaunchContainer {
+ LAUNCH_CONTAINER_WINDOW,
+ LAUNCH_CONTAINER_PANEL,
+ LAUNCH_CONTAINER_TAB,
+ // For platform apps, which don't actually have a container (they just get a
+ // "onLaunched" event).
+ LAUNCH_CONTAINER_NONE
+ };
+} // namespace extensions
+
#endif // CHROME_COMMON_EXTENSIONS_EXTENSION_CONSTANTS_H_
diff --git a/chrome/common/extensions/manifest_handlers/app_launch_info.cc b/chrome/common/extensions/manifest_handlers/app_launch_info.cc
index 7b3d07e..c5ea563 100644
--- a/chrome/common/extensions/manifest_handlers/app_launch_info.cc
+++ b/chrome/common/extensions/manifest_handlers/app_launch_info.cc
@@ -59,7 +59,7 @@ const AppLaunchInfo& GetAppLaunchInfo(const Extension* extension) {
} // namespace
AppLaunchInfo::AppLaunchInfo()
- : launch_container_(LAUNCH_TAB),
+ : launch_container_(LAUNCH_CONTAINER_TAB),
launch_width_(0),
launch_height_(0) {
}
@@ -238,15 +238,15 @@ bool AppLaunchInfo::LoadLaunchContainer(Extension* extension,
}
if (launch_container_string == values::kLaunchContainerPanel) {
- launch_container_ = LAUNCH_PANEL;
+ launch_container_ = LAUNCH_CONTAINER_PANEL;
} else if (launch_container_string == values::kLaunchContainerTab) {
- launch_container_ = LAUNCH_TAB;
+ launch_container_ = LAUNCH_CONTAINER_TAB;
} else {
*error = ASCIIToUTF16(errors::kInvalidLaunchContainer);
return false;
}
- bool can_specify_initial_size = launch_container_ == LAUNCH_PANEL;
+ bool can_specify_initial_size = launch_container_ == LAUNCH_CONTAINER_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 d0b0dd9..e3e049d 100644
--- a/chrome/common/extensions/manifest_handlers/app_launch_info.h
+++ b/chrome/common/extensions/manifest_handlers/app_launch_info.h
@@ -8,7 +8,7 @@
#include <string>
#include <vector>
-#include "extensions/common/constants.h"
+#include "chrome/common/extensions/extension_constants.h"
#include "extensions/common/extension.h"
#include "extensions/common/manifest.h"
#include "extensions/common/manifest_handler.h"
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 0279d36..6912dac 100644
--- a/chrome/common/extensions/manifest_tests/extension_manifests_launch_unittest.cc
+++ b/chrome/common/extensions/manifest_tests/extension_manifests_launch_unittest.cc
@@ -23,13 +23,16 @@ TEST_F(AppLaunchManifestTest, AppLaunchContainer) {
scoped_refptr<Extension> extension;
extension = LoadAndExpectSuccess("launch_tab.json");
- EXPECT_EQ(LAUNCH_TAB, AppLaunchInfo::GetLaunchContainer(extension.get()));
+ EXPECT_EQ(LAUNCH_CONTAINER_TAB,
+ AppLaunchInfo::GetLaunchContainer(extension.get()));
extension = LoadAndExpectSuccess("launch_panel.json");
- EXPECT_EQ(LAUNCH_PANEL, AppLaunchInfo::GetLaunchContainer(extension.get()));
+ EXPECT_EQ(LAUNCH_CONTAINER_PANEL,
+ AppLaunchInfo::GetLaunchContainer(extension.get()));
extension = LoadAndExpectSuccess("launch_default.json");
- EXPECT_EQ(LAUNCH_TAB, AppLaunchInfo::GetLaunchContainer(extension.get()));
+ EXPECT_EQ(LAUNCH_CONTAINER_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 065bebc..084b9ec 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(extensions::LAUNCH_TAB,
+ EXPECT_EQ(extensions::LAUNCH_CONTAINER_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 6773925..2a03c2d 100644
--- a/chrome/test/remoting/remote_desktop_browsertest.cc
+++ b/chrome/test/remoting/remote_desktop_browsertest.cc
@@ -161,7 +161,8 @@ void RemoteDesktopBrowserTest::LaunchChromotingApp() {
OpenApplication(AppLaunchParams(
browser()->profile(),
extension_,
- is_platform_app() ? extensions::LAUNCH_NONE : extensions::LAUNCH_TAB,
+ is_platform_app() ? extensions::LAUNCH_CONTAINER_NONE :
+ extensions::LAUNCH_CONTAINER_TAB,
is_platform_app() ? NEW_WINDOW : CURRENT_TAB));
observer.Wait();
diff --git a/extensions/common/constants.h b/extensions/common/constants.h
index a071ca9..3113a17 100644
--- a/extensions/common/constants.h
+++ b/extensions/common/constants.h
@@ -83,18 +83,6 @@ 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.
-// TODO(derat): Move this to chrome/browser/extensions/launch_util.h?
-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 ed5fce9..66ab21e 100644
--- a/tools/metrics/histograms/histograms.xml
+++ b/tools/metrics/histograms/histograms.xml
@@ -21225,10 +21225,10 @@ other types of suffix sets.
</enum>
<enum name="AppLaunchContainer" type="int">
- <int value="0" label="LAUNCH_WINDOW"/>
- <int value="1" label="LAUNCH_PANEL"/>
- <int value="2" label="LAUNCH_TAB"/>
- <int value="3" label="LAUNCH_NONE (v2 packaged apps)"/>
+ <int value="0" label="LAUNCH_CONTAINER_WINDOW"/>
+ <int value="1" label="LAUNCH_CONTAINER_PANEL"/>
+ <int value="2" label="LAUNCH_CONTAINER_TAB"/>
+ <int value="3" label="LAUNCH_CONTAINER_NONE (v2 packaged apps)"/>
</enum>
<enum name="AppLauncherPromo" type="int">