| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/extensions/chrome_extensions_browser_client.h" | 5 #include "chrome/browser/extensions/chrome_extensions_browser_client.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/version.h" | 10 #include "base/version.h" |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 return false; | 206 return false; |
| 207 | 207 |
| 208 PrefService* pref_service = extension_prefs->pref_service(); | 208 PrefService* pref_service = extension_prefs->pref_service(); |
| 209 base::Version last_version; | 209 base::Version last_version; |
| 210 if (pref_service->HasPrefPath(pref_names::kLastChromeVersion)) { | 210 if (pref_service->HasPrefPath(pref_names::kLastChromeVersion)) { |
| 211 std::string last_version_str = | 211 std::string last_version_str = |
| 212 pref_service->GetString(pref_names::kLastChromeVersion); | 212 pref_service->GetString(pref_names::kLastChromeVersion); |
| 213 last_version = base::Version(last_version_str); | 213 last_version = base::Version(last_version_str); |
| 214 } | 214 } |
| 215 | 215 |
| 216 std::string current_version = version_info::GetVersionNumber(); | 216 std::string current_version_str = version_info::GetVersionNumber(); |
| 217 pref_service->SetString(pref_names::kLastChromeVersion, | 217 base::Version current_version(current_version_str); |
| 218 current_version); | 218 pref_service->SetString(pref_names::kLastChromeVersion, current_version_str); |
| 219 | 219 |
| 220 // If there was no version string in prefs, assume we're out of date. | 220 // If there was no version string in prefs, assume we're out of date. |
| 221 if (!last_version.IsValid()) | 221 if (!last_version.IsValid()) |
| 222 return true; | 222 return true; |
| 223 // If the current version string is invalid, assume we didn't update. |
| 224 if (!current_version.IsValid()) |
| 225 return false; |
| 223 | 226 |
| 224 return last_version.IsOlderThan(current_version); | 227 return last_version < current_version; |
| 225 } | 228 } |
| 226 | 229 |
| 227 void ChromeExtensionsBrowserClient::PermitExternalProtocolHandler() { | 230 void ChromeExtensionsBrowserClient::PermitExternalProtocolHandler() { |
| 228 ExternalProtocolHandler::PermitLaunchUrl(); | 231 ExternalProtocolHandler::PermitLaunchUrl(); |
| 229 } | 232 } |
| 230 | 233 |
| 231 bool ChromeExtensionsBrowserClient::IsRunningInForcedAppMode() { | 234 bool ChromeExtensionsBrowserClient::IsRunningInForcedAppMode() { |
| 232 return chrome::IsRunningInForcedAppMode(); | 235 return chrome::IsRunningInForcedAppMode(); |
| 233 } | 236 } |
| 234 | 237 |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 } | 391 } |
| 389 | 392 |
| 390 scoped_refptr<update_client::UpdateClient> | 393 scoped_refptr<update_client::UpdateClient> |
| 391 ChromeExtensionsBrowserClient::CreateUpdateClient( | 394 ChromeExtensionsBrowserClient::CreateUpdateClient( |
| 392 content::BrowserContext* context) { | 395 content::BrowserContext* context) { |
| 393 return update_client::UpdateClientFactory( | 396 return update_client::UpdateClientFactory( |
| 394 make_scoped_refptr(new ChromeUpdateClientConfig(context))); | 397 make_scoped_refptr(new ChromeUpdateClientConfig(context))); |
| 395 } | 398 } |
| 396 | 399 |
| 397 } // namespace extensions | 400 } // namespace extensions |
| OLD | NEW |