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

Side by Side Diff: chrome/common/chrome_plugin_util.cc

Issue 270062: Use ASCII strings for switch names. (Closed)
Patch Set: victory Created 11 years, 2 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/sandbox_policy.cc ('k') | chrome/common/chrome_switches.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 std::string* arguments) { 125 std::string* arguments) {
126 const CommandLine cmd = *CommandLine::ForCurrentProcess(); 126 const CommandLine cmd = *CommandLine::ForCurrentProcess();
127 std::wstring arguments_w; 127 std::wstring arguments_w;
128 128
129 // Use the same UserDataDir for new launches that we currently have set. 129 // Use the same UserDataDir for new launches that we currently have set.
130 std::wstring user_data_dir = cmd.GetSwitchValue(switches::kUserDataDir); 130 std::wstring user_data_dir = cmd.GetSwitchValue(switches::kUserDataDir);
131 if (!user_data_dir.empty()) { 131 if (!user_data_dir.empty()) {
132 // Make sure user_data_dir is an absolute path. 132 // Make sure user_data_dir is an absolute path.
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 // TODO(evanm): use CommandLine APIs instead of this.
136 arguments_w += std::wstring(L"--") + ASCIIToWide(switches::kUserDataDir) +
136 L"=\"" + user_data_dir + L"\" "; 137 L"=\"" + user_data_dir + L"\" ";
137 } 138 }
138 } 139 }
139 140
140 // Use '--app=url' instead of just 'url' to launch the browser with minimal 141 // Use '--app=url' instead of just 'url' to launch the browser with minimal
141 // chrome. 142 // chrome.
142 // Note: Do not change this flag! Old Gears shortcuts will break if you do! 143 // Note: Do not change this flag! Old Gears shortcuts will break if you do!
143 std::string url_string(url); 144 std::string url_string(url);
144 ReplaceSubstringsAfterOffset(&url_string, 0, "\"", "\\\""); 145 ReplaceSubstringsAfterOffset(&url_string, 0, "\"", "\\\"");
145 ReplaceSubstringsAfterOffset(&url_string, 0, "%", "%%"); 146 ReplaceSubstringsAfterOffset(&url_string, 0, "%", "%%");
146 ReplaceSubstringsAfterOffset(&url_string, 0, ";", ""); 147 ReplaceSubstringsAfterOffset(&url_string, 0, ";", "");
147 ReplaceSubstringsAfterOffset(&url_string, 0, "$", ""); 148 ReplaceSubstringsAfterOffset(&url_string, 0, "$", "");
148 std::wstring url_w = UTF8ToWide(url_string); 149 std::wstring url_w = UTF8ToWide(url_string);
149 arguments_w += std::wstring(L"--") + switches::kApp + L"=\"" + url_w + L"\""; 150 // TODO(evanm): use CommandLine APIs instead of this.
151 arguments_w += std::wstring(L"--") + ASCIIToWide(switches::kApp) +
152 L"=\"" + url_w + L"\"";
150 153
151 *arguments = WideToUTF8(arguments_w); 154 *arguments = WideToUTF8(arguments_w);
152 155
153 return CPERR_SUCCESS; 156 return CPERR_SUCCESS;
154 } 157 }
155 158
156 // 159 //
157 // Host functions shared by browser and plugin processes 160 // Host functions shared by browser and plugin processes
158 // 161 //
159 162
160 void* STDCALL CPB_Alloc(uint32 size) { 163 void* STDCALL CPB_Alloc(uint32 size) {
161 return malloc(size); 164 return malloc(size);
162 } 165 }
163 166
164 void STDCALL CPB_Free(void* memory) { 167 void STDCALL CPB_Free(void* memory) {
165 free(memory); 168 free(memory);
166 } 169 }
OLDNEW
« no previous file with comments | « chrome/browser/sandbox_policy.cc ('k') | chrome/common/chrome_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698