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

Unified Diff: win8/metro_driver/chrome_url_launch_handler.cc

Issue 10914160: Manually merging remaining Win8 changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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
« no previous file with comments | « win8/metro_driver/chrome_app_view.cc ('k') | win8/metro_driver/metro_driver.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: win8/metro_driver/chrome_url_launch_handler.cc
diff --git a/win8/metro_driver/chrome_url_launch_handler.cc b/win8/metro_driver/chrome_url_launch_handler.cc
index 866bccce66b10150ce3bd326fa7123c05537de3a..7a9a6073cfa647eaa1db5f7b50af3d78e36ce9f8 100644
--- a/win8/metro_driver/chrome_url_launch_handler.cc
+++ b/win8/metro_driver/chrome_url_launch_handler.cc
@@ -11,7 +11,7 @@
#include <shlobj.h>
#include <string>
-#include "base/string_tokenizer.h"
+#include "base/command_line.h"
#include "winrt_utils.h"
@@ -97,22 +97,18 @@ void ChromeUrlLaunchHandler::HandleProtocolLaunch(
InitiateNavigationOrSearchRequest(globals.navigation_url.c_str(), 0);
}
-// The LaunchArgs are in a semi-color separated key_name=key_value list. At
-// the moment the only key_name understaood is "url".
+// |launch_args| is an encoded command line, minus the executable name. To
+// find the URL to launch the first argument is used. If any other parameters
+// are encoded in |launch_args| they are ignored.
string16 ChromeUrlLaunchHandler::GetUrlFromLaunchArgs(
const string16& launch_args) {
- WStringTokenizer tokenizer(launch_args, L";=");
- bool next_is_url = false;
- while (tokenizer.GetNext()) {
- if (next_is_url)
- return tokenizer.token();
- if (tokenizer.token() == L"url")
- next_is_url = true;
- }
- if (launch_args == L"opennewwindow") {
- DVLOG(1) << "Returning new tab url";
- return L"chrome://newtab";
- }
+ string16 dummy_command_line(L"dummy.exe ");
+ dummy_command_line.append(launch_args);
+ CommandLine command_line = CommandLine::FromString(dummy_command_line);
+ CommandLine::StringVector args = command_line.GetArgs();
+ if (args.size() > 0)
+ return args[0];
+
return string16();
}
« no previous file with comments | « win8/metro_driver/chrome_app_view.cc ('k') | win8/metro_driver/metro_driver.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698