Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(25)

Unified Diff: chrome/browser/ui/webui/ntp/app_launcher_handler.cc

Issue 10700130: Introduce LaunchParams struct for opening chrome apps. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Moar cleanup Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/webui/ntp/app_launcher_handler.cc
diff --git a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
index 60f19ff1be6baf8fa9bdcbc8bfa1c5875778b0df..e287d9c070ec0e2f8f90b04b67c6ee31b14ccb70 100644
--- a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
+++ b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
@@ -53,6 +53,8 @@
#include "ui/base/l10n/l10n_util.h"
#include "ui/gfx/codec/png_codec.h"
+using application_launch::LaunchParams;
+using application_launch::OpenApplication;
using content::WebContents;
using extensions::Extension;
@@ -533,16 +535,16 @@ void AppLauncherHandler::HandleLaunchApp(const ListValue* args) {
RecordWebStoreLaunch(url.find("chrome-ntp-promo") != std::string::npos);
}
- if (disposition == NEW_FOREGROUND_TAB || disposition == NEW_BACKGROUND_TAB) {
+ if (disposition == NEW_FOREGROUND_TAB || disposition == NEW_BACKGROUND_TAB ||
+ disposition == NEW_WINDOW) {
// TODO(jamescook): Proper support for background tabs.
- application_launch::OpenApplication(
- profile, extension, extension_misc::LAUNCH_TAB, GURL(url), disposition,
- NULL);
- } else if (disposition == NEW_WINDOW) {
- // Force a new window open.
- application_launch::OpenApplication(
- profile, extension, extension_misc::LAUNCH_WINDOW, GURL(url),
- disposition, NULL);
+ LaunchParams params(profile, extension,
+ disposition == NEW_WINDOW ?
+ extension_misc::LAUNCH_WINDOW :
+ extension_misc::LAUNCH_TAB,
+ disposition);
+ params.override_url = GURL(url);
+ OpenApplication(params);
} else {
// Look at preference to find the right launch container. If no preference
// is set, launch as a regular tab.
@@ -558,9 +560,10 @@ void AppLauncherHandler::HandleLaunchApp(const ListValue* args) {
if (browser)
old_contents = chrome::GetActiveWebContents(browser);
- WebContents* new_contents = application_launch::OpenApplication(
- profile, extension, launch_container, GURL(url),
- old_contents ? CURRENT_TAB : NEW_FOREGROUND_TAB, NULL);
+ LaunchParams params(profile, extension, launch_container,
+ old_contents ? CURRENT_TAB : NEW_FOREGROUND_TAB);
+ params.override_url = GURL(url);
+ WebContents* new_contents = OpenApplication(params);
// This will also destroy the handler, so do not perform any actions after.
if (new_contents != old_contents && browser && browser->tab_count() > 1)

Powered by Google App Engine
This is Rietveld 408576698