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/mac/keystone_glue.h" | 5 #import "chrome/browser/mac/keystone_glue.h" |
6 | 6 |
7 #include <sys/mount.h> | 7 #include <sys/mount.h> |
8 #include <sys/param.h> | 8 #include <sys/param.h> |
9 #include <sys/stat.h> | 9 #include <sys/stat.h> |
10 | 10 |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/bind.h" | 13 #include "base/bind.h" |
14 #include "base/location.h" | 14 #include "base/location.h" |
15 #include "base/logging.h" | 15 #include "base/logging.h" |
16 #include "base/mac/authorization_util.h" | 16 #include "base/mac/authorization_util.h" |
17 #include "base/mac/bundle_locations.h" | 17 #include "base/mac/bundle_locations.h" |
18 #include "base/mac/foundation_util.h" | 18 #include "base/mac/foundation_util.h" |
19 #include "base/mac/mac_logging.h" | 19 #include "base/mac/mac_logging.h" |
20 #include "base/mac/scoped_nsautorelease_pool.h" | 20 #include "base/mac/scoped_nsautorelease_pool.h" |
21 #include "base/mac/scoped_nsexception_enabler.h" | |
22 #include "base/memory/ref_counted.h" | 21 #include "base/memory/ref_counted.h" |
23 #include "base/strings/sys_string_conversions.h" | 22 #include "base/strings/sys_string_conversions.h" |
24 #include "base/threading/worker_pool.h" | 23 #include "base/threading/worker_pool.h" |
25 #include "build/build_config.h" | 24 #include "build/build_config.h" |
26 #import "chrome/browser/mac/keystone_registration.h" | 25 #import "chrome/browser/mac/keystone_registration.h" |
27 #include "chrome/browser/mac/obsolete_system.h" | 26 #include "chrome/browser/mac/obsolete_system.h" |
28 #include "chrome/common/chrome_constants.h" | 27 #include "chrome/common/chrome_constants.h" |
29 #include "chrome/common/chrome_version_info.h" | 28 #include "chrome/common/chrome_version_info.h" |
30 #include "chrome/grit/chromium_strings.h" | 29 #include "chrome/grit/chromium_strings.h" |
31 #include "chrome/grit/generated_resources.h" | 30 #include "chrome/grit/generated_resources.h" |
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 if (![registration_ setActiveWithReportingAttributes:profileCountsInformation | 534 if (![registration_ setActiveWithReportingAttributes:profileCountsInformation |
536 error:&reportingError]) { | 535 error:&reportingError]) { |
537 VLOG(1) << [reportingError localizedDescription]; | 536 VLOG(1) << [reportingError localizedDescription]; |
538 } | 537 } |
539 } | 538 } |
540 | 539 |
541 - (void)registerWithKeystone { | 540 - (void)registerWithKeystone { |
542 [self updateStatus:kAutoupdateRegistering version:nil]; | 541 [self updateStatus:kAutoupdateRegistering version:nil]; |
543 | 542 |
544 NSDictionary* parameters = [self keystoneParameters]; | 543 NSDictionary* parameters = [self keystoneParameters]; |
545 BOOL result; | 544 BOOL result = [registration_ registerWithParameters:parameters]; |
546 { | |
547 // TODO(shess): Allows Keystone to throw an exception when | |
548 // /usr/bin/python does not exist (really!). | |
549 // http://crbug.com/86221 and http://crbug.com/87931 | |
550 base::mac::ScopedNSExceptionEnabler enabler; | |
551 result = [registration_ registerWithParameters:parameters]; | |
552 } | |
553 if (!result) { | 545 if (!result) { |
554 [self updateStatus:kAutoupdateRegisterFailed version:nil]; | 546 [self updateStatus:kAutoupdateRegisterFailed version:nil]; |
555 return; | 547 return; |
556 } | 548 } |
557 | 549 |
558 // Upon completion, ksr::KSRegistrationDidCompleteNotification will be | 550 // Upon completion, ksr::KSRegistrationDidCompleteNotification will be |
559 // posted, and -registrationComplete: will be called. | 551 // posted, and -registrationComplete: will be called. |
560 | 552 |
561 // Set up hourly activity pings. | 553 // Set up hourly activity pings. |
562 timer_ = [NSTimer scheduledTimerWithTimeInterval:60 * 60 // One hour | 554 timer_ = [NSTimer scheduledTimerWithTimeInterval:60 * 60 // One hour |
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1144 return [KeystoneGlue defaultKeystoneGlue] != nil; | 1136 return [KeystoneGlue defaultKeystoneGlue] != nil; |
1145 } | 1137 } |
1146 | 1138 |
1147 base::string16 CurrentlyInstalledVersion() { | 1139 base::string16 CurrentlyInstalledVersion() { |
1148 KeystoneGlue* keystoneGlue = [KeystoneGlue defaultKeystoneGlue]; | 1140 KeystoneGlue* keystoneGlue = [KeystoneGlue defaultKeystoneGlue]; |
1149 NSString* version = [keystoneGlue currentlyInstalledVersion]; | 1141 NSString* version = [keystoneGlue currentlyInstalledVersion]; |
1150 return base::SysNSStringToUTF16(version); | 1142 return base::SysNSStringToUTF16(version); |
1151 } | 1143 } |
1152 | 1144 |
1153 } // namespace keystone_glue | 1145 } // namespace keystone_glue |
OLD | NEW |