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 #import "chrome/browser/app_controller_mac.h" | 5 #import "chrome/browser/app_controller_mac.h" |
6 | 6 |
7 #include "apps/app_shim/app_shim_mac.h" | 7 #include "apps/app_shim/app_shim_mac.h" |
8 #include "apps/app_shim/extension_app_shim_handler_mac.h" | 8 #include "apps/app_shim/extension_app_shim_handler_mac.h" |
9 #include "apps/shell_window_registry.h" | 9 #include "apps/shell_window_registry.h" |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
162 // Record the location of the application bundle (containing the main framework) | 162 // Record the location of the application bundle (containing the main framework) |
163 // from which Chromium was loaded. This is used by app mode shims to find | 163 // from which Chromium was loaded. This is used by app mode shims to find |
164 // Chromium. | 164 // Chromium. |
165 void RecordLastRunAppBundlePath() { | 165 void RecordLastRunAppBundlePath() { |
166 // Going up three levels from |chrome::GetVersionedDirectory()| gives the | 166 // Going up three levels from |chrome::GetVersionedDirectory()| gives the |
167 // real, user-visible app bundle directory. (The alternatives give either the | 167 // real, user-visible app bundle directory. (The alternatives give either the |
168 // framework's path or the initial app's path, which may be an app mode shim | 168 // framework's path or the initial app's path, which may be an app mode shim |
169 // or a unit test.) | 169 // or a unit test.) |
170 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 170 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
171 | 171 |
172 base::FilePath appBundlePath = | 172 base::FilePath app_bundle_path = |
173 chrome::GetVersionedDirectory().DirName().DirName().DirName(); | 173 chrome::GetVersionedDirectory().DirName().DirName().DirName(); |
174 base::ScopedCFTypeRef<CFStringRef> app_bundle_path_cfstring( | |
175 base::SysUTF8ToCFStringRef(app_bundle_path.value())); | |
Nico
2013/09/16 21:05:28
This on the other hand is just surprising API. Eve
Alexei Svitkine (slow)
2013/09/16 21:07:25
Yeah, we should rename the API.
| |
174 CFPreferencesSetAppValue( | 176 CFPreferencesSetAppValue( |
175 base::mac::NSToCFCast(app_mode::kLastRunAppBundlePathPrefsKey), | 177 base::mac::NSToCFCast(app_mode::kLastRunAppBundlePathPrefsKey), |
176 base::SysUTF8ToCFStringRef(appBundlePath.value()), | 178 app_bundle_path_cfstring, BaseBundleID_CFString()); |
177 BaseBundleID_CFString()); | |
178 | 179 |
179 // Sync after a delay avoid I/O contention on startup; 1500 ms is plenty. | 180 // Sync after a delay avoid I/O contention on startup; 1500 ms is plenty. |
180 BrowserThread::PostDelayedTask( | 181 BrowserThread::PostDelayedTask( |
181 BrowserThread::FILE, FROM_HERE, | 182 BrowserThread::FILE, FROM_HERE, |
182 base::Bind(&PrefsSyncCallback), | 183 base::Bind(&PrefsSyncCallback), |
183 base::TimeDelta::FromMilliseconds(1500)); | 184 base::TimeDelta::FromMilliseconds(1500)); |
184 } | 185 } |
185 | 186 |
186 } // anonymous namespace | 187 } // anonymous namespace |
187 | 188 |
(...skipping 1233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1421 | 1422 |
1422 //--------------------------------------------------------------------------- | 1423 //--------------------------------------------------------------------------- |
1423 | 1424 |
1424 namespace app_controller_mac { | 1425 namespace app_controller_mac { |
1425 | 1426 |
1426 bool IsOpeningNewWindow() { | 1427 bool IsOpeningNewWindow() { |
1427 return g_is_opening_new_window; | 1428 return g_is_opening_new_window; |
1428 } | 1429 } |
1429 | 1430 |
1430 } // namespace app_controller_mac | 1431 } // namespace app_controller_mac |
OLD | NEW |