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

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

Issue 58004: Make app installation work when --user-data-dir is specified. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 const CommandLine cmd = *CommandLine::ForCurrentProcess(); 130 const CommandLine cmd = *CommandLine::ForCurrentProcess();
131 std::wstring arguments_w; 131 std::wstring arguments_w;
132 132
133 // Use the same UserDataDir for new launches that we currently have set. 133 // Use the same UserDataDir for new launches that we currently have set.
134 std::wstring user_data_dir = cmd.GetSwitchValue(switches::kUserDataDir); 134 std::wstring user_data_dir = cmd.GetSwitchValue(switches::kUserDataDir);
135 if (!user_data_dir.empty()) { 135 if (!user_data_dir.empty()) {
136 // Make sure user_data_dir is an absolute path. 136 // Make sure user_data_dir is an absolute path.
137 if (file_util::AbsolutePath(&user_data_dir) && 137 if (file_util::AbsolutePath(&user_data_dir) &&
138 file_util::PathExists(user_data_dir)) { 138 file_util::PathExists(user_data_dir)) {
139 arguments_w += std::wstring(L"--") + switches::kUserDataDir + 139 arguments_w += std::wstring(L"--") + switches::kUserDataDir +
140 L'=' + user_data_dir; 140 L"=\"" + user_data_dir + L"\" ";
141 } 141 }
142 } 142 }
143 143
144 // Use '--app=url' instead of just 'url' to launch the browser with minimal 144 // Use '--app=url' instead of just 'url' to launch the browser with minimal
145 // chrome. 145 // chrome.
146 // Note: Do not change this flag! Old Gears shortcuts will break if you do! 146 // Note: Do not change this flag! Old Gears shortcuts will break if you do!
147 std::wstring url_w = UTF8ToWide(url); 147 std::wstring url_w = UTF8ToWide(url);
148 arguments_w += std::wstring(L"--") + switches::kApp + L'=' + url_w; 148 arguments_w += std::wstring(L"--") + switches::kApp + L'=' + url_w;
149 149
150 *arguments = WideToUTF8(arguments_w); 150 *arguments = WideToUTF8(arguments_w);
151 151
152 return CPERR_SUCCESS; 152 return CPERR_SUCCESS;
153 } 153 }
154 154
155 // 155 //
156 // Host functions shared by browser and plugin processes 156 // Host functions shared by browser and plugin processes
157 // 157 //
158 158
159 void* STDCALL CPB_Alloc(uint32 size) { 159 void* STDCALL CPB_Alloc(uint32 size) {
160 return malloc(size); 160 return malloc(size);
161 } 161 }
162 162
163 void STDCALL CPB_Free(void* memory) { 163 void STDCALL CPB_Free(void* memory) {
164 free(memory); 164 free(memory);
165 } 165 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698