| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/extension_updater.h" | 5 #include "chrome/browser/extensions/extension_updater.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
| 12 #include "base/file_version_info.h" | 12 #include "base/file_version_info.h" |
| 13 #include "base/histogram.h" | 13 #include "base/histogram.h" |
| 14 #include "base/rand_util.h" | 14 #include "base/rand_util.h" |
| 15 #include "base/sha2.h" | 15 #include "base/sha2.h" |
| 16 #include "base/stl_util-inl.h" | 16 #include "base/stl_util-inl.h" |
| 17 #include "base/string_util.h" | 17 #include "base/string_util.h" |
| 18 #include "base/time.h" | 18 #include "base/time.h" |
| 19 #include "base/thread.h" | 19 #include "base/thread.h" |
| 20 #include "base/version.h" | 20 #include "base/version.h" |
| 21 #include "chrome/app/chrome_version_info.h" | |
| 22 #include "chrome/browser/browser_process.h" | 21 #include "chrome/browser/browser_process.h" |
| 23 #include "chrome/browser/extensions/extension_error_reporter.h" | 22 #include "chrome/browser/extensions/extension_error_reporter.h" |
| 24 #include "chrome/browser/extensions/extensions_service.h" | 23 #include "chrome/browser/extensions/extensions_service.h" |
| 25 #include "chrome/browser/pref_service.h" | 24 #include "chrome/browser/pref_service.h" |
| 26 #include "chrome/browser/profile.h" | 25 #include "chrome/browser/profile.h" |
| 27 #include "chrome/browser/utility_process_host.h" | 26 #include "chrome/browser/utility_process_host.h" |
| 28 #include "chrome/common/chrome_switches.h" | 27 #include "chrome/common/chrome_switches.h" |
| 28 #include "chrome/common/chrome_version_info.h" |
| 29 #include "chrome/common/extensions/extension.h" | 29 #include "chrome/common/extensions/extension.h" |
| 30 #include "chrome/common/extensions/extension_constants.h" | 30 #include "chrome/common/extensions/extension_constants.h" |
| 31 #include "chrome/common/pref_names.h" | 31 #include "chrome/common/pref_names.h" |
| 32 #include "googleurl/src/gurl.h" | 32 #include "googleurl/src/gurl.h" |
| 33 #include "net/base/escape.h" | 33 #include "net/base/escape.h" |
| 34 #include "net/base/load_flags.h" | 34 #include "net/base/load_flags.h" |
| 35 #include "net/url_request/url_request_status.h" | 35 #include "net/url_request/url_request_status.h" |
| 36 | 36 |
| 37 #if defined(OS_WIN) | 37 #if defined(OS_WIN) |
| 38 #include "base/registry.h" | 38 #include "base/registry.h" |
| (...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 753 update_version->CompareTo(*(existing_version.get())) <= 0) { | 753 update_version->CompareTo(*(existing_version.get())) <= 0) { |
| 754 continue; | 754 continue; |
| 755 } | 755 } |
| 756 } | 756 } |
| 757 | 757 |
| 758 // If the update specifies a browser minimum version, do we qualify? | 758 // If the update specifies a browser minimum version, do we qualify? |
| 759 if (update->browser_min_version.length() > 0) { | 759 if (update->browser_min_version.length() > 0) { |
| 760 // First determine the browser version if we haven't already. | 760 // First determine the browser version if we haven't already. |
| 761 if (!browser_version.get()) { | 761 if (!browser_version.get()) { |
| 762 scoped_ptr<FileVersionInfo> version_info( | 762 scoped_ptr<FileVersionInfo> version_info( |
| 763 chrome_app::GetChromeVersionInfo()); | 763 chrome::GetChromeVersionInfo()); |
| 764 if (version_info.get()) { | 764 if (version_info.get()) { |
| 765 browser_version.reset(Version::GetVersionFromString( | 765 browser_version.reset(Version::GetVersionFromString( |
| 766 version_info->product_version())); | 766 version_info->product_version())); |
| 767 } | 767 } |
| 768 } | 768 } |
| 769 scoped_ptr<Version> browser_min_version( | 769 scoped_ptr<Version> browser_min_version( |
| 770 Version::GetVersionFromString(update->browser_min_version)); | 770 Version::GetVersionFromString(update->browser_min_version)); |
| 771 if (browser_version.get() && browser_min_version.get() && | 771 if (browser_version.get() && browser_min_version.get() && |
| 772 browser_min_version->CompareTo(*browser_version.get()) > 0) { | 772 browser_min_version->CompareTo(*browser_version.get()) > 0) { |
| 773 // TODO(asargent) - We may want this to show up in the extensions UI | 773 // TODO(asargent) - We may want this to show up in the extensions UI |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 833 extension_fetcher_.reset( | 833 extension_fetcher_.reset( |
| 834 URLFetcher::Create(kExtensionFetcherId, url, URLFetcher::GET, this)); | 834 URLFetcher::Create(kExtensionFetcherId, url, URLFetcher::GET, this)); |
| 835 extension_fetcher_->set_request_context( | 835 extension_fetcher_->set_request_context( |
| 836 Profile::GetDefaultRequestContext()); | 836 Profile::GetDefaultRequestContext()); |
| 837 extension_fetcher_->set_load_flags(net::LOAD_DO_NOT_SEND_COOKIES | | 837 extension_fetcher_->set_load_flags(net::LOAD_DO_NOT_SEND_COOKIES | |
| 838 net::LOAD_DO_NOT_SAVE_COOKIES); | 838 net::LOAD_DO_NOT_SAVE_COOKIES); |
| 839 extension_fetcher_->Start(); | 839 extension_fetcher_->Start(); |
| 840 current_extension_fetch_ = ExtensionFetch(id, url, hash, version); | 840 current_extension_fetch_ = ExtensionFetch(id, url, hash, version); |
| 841 } | 841 } |
| 842 } | 842 } |
| OLD | NEW |