| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "chrome/common/chrome_plugin_util.h" | 5 #include "chrome/common/chrome_plugin_util.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 if (file_util::AbsolutePath(&user_data_dir) && | 133 if (file_util::AbsolutePath(&user_data_dir) && |
| 134 file_util::PathExists(user_data_dir)) { | 134 file_util::PathExists(user_data_dir)) { |
| 135 arguments_w += std::wstring(L"--") + switches::kUserDataDir + | 135 arguments_w += std::wstring(L"--") + switches::kUserDataDir + |
| 136 L"=\"" + user_data_dir + L"\" "; | 136 L"=\"" + user_data_dir + L"\" "; |
| 137 } | 137 } |
| 138 } | 138 } |
| 139 | 139 |
| 140 // Use '--app=url' instead of just 'url' to launch the browser with minimal | 140 // Use '--app=url' instead of just 'url' to launch the browser with minimal |
| 141 // chrome. | 141 // chrome. |
| 142 // Note: Do not change this flag! Old Gears shortcuts will break if you do! | 142 // Note: Do not change this flag! Old Gears shortcuts will break if you do! |
| 143 std::wstring url_w = UTF8ToWide(url); | 143 std::string url_string(url); |
| 144 arguments_w += std::wstring(L"--") + switches::kApp + L'=' + url_w; | 144 ReplaceSubstringsAfterOffset(&url_string, 0, "\"", "\\\""); |
| 145 ReplaceSubstringsAfterOffset(&url_string, 0, "%", "%%"); |
| 146 ReplaceSubstringsAfterOffset(&url_string, 0, ";", ""); |
| 147 ReplaceSubstringsAfterOffset(&url_string, 0, "$", ""); |
| 148 std::wstring url_w = UTF8ToWide(url_string); |
| 149 arguments_w += std::wstring(L"--") + switches::kApp + L"=\"" + url_w + L"\""; |
| 145 | 150 |
| 146 *arguments = WideToUTF8(arguments_w); | 151 *arguments = WideToUTF8(arguments_w); |
| 147 | 152 |
| 148 return CPERR_SUCCESS; | 153 return CPERR_SUCCESS; |
| 149 } | 154 } |
| 150 | 155 |
| 151 // | 156 // |
| 152 // Host functions shared by browser and plugin processes | 157 // Host functions shared by browser and plugin processes |
| 153 // | 158 // |
| 154 | 159 |
| 155 void* STDCALL CPB_Alloc(uint32 size) { | 160 void* STDCALL CPB_Alloc(uint32 size) { |
| 156 return malloc(size); | 161 return malloc(size); |
| 157 } | 162 } |
| 158 | 163 |
| 159 void STDCALL CPB_Free(void* memory) { | 164 void STDCALL CPB_Free(void* memory) { |
| 160 free(memory); | 165 free(memory); |
| 161 } | 166 } |
| OLD | NEW |