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 #include "chrome/browser/ui/webui/help/version_updater_mac.h" | 5 #include "chrome/browser/ui/webui/help/version_updater_mac.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "chrome/browser/lifetime/application_lifetime.h" |
9 #import "chrome/browser/mac/keystone_glue.h" | 10 #import "chrome/browser/mac/keystone_glue.h" |
10 #include "chrome/browser/ui/browser_list.h" | |
11 #include "grit/chromium_strings.h" | 11 #include "grit/chromium_strings.h" |
12 #include "grit/generated_resources.h" | 12 #include "grit/generated_resources.h" |
13 #include "ui/base/l10n/l10n_util.h" | 13 #include "ui/base/l10n/l10n_util.h" |
14 | 14 |
15 // KeystoneObserver is a simple notification observer for Keystone status | 15 // KeystoneObserver is a simple notification observer for Keystone status |
16 // updates. It will be created and managed by VersionUpdaterMac. | 16 // updates. It will be created and managed by VersionUpdaterMac. |
17 @interface KeystoneObserver : NSObject { | 17 @interface KeystoneObserver : NSObject { |
18 @private | 18 @private |
19 VersionUpdaterMac* versionUpdater_; // Weak. | 19 VersionUpdaterMac* versionUpdater_; // Weak. |
20 } | 20 } |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 // UpdateStatus() will be called with a status indicating a result of the | 120 // UpdateStatus() will be called with a status indicating a result of the |
121 // installation attempt. | 121 // installation attempt. |
122 // | 122 // |
123 // If the promotion was successful, KeystoneGlue will re-register the ticket | 123 // If the promotion was successful, KeystoneGlue will re-register the ticket |
124 // and UpdateStatus() will be called again indicating first that | 124 // and UpdateStatus() will be called again indicating first that |
125 // registration is in progress and subsequently that it has completed. | 125 // registration is in progress and subsequently that it has completed. |
126 } | 126 } |
127 | 127 |
128 void VersionUpdaterMac::RelaunchBrowser() const { | 128 void VersionUpdaterMac::RelaunchBrowser() const { |
129 // Tell the Broweser to restart if possible. | 129 // Tell the Broweser to restart if possible. |
130 BrowserList::AttemptRestart(); | 130 browser::AttemptRestart(); |
131 } | 131 } |
132 | 132 |
133 void VersionUpdaterMac::UpdateStatus(NSDictionary* dictionary) { | 133 void VersionUpdaterMac::UpdateStatus(NSDictionary* dictionary) { |
134 AutoupdateStatus keystone_status = static_cast<AutoupdateStatus>( | 134 AutoupdateStatus keystone_status = static_cast<AutoupdateStatus>( |
135 [[dictionary objectForKey:kAutoupdateStatusStatus] intValue]); | 135 [[dictionary objectForKey:kAutoupdateStatusStatus] intValue]); |
136 | 136 |
137 bool enable_promote_button = true; | 137 bool enable_promote_button = true; |
138 string16 message; | 138 string16 message; |
139 | 139 |
140 Status status; | 140 Status status; |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 } else if (recent_status == kAutoupdatePromoting || | 234 } else if (recent_status == kAutoupdatePromoting || |
235 recent_status == kAutoupdatePromoteFailed) { | 235 recent_status == kAutoupdatePromoteFailed) { |
236 // Show promotion UI because the user either just clicked that button or | 236 // Show promotion UI because the user either just clicked that button or |
237 // because the user should be able to click it again. | 237 // because the user should be able to click it again. |
238 show_promote_button_ = true; | 238 show_promote_button_ = true; |
239 } else { | 239 } else { |
240 // Show the promote button if promotion is a possibility. | 240 // Show the promote button if promotion is a possibility. |
241 show_promote_button_ = [keystone_glue wantsPromotion]; | 241 show_promote_button_ = [keystone_glue wantsPromotion]; |
242 } | 242 } |
243 } | 243 } |
OLD | NEW |