OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/ui/cocoa/keystone_glue.h" | 5 #import "chrome/browser/ui/cocoa/keystone_glue.h" |
6 | 6 |
7 #include <sys/param.h> | 7 #include <sys/param.h> |
8 #include <sys/mount.h> | 8 #include <sys/mount.h> |
9 | 9 |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "app/l10n_util.h" | 12 #include "app/l10n_util.h" |
13 #import "app/l10n_util_mac.h" | 13 #import "app/l10n_util_mac.h" |
14 #include "base/logging.h" | 14 #include "base/logging.h" |
15 #include "base/mac_util.h" | 15 #include "base/mac_util.h" |
16 #include "base/mac/scoped_nsautorelease_pool.h" | 16 #include "base/mac/scoped_nsautorelease_pool.h" |
17 #include "base/sys_string_conversions.h" | 17 #include "base/sys_string_conversions.h" |
18 #include "base/ref_counted.h" | 18 #include "base/ref_counted.h" |
19 #include "base/task.h" | 19 #include "base/task.h" |
20 #include "base/worker_pool.h" | 20 #include "base/threading/worker_pool.h" |
21 #include "chrome/browser/ui/cocoa/authorization_util.h" | 21 #include "chrome/browser/ui/cocoa/authorization_util.h" |
22 #include "chrome/common/chrome_constants.h" | 22 #include "chrome/common/chrome_constants.h" |
23 #include "grit/chromium_strings.h" | 23 #include "grit/chromium_strings.h" |
24 #include "grit/generated_resources.h" | 24 #include "grit/generated_resources.h" |
25 | 25 |
26 namespace { | 26 namespace { |
27 | 27 |
28 // Provide declarations of the Keystone registration bits needed here. From | 28 // Provide declarations of the Keystone registration bits needed here. From |
29 // KSRegistration.h. | 29 // KSRegistration.h. |
30 typedef enum { | 30 typedef enum { |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 class PerformBridge : public base::RefCountedThreadSafe<PerformBridge> { | 97 class PerformBridge : public base::RefCountedThreadSafe<PerformBridge> { |
98 public: | 98 public: |
99 | 99 |
100 // Call |sel| on |target| with |arg| in a WorkerPool thread. | 100 // Call |sel| on |target| with |arg| in a WorkerPool thread. |
101 // |target| and |arg| are retained, |arg| may be |nil|. | 101 // |target| and |arg| are retained, |arg| may be |nil|. |
102 static void PostPerform(id target, SEL sel, id arg) { | 102 static void PostPerform(id target, SEL sel, id arg) { |
103 DCHECK(target); | 103 DCHECK(target); |
104 DCHECK(sel); | 104 DCHECK(sel); |
105 | 105 |
106 scoped_refptr<PerformBridge> op = new PerformBridge(target, sel, arg); | 106 scoped_refptr<PerformBridge> op = new PerformBridge(target, sel, arg); |
107 WorkerPool::PostTask( | 107 base::WorkerPool::PostTask( |
108 FROM_HERE, NewRunnableMethod(op.get(), &PerformBridge::Run), true); | 108 FROM_HERE, NewRunnableMethod(op.get(), &PerformBridge::Run), true); |
109 } | 109 } |
110 | 110 |
111 // Convenience for the no-argument case. | 111 // Convenience for the no-argument case. |
112 static void PostPerform(id target, SEL sel) { | 112 static void PostPerform(id target, SEL sel) { |
113 PostPerform(target, sel, nil); | 113 PostPerform(target, sel, nil); |
114 } | 114 } |
115 | 115 |
116 private: | 116 private: |
117 // Allow RefCountedThreadSafe<> to delete. | 117 // Allow RefCountedThreadSafe<> to delete. |
(...skipping 830 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
948 return [KeystoneGlue defaultKeystoneGlue] != nil; | 948 return [KeystoneGlue defaultKeystoneGlue] != nil; |
949 } | 949 } |
950 | 950 |
951 string16 CurrentlyInstalledVersion() { | 951 string16 CurrentlyInstalledVersion() { |
952 KeystoneGlue* keystoneGlue = [KeystoneGlue defaultKeystoneGlue]; | 952 KeystoneGlue* keystoneGlue = [KeystoneGlue defaultKeystoneGlue]; |
953 NSString* version = [keystoneGlue currentlyInstalledVersion]; | 953 NSString* version = [keystoneGlue currentlyInstalledVersion]; |
954 return base::SysNSStringToUTF16(version); | 954 return base::SysNSStringToUTF16(version); |
955 } | 955 } |
956 | 956 |
957 } // namespace keystone_glue | 957 } // namespace keystone_glue |
OLD | NEW |