| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "stdafx.h" | 5 #include "stdafx.h" |
| 6 #include "chrome_url_launch_handler.h" | 6 #include "chrome_url_launch_handler.h" |
| 7 #include "chrome_app_view.h" | 7 #include "chrome_app_view.h" |
| 8 | 8 |
| 9 #include <assert.h> | 9 #include <assert.h> |
| 10 #include <shellapi.h> | 10 #include <shellapi.h> |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 // find the URL to launch the first argument is used. If any other parameters | 101 // find the URL to launch the first argument is used. If any other parameters |
| 102 // are encoded in |launch_args| they are ignored. | 102 // are encoded in |launch_args| they are ignored. |
| 103 base::string16 ChromeUrlLaunchHandler::GetUrlFromLaunchArgs( | 103 base::string16 ChromeUrlLaunchHandler::GetUrlFromLaunchArgs( |
| 104 const base::string16& launch_args) { | 104 const base::string16& launch_args) { |
| 105 if (launch_args == L"opennewwindow") { | 105 if (launch_args == L"opennewwindow") { |
| 106 VLOG(1) << "Returning new tab url"; | 106 VLOG(1) << "Returning new tab url"; |
| 107 return L"chrome://newtab"; | 107 return L"chrome://newtab"; |
| 108 } | 108 } |
| 109 base::string16 dummy_command_line(L"dummy.exe "); | 109 base::string16 dummy_command_line(L"dummy.exe "); |
| 110 dummy_command_line.append(launch_args); | 110 dummy_command_line.append(launch_args); |
| 111 CommandLine command_line = CommandLine::FromString(dummy_command_line); | 111 base::CommandLine command_line = |
| 112 CommandLine::StringVector args = command_line.GetArgs(); | 112 base::CommandLine::FromString(dummy_command_line); |
| 113 base::CommandLine::StringVector args = command_line.GetArgs(); |
| 113 if (args.size() > 0) | 114 if (args.size() > 0) |
| 114 return args[0]; | 115 return args[0]; |
| 115 | 116 |
| 116 return base::string16(); | 117 return base::string16(); |
| 117 } | 118 } |
| 118 | 119 |
| 119 void ChromeUrlLaunchHandler::HandleLaunch( | 120 void ChromeUrlLaunchHandler::HandleLaunch( |
| 120 winapp::Activation::ILaunchActivatedEventArgs* args) { | 121 winapp::Activation::ILaunchActivatedEventArgs* args) { |
| 121 mswrw::HString launch_args; | 122 mswrw::HString launch_args; |
| 122 args->get_Arguments(launch_args.GetAddressOf()); | 123 args->get_Arguments(launch_args.GetAddressOf()); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 if (url) { | 198 if (url) { |
| 198 VLOG(1) << "Posting url:" << url; | 199 VLOG(1) << "Posting url:" << url; |
| 199 PostMessage(globals.host_windows.front().first, navigation_search_message, | 200 PostMessage(globals.host_windows.front().first, navigation_search_message, |
| 200 reinterpret_cast<WPARAM>(url), 0); | 201 reinterpret_cast<WPARAM>(url), 0); |
| 201 } else { | 202 } else { |
| 202 VLOG(1) << "Posting search string:" << search_string; | 203 VLOG(1) << "Posting search string:" << search_string; |
| 203 PostMessage(globals.host_windows.front().first, navigation_search_message, | 204 PostMessage(globals.host_windows.front().first, navigation_search_message, |
| 204 0, reinterpret_cast<LPARAM>(search_string)); | 205 0, reinterpret_cast<LPARAM>(search_string)); |
| 205 } | 206 } |
| 206 } | 207 } |
| OLD | NEW |