summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstevenjb@chromium.org <stevenjb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-12 15:38:33 +0000
committerstevenjb@chromium.org <stevenjb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-12 15:38:33 +0000
commit87d722a4c52c23d5cc86ac1517e0fdb96ed658ad (patch)
tree4b2dc2f9140bef49192451aba79c0796fe82375d
parent091dd4ab4f1ea3f19aaada82320f2e2dd22b953c (diff)
downloadchromium_src-87d722a4c52c23d5cc86ac1517e0fdb96ed658ad.zip
chromium_src-87d722a4c52c23d5cc86ac1517e0fdb96ed658ad.tar.gz
chromium_src-87d722a4c52c23d5cc86ac1517e0fdb96ed658ad.tar.bz2
Deprecate --aura-panels
Ash panels will be triggered only by the experimental appWindow.create apps v2 API, and no longer require a separate flag. Support for Ash panels with apps v1 is deprecated. BUG=none TEST=unit/browser tests should pass, test panels should work in ash shell without flag. Resubmitting - this was reverted because VM tests failed, but I have been unable to reproduce the failure. Original CL: https://chromiumcodereview.appspot.com/10689071 TBR=ben@chromium.org,jennb@chromium.org Review URL: https://chromiumcodereview.appspot.com/10695153 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@146353 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--ash/ash_switches.cc3
-rw-r--r--ash/ash_switches.h1
-rw-r--r--ash/shell.cc21
-rw-r--r--ash/wm/panel_layout_manager_unittest.cc1
-rw-r--r--chrome/browser/chromeos/login/login_utils.cc1
-rw-r--r--chrome/browser/extensions/api/tabs/tabs.cc20
-rw-r--r--chrome/browser/extensions/window_open_apitest.cc24
-rw-r--r--chrome/browser/ui/browser.cc13
-rw-r--r--chrome/browser/ui/extensions/application_launch.cc38
-rw-r--r--chrome/browser/ui/extensions/application_launch.h6
-rw-r--r--chrome/browser/ui/panels/panel_app_browsertest.cc105
-rw-r--r--chrome/browser/ui/startup/startup_browser_creator_browsertest.cc25
-rw-r--r--chrome/chrome_tests.gypi2
13 files changed, 34 insertions, 226 deletions
diff --git a/ash/ash_switches.cc b/ash/ash_switches.cc
index c3bf2c7..ca6a753 100644
--- a/ash/ash_switches.cc
+++ b/ash/ash_switches.cc
@@ -44,8 +44,5 @@ const char kAuraLegacyPowerButton[] = "aura-legacy-power-button";
// Avoid drawing drop shadows under windows.
const char kAuraNoShadows[] = "aura-no-shadows";
-// Use Aura to manage windows of type WINDOW_TYPE_PANEL.
-const char kAuraPanelManager[] = "aura-panels";
-
} // namespace switches
} // namespace ash
diff --git a/ash/ash_switches.h b/ash/ash_switches.h
index dfcf74c..a2df225 100644
--- a/ash/ash_switches.h
+++ b/ash/ash_switches.h
@@ -26,7 +26,6 @@ ASH_EXPORT extern const char kAshWindowAnimationsDisabled[];
ASH_EXPORT extern const char kAuraGoogleDialogFrames[];
ASH_EXPORT extern const char kAuraLegacyPowerButton[];
ASH_EXPORT extern const char kAuraNoShadows[];
-ASH_EXPORT extern const char kAuraPanelManager[];
} // namespace switches
} // namespace ash
diff --git a/ash/shell.cc b/ash/shell.cc
index 5c7b9754..06f39ed 100644
--- a/ash/shell.cc
+++ b/ash/shell.cc
@@ -733,18 +733,15 @@ void Shell::InitLayoutManagersForPrimaryDisplay(
set_shelf(shelf());
// Create Panel layout manager
- if (CommandLine::ForCurrentProcess()->
- HasSwitch(switches::kAuraPanelManager)) {
- aura::Window* panel_container = GetContainer(
- GetPrimaryRootWindow(),
- internal::kShellWindowId_PanelContainer);
- panel_layout_manager_ =
- new internal::PanelLayoutManager(panel_container);
- panel_container->SetEventFilter(
- new internal::PanelWindowEventFilter(
- panel_container, panel_layout_manager_));
- panel_container->SetLayoutManager(panel_layout_manager_);
- }
+ aura::Window* panel_container = GetContainer(
+ GetPrimaryRootWindow(),
+ internal::kShellWindowId_PanelContainer);
+ panel_layout_manager_ =
+ new internal::PanelLayoutManager(panel_container);
+ panel_container->SetEventFilter(
+ new internal::PanelWindowEventFilter(
+ panel_container, panel_layout_manager_));
+ panel_container->SetLayoutManager(panel_layout_manager_);
}
void Shell::DisableWorkspaceGridLayout() {
diff --git a/ash/wm/panel_layout_manager_unittest.cc b/ash/wm/panel_layout_manager_unittest.cc
index 947a892..3a4fd37 100644
--- a/ash/wm/panel_layout_manager_unittest.cc
+++ b/ash/wm/panel_layout_manager_unittest.cc
@@ -30,7 +30,6 @@ class PanelLayoutManagerTest : public ash::test::AshTestBase {
virtual ~PanelLayoutManagerTest() {}
virtual void SetUp() OVERRIDE {
- CommandLine::ForCurrentProcess()->AppendSwitch(switches::kAuraPanelManager);
ash::test::AshTestBase::SetUp();
ASSERT_TRUE(ash::test::TestLauncherDelegate::instance());
diff --git a/chrome/browser/chromeos/login/login_utils.cc b/chrome/browser/chromeos/login/login_utils.cc
index 1962085..a0a69c8 100644
--- a/chrome/browser/chromeos/login/login_utils.cc
+++ b/chrome/browser/chromeos/login/login_utils.cc
@@ -751,7 +751,6 @@ std::string LoginUtilsImpl::GetOffTheRecordCommandLine(
ash::switches::kAshWindowAnimationsDisabled,
ash::switches::kAuraLegacyPowerButton,
ash::switches::kAuraNoShadows,
- ash::switches::kAuraPanelManager,
ash::switches::kAshNotifyDisabled,
::switches::kUIEnablePartialSwap,
::switches::kUIPrioritizeInGpuProcess,
diff --git a/chrome/browser/extensions/api/tabs/tabs.cc b/chrome/browser/extensions/api/tabs/tabs.cc
index 3d80a52..d3e8f449 100644
--- a/chrome/browser/extensions/api/tabs/tabs.cc
+++ b/chrome/browser/extensions/api/tabs/tabs.cc
@@ -554,14 +554,9 @@ bool CreateWindowFunction::RunImpl() {
} else if (type_str == keys::kWindowTypeValuePanel) {
extension_id = GetExtension()->id();
bool use_panels = false;
-#if !defined(OS_ANDROID)
+#if !defined(OS_ANDROID) && !defined(USE_ASH)
use_panels = PanelManager::ShouldUsePanels(extension_id);
#endif
-#if defined(USE_ASH)
- if (CommandLine::ForCurrentProcess()->HasSwitch(
- ash::switches::kAuraPanelManager))
- use_panels = true;
-#endif
if (use_panels)
window_type = Browser::TYPE_PANEL;
else
@@ -576,18 +571,7 @@ bool CreateWindowFunction::RunImpl() {
if (window_type == Browser::TYPE_PANEL) {
std::string title =
web_app::GenerateApplicationNameFromExtensionId(extension_id);
-#if defined(USE_ASH)
- // Aura Panels create a new PanelViewAura.
- if (CommandLine::ForCurrentProcess()->HasSwitch(
- ash::switches::kAuraPanelManager)) {
- // Note: Panels ignore all but the first url provided.
- PanelViewAura* panel_view = new PanelViewAura(title);
- panel_view->Init(window_profile, urls[0], panel_bounds);
- result_.reset(panel_view->extension_window_controller()->
- CreateWindowValueWithTabs());
- return true;
- }
-#else
+#if !defined(USE_ASH)
if (CommandLine::ForCurrentProcess()->HasSwitch(
switches::kBrowserlessPanels)) {
// Note: Panels ignore all but the first url provided.
diff --git a/chrome/browser/extensions/window_open_apitest.cc b/chrome/browser/extensions/window_open_apitest.cc
index 96e10e6..7b1ade1 100644
--- a/chrome/browser/extensions/window_open_apitest.cc
+++ b/chrome/browser/extensions/window_open_apitest.cc
@@ -195,8 +195,8 @@ class WindowOpenPanelTest : public ExtensionApiTest {
}
};
-#if defined(USE_AURA)
-// On Aura, this currently fails because we're currently opening new panel
+#if defined(USE_ASH)
+// On Ash, this currently fails because we're currently opening new panel
// windows as popup windows instead.
#define MAYBE_WindowOpenPanel FAILS_WindowOpenPanel
#else
@@ -215,12 +215,20 @@ IN_PROC_BROWSER_TEST_F(WindowOpenPanelTest, WindowOpenFocus) {
IN_PROC_BROWSER_TEST_F(WindowOpenPanelTest,
CloseNonExtensionPanelsOnUninstall) {
+#if defined(USE_ASH)
+ int num_popups = 4;
+ int num_panels = 0;
+#else
+ int num_popups = 2;
+ int num_panels = 2;
+#endif
ASSERT_TRUE(StartTestServer());
// Setup listeners to wait on strings we expect the extension pages to send.
std::vector<std::string> test_strings;
test_strings.push_back("content_tab");
- test_strings.push_back("content_panel");
+ if (num_panels)
+ test_strings.push_back("content_panel");
test_strings.push_back("content_popup");
ScopedVector<ExtensionTestMessageListener> listeners;
@@ -237,7 +245,7 @@ IN_PROC_BROWSER_TEST_F(WindowOpenPanelTest,
// Two tabs. One in extension domain and one in non-extension domain.
// Two popups - one in extension domain and one in non-extension domain.
// Two panels - one in extension domain and one in non-extension domain.
- WaitForTabsAndPopups(browser(), 2, 2, 2);
+ WaitForTabsAndPopups(browser(), 2, num_popups, num_panels);
// Wait on test messages to make sure the pages loaded.
for (size_t i = 0; i < listeners.size(); ++i)
@@ -247,7 +255,13 @@ IN_PROC_BROWSER_TEST_F(WindowOpenPanelTest,
// Wait for one tab and one popup in non-extension domain to stay open.
// Expect everything else, including panels, to close.
- WaitForTabsAndPopups(browser(), 1, 1, 0);
+#if defined(USE_ASH)
+ // In Ash and additional popup remains for the "panel" non-extension domain.
+ num_popups = 2;
+#else
+ num_popups = 1;
+#endif
+ WaitForTabsAndPopups(browser(), 1, num_popups, 0);
}
IN_PROC_BROWSER_TEST_F(ExtensionApiTest, DISABLED_WindowOpener) {
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc
index 025ceba..72a2123 100644
--- a/chrome/browser/ui/browser.cc
+++ b/chrome/browser/ui/browser.cc
@@ -1202,17 +1202,10 @@ void Browser::ShowFirstRunBubble() {
// Browser, protected:
BrowserWindow* Browser::CreateBrowserWindow() {
- bool create_panel = false;
-#if defined(USE_ASH)
- if (CommandLine::ForCurrentProcess()->HasSwitch(
- ash::switches::kAuraPanelManager))
- create_panel = is_type_panel();
-#elif !defined(OS_CHROMEOS)
- create_panel = is_type_panel();
-#endif
- if (create_panel)
+#if !defined(USE_ASH)
+ if (is_type_panel())
return PanelManager::GetInstance()->CreatePanel(this)->browser_window();
-
+#endif
return BrowserWindow::CreateBrowserWindow(this);
}
diff --git a/chrome/browser/ui/extensions/application_launch.cc b/chrome/browser/ui/extensions/application_launch.cc
index 3609e6f..893cf2f 100644
--- a/chrome/browser/ui/extensions/application_launch.cc
+++ b/chrome/browser/ui/extensions/application_launch.cc
@@ -109,21 +109,7 @@ WebContents* OpenApplication(Profile* profile,
NOTREACHED();
break;
}
- case extension_misc::LAUNCH_PANEL: {
- bool open_panel = false;
-#if defined(USE_ASH)
- open_panel = CommandLine::ForCurrentProcess()->HasSwitch(
- ash::switches::kAuraPanelManager);
-#else
- open_panel = CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kBrowserlessPanels);
-#endif
- if (open_panel) {
- tab = OpenApplicationPanel(profile, extension, override_url);
- break;
- }
- // else fall through to LAUNCH_WINDOW
- }
+ case extension_misc::LAUNCH_PANEL:
case extension_misc::LAUNCH_WINDOW:
tab = OpenApplicationWindow(profile, extension, container,
override_url, NULL);
@@ -140,28 +126,6 @@ WebContents* OpenApplication(Profile* profile,
return tab;
}
-WebContents* OpenApplicationPanel(
- Profile* profile,
- const Extension* extension,
- const GURL& url_input) {
- GURL url = UrlForExtension(extension, url_input);
- std::string app_name =
- web_app::GenerateApplicationNameFromExtensionId(extension->id());
- gfx::Rect panel_bounds;
- panel_bounds.set_width(extension->launch_width());
- panel_bounds.set_height(extension->launch_height());
-#if defined(USE_ASH)
- PanelViewAura* panel_view = new PanelViewAura(app_name);
- panel_view->Init(profile, url, panel_bounds);
- return panel_view->WebContents();
-#else
- Panel* panel = PanelManager::GetInstance()->CreatePanel(
- app_name, profile, url, panel_bounds.size());
- panel->Show();
- return panel->GetWebContents();
-#endif
-}
-
WebContents* OpenApplicationWindow(
Profile* profile,
const Extension* extension,
diff --git a/chrome/browser/ui/extensions/application_launch.h b/chrome/browser/ui/extensions/application_launch.h
index 8895b2b..d147014 100644
--- a/chrome/browser/ui/extensions/application_launch.h
+++ b/chrome/browser/ui/extensions/application_launch.h
@@ -37,12 +37,6 @@ content::WebContents* OpenApplication(Profile* profile,
WindowOpenDisposition disposition,
const CommandLine* command_line);
-// Opens |url| in a new application panel window for the specified url.
-content::WebContents* OpenApplicationPanel(
- Profile* profile,
- const extensions::Extension* extension,
- const GURL& url);
-
// Opens a new application window for the specified url. If |as_panel| is true,
// the application will be opened as a Browser::Type::APP_PANEL in app panel
// window, otherwise it will be opened as as either Browser::Type::APP a.k.a.
diff --git a/chrome/browser/ui/panels/panel_app_browsertest.cc b/chrome/browser/ui/panels/panel_app_browsertest.cc
deleted file mode 100644
index f8cb966..0000000
--- a/chrome/browser/ui/panels/panel_app_browsertest.cc
+++ /dev/null
@@ -1,105 +0,0 @@
-// Copyright (c) 2012 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.
-
-#include "base/command_line.h"
-#include "base/file_path.h"
-#include "chrome/browser/extensions/extension_browsertest.h"
-#include "chrome/browser/extensions/extension_service.h"
-#include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_list.h"
-#include "chrome/browser/ui/extensions/application_launch.h"
-#include "chrome/browser/ui/panels/panel_manager.h"
-#include "chrome/common/chrome_notification_types.h"
-#include "chrome/common/chrome_switches.h"
-#include "chrome/test/base/in_process_browser_test.h"
-#include "chrome/test/base/ui_test_utils.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-#if defined(OS_MACOSX)
-#include "base/mac/scoped_nsautorelease_pool.h"
-#endif
-
-// Refactor has only been done for Mac panels so far.
-#if defined(OS_MACOSX)
-
-class PanelAppBrowserTest : public ExtensionBrowserTest {
- public:
- virtual void SetUpCommandLine(CommandLine* command_line) {
- ExtensionBrowserTest::SetUpCommandLine(command_line);
- command_line->AppendSwitch(switches::kBrowserlessPanels);
- }
-
- void LoadAndLaunchExtension(const char* name) {
-#if defined(OS_MACOSX)
- // Opening panels on a Mac causes NSWindowController of the Panel window
- // to be autoreleased. We need a pool drained after it's done so the test
- // can close correctly. The NSWindowController of the Panel window controls
- // lifetime of the Panel object so we want to release it as soon as
- // possible. In real Chrome, this is done by message pump.
- // On non-Mac platform, this is an empty class.
- base::mac::ScopedNSAutoreleasePool autorelease_pool;
-#endif
-
- EXPECT_TRUE(LoadExtension(test_data_dir_.AppendASCII(name)));
-
- ExtensionService* service = browser()->profile()->GetExtensionService();
- const extensions::Extension* extension = service->GetExtensionById(
- last_loaded_extension_id_, false);
- EXPECT_TRUE(extension);
-
- PanelManager* manager = PanelManager::GetInstance();
- int panel_count = manager->num_panels();
-
- application_launch::OpenApplication(
- browser()->profile(),
- extension,
- // Overriding manifest to open in a panel.
- extension_misc::LAUNCH_PANEL,
- GURL(),
- NEW_WINDOW,
- NULL);
-
- // Now we have a new browser instance.
- EXPECT_EQ(panel_count + 1, manager->num_panels());
- }
-
- void ClosePanelAndWait(Panel* panel) {
- // Closing a panel window may involve several async tasks. Need to use
- // message pump and wait for the notification.
- int panel_count = PanelManager::GetInstance()->num_panels();
- ui_test_utils::WindowedNotificationObserver signal(
- chrome::NOTIFICATION_PANEL_CLOSED,
- content::Source<Panel>(panel));
- panel->Close();
- signal.Wait();
- // Now we have one less panel instance.
- EXPECT_EQ(panel_count - 1, PanelManager::GetInstance()->num_panels());
- }
-};
-
-IN_PROC_BROWSER_TEST_F(PanelAppBrowserTest, OpenAppInPanel) {
- // Start with one browser, new Panel will NOT create another.
- ASSERT_EQ(1u, BrowserList::size());
-
- // No Panels initially.
- PanelManager* panel_manager = PanelManager::GetInstance();
- ASSERT_EQ(0, panel_manager->num_panels()); // No panels initially.
-
- LoadAndLaunchExtension("app_with_panel_container");
-
- // The launch should have created no new browsers.
- ASSERT_EQ(1u, BrowserList::size());
-
- // Now also check that PanelManager has one new Panel under management.
- EXPECT_EQ(1, panel_manager->num_panels());
-
- Panel* panel = panel_manager->panels()[0];
- ClosePanelAndWait(panel);
-
- EXPECT_EQ(0, panel_manager->num_panels());
- EXPECT_EQ(1u, BrowserList::size());
-}
-
-#endif // OS_MACOSX
diff --git a/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc b/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc
index 5c91116..087c16f 100644
--- a/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc
+++ b/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc
@@ -318,31 +318,6 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, OpenAppShortcutTabPref) {
std::string::npos) << new_browser->app_name_;
}
-IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, OpenAppShortcutPanel) {
- // Load an app with launch.container = 'panel'.
- const Extension* extension_app = NULL;
- ASSERT_NO_FATAL_FAILURE(LoadApp("app_with_panel_container", &extension_app));
-
- CommandLine command_line(CommandLine::NO_PROGRAM);
- command_line.AppendSwitchASCII(switches::kAppId, extension_app->id());
- chrome::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ?
- chrome::startup::IS_FIRST_RUN : chrome::startup::IS_NOT_FIRST_RUN;
- StartupBrowserCreatorImpl launch(FilePath(), command_line, first_run);
- ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false));
-
- // The launch should have created a new browser, with a panel type.
- Browser* new_browser = NULL;
- ASSERT_NO_FATAL_FAILURE(FindOneOtherBrowser(&new_browser));
-
- // Expect an app panel.
- EXPECT_TRUE(new_browser->is_type_panel() && new_browser->is_app());
-
- // The new browser's app_name should include the app's ID.
- EXPECT_NE(
- new_browser->app_name_.find(extension_app->id()),
- std::string::npos) << new_browser->app_name_;
-}
-
#endif // !defined(OS_MACOSX)
#endif // !defined(OS_CHROMEOS)
diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi
index 5414fbc..f51b851 100644
--- a/chrome/chrome_tests.gypi
+++ b/chrome/chrome_tests.gypi
@@ -2921,7 +2921,6 @@
'browser/ui/gtk/view_id_util_browsertest.cc',
'browser/ui/intents/web_intent_picker_controller_browsertest.cc',
'browser/ui/login/login_prompt_browsertest.cc',
- 'browser/ui/panels/panel_app_browsertest.cc',
'browser/ui/panels/panel_browser_view_browsertest.cc',
'browser/ui/prefs/prefs_tab_helper_browsertest.cc',
'browser/ui/startup/startup_browser_creator_browsertest.cc',
@@ -3143,7 +3142,6 @@
'browser/printing/cloud_print/test/cloud_print_proxy_process_browsertest.cc',
'browser/service/service_process_control_browsertest.cc',
# chromeos does not use cross-platform panels
- 'browser/ui/panels/panel_app_browsertest.cc',
'browser/ui/panels/panel_browser_view_browsertest.cc',
],
'dependencies': [