Commit 4a391b72 authored by jennb@chromium.org's avatar jennb@chromium.org

Make apps with launch container type panel open as popups.

Re-deleted some code that got accidentally added back in.

BUG=None
TEST=Updated LaunchPanelApp

Review URL: https://chromiumcodereview.appspot.com/10836301

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@152235 0039d316-1c4b-4281-b951-d872f2087c98
parent fa0e3ff9
...@@ -165,10 +165,10 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementApiTest, LaunchPanelApp) { ...@@ -165,10 +165,10 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementApiTest, LaunchPanelApp) {
LoadAndWaitForLaunch("management/launch_app_panel", &app_id); LoadAndWaitForLaunch("management/launch_app_panel", &app_id);
ASSERT_FALSE(HasFatalFailure()); // Stop the test if any ASSERT failed. ASSERT_FALSE(HasFatalFailure()); // Stop the test if any ASSERT failed.
// Find the app's browser. Check that it is a panel. // Find the app's browser. Check that it is a popup.
ASSERT_EQ(2u, browser::GetBrowserCount(browser()->profile())); ASSERT_EQ(2u, browser::GetBrowserCount(browser()->profile()));
Browser* app_browser = FindOtherBrowser(browser()); Browser* app_browser = FindOtherBrowser(browser());
ASSERT_TRUE(app_browser->is_type_panel()); ASSERT_TRUE(app_browser->is_type_popup());
ASSERT_TRUE(app_browser->is_app()); ASSERT_TRUE(app_browser->is_app());
// Close the app panel. // Close the app panel.
...@@ -185,7 +185,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementApiTest, LaunchPanelApp) { ...@@ -185,7 +185,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementApiTest, LaunchPanelApp) {
ASSERT_FALSE(service->GetExtensionById(app_id, true)); ASSERT_FALSE(service->GetExtensionById(app_id, true));
// Set a pref indicating that the user wants to launch in a regular tab. // 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 panel. // This should be ignored, because panel apps always load in a popup.
service->extension_prefs()->SetLaunchType( service->extension_prefs()->SetLaunchType(
app_id, extensions::ExtensionPrefs::LAUNCH_REGULAR); app_id, extensions::ExtensionPrefs::LAUNCH_REGULAR);
...@@ -198,10 +198,10 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementApiTest, LaunchPanelApp) { ...@@ -198,10 +198,10 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementApiTest, LaunchPanelApp) {
ASSERT_EQ(app_id, app_id_new); ASSERT_EQ(app_id, app_id_new);
// Find the app's browser. Apps that should load in a panel ignore // Find the app's browser. Apps that should load in a panel ignore
// prefs, so we should still see the launch in a panel. // prefs, so we should still see the launch in a popup.
ASSERT_EQ(2u, browser::GetBrowserCount(browser()->profile())); ASSERT_EQ(2u, browser::GetBrowserCount(browser()->profile()));
app_browser = FindOtherBrowser(browser()); app_browser = FindOtherBrowser(browser());
ASSERT_TRUE(app_browser->is_type_panel()); ASSERT_TRUE(app_browser->is_type_popup());
ASSERT_TRUE(app_browser->is_app()); ASSERT_TRUE(app_browser->is_app());
} }
......
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
#include "chrome/browser/ui/browser_finder.h" #include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_tabstrip.h" #include "chrome/browser/ui/browser_tabstrip.h"
#include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/panels/panel_manager.h"
#include "chrome/browser/ui/tab_contents/tab_contents.h" #include "chrome/browser/ui/tab_contents/tab_contents.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/web_applications/web_app.h" #include "chrome/browser/web_applications/web_app.h"
...@@ -31,11 +30,6 @@ ...@@ -31,11 +30,6 @@
#include "content/public/browser/web_contents_view.h" #include "content/public/browser/web_contents_view.h"
#include "content/public/common/renderer_preferences.h" #include "content/public/common/renderer_preferences.h"
#if defined(USE_ASH)
#include "ash/ash_switches.h"
#include "chrome/browser/ui/views/ash/panel_view_aura.h"
#endif
using content::WebContents; using content::WebContents;
using extensions::Extension; using extensions::Extension;
using extensions::ExtensionPrefs; using extensions::ExtensionPrefs;
...@@ -69,11 +63,6 @@ GURL UrlForExtension(const Extension* extension, ...@@ -69,11 +63,6 @@ GURL UrlForExtension(const Extension* extension,
return url; return url;
} }
bool AllowPanels(const std::string& app_name) {
return PanelManager::ShouldUsePanels(
web_app::GetExtensionIdFromApplicationName(app_name));
}
WebContents* OpenApplicationWindow( WebContents* OpenApplicationWindow(
Profile* profile, Profile* profile,
const Extension* extension, const Extension* extension,
...@@ -89,11 +78,6 @@ WebContents* OpenApplicationWindow( ...@@ -89,11 +78,6 @@ WebContents* OpenApplicationWindow(
web_app::GenerateApplicationNameFromURL(url); web_app::GenerateApplicationNameFromURL(url);
Browser::Type type = Browser::TYPE_POPUP; Browser::Type type = Browser::TYPE_POPUP;
if (extension &&
container == extension_misc::LAUNCH_PANEL &&
AllowPanels(app_name)) {
type = Browser::TYPE_PANEL;
}
gfx::Rect window_bounds; gfx::Rect window_bounds;
if (extension) { if (extension) {
...@@ -130,12 +114,6 @@ WebContents* OpenApplicationWindow( ...@@ -130,12 +114,6 @@ WebContents* OpenApplicationWindow(
WebContents* contents = tab_contents->web_contents(); WebContents* contents = tab_contents->web_contents();
contents->GetMutableRendererPrefs()->can_accept_load_drops = false; contents->GetMutableRendererPrefs()->can_accept_load_drops = false;
contents->GetRenderViewHost()->SyncRendererPrefs(); contents->GetRenderViewHost()->SyncRendererPrefs();
// TODO(stevenjb): Find the right centralized place to do this. Currently it
// is only done for app tabs in normal browsers through SetExtensionAppById.
if (extension && type == Browser::TYPE_PANEL) {
tab_contents->extension_tab_helper()->
SetExtensionAppIconById(extension->id());
}
browser->window()->Show(); browser->window()->Show();
...@@ -236,28 +214,6 @@ WebContents* OpenApplicationTab(Profile* profile, ...@@ -236,28 +214,6 @@ WebContents* OpenApplicationTab(Profile* profile,
return contents; return contents;
} }
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
}
} // namespace } // namespace
namespace application_launch { namespace application_launch {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment