| 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 #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" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "googleurl/src/gurl.h" | 21 #include "googleurl/src/gurl.h" |
| 22 #include "net/base/escape.h" | 22 #include "net/base/escape.h" |
| 23 #include "net/url_request/url_request_status.h" | 23 #include "net/url_request/url_request_status.h" |
| 24 #include "libxml/tree.h" | 24 #include "libxml/tree.h" |
| 25 | 25 |
| 26 const char* ExtensionUpdater::kExpectedGupdateProtocol = "2.0"; | 26 const char* ExtensionUpdater::kExpectedGupdateProtocol = "2.0"; |
| 27 const char* ExtensionUpdater::kExpectedGupdateXmlns = | 27 const char* ExtensionUpdater::kExpectedGupdateXmlns = |
| 28 "http://www.google.com/update2/response"; | 28 "http://www.google.com/update2/response"; |
| 29 | 29 |
| 30 // For sanity checking on update frequency - enforced in release mode only. | 30 // For sanity checking on update frequency - enforced in release mode only. |
| 31 static const int kMinUpdateFrequencySeconds = 60 * 60; // 1 hour | 31 static const int kMinUpdateFrequencySeconds = 30; |
| 32 static const int kMaxUpdateFrequencySeconds = 60 * 60 * 24 * 7; // 7 days | 32 static const int kMaxUpdateFrequencySeconds = 60 * 60 * 24 * 7; // 7 days |
| 33 | 33 |
| 34 // A utility class to do file handling on the file I/O thread. | 34 // A utility class to do file handling on the file I/O thread. |
| 35 class ExtensionUpdaterFileHandler | 35 class ExtensionUpdaterFileHandler |
| 36 : public base::RefCountedThreadSafe<ExtensionUpdaterFileHandler> { | 36 : public base::RefCountedThreadSafe<ExtensionUpdaterFileHandler> { |
| 37 public: | 37 public: |
| 38 ExtensionUpdaterFileHandler(MessageLoop* updater_loop, | 38 ExtensionUpdaterFileHandler(MessageLoop* updater_loop, |
| 39 MessageLoop* file_io_loop) | 39 MessageLoop* file_io_loop) |
| 40 : updater_loop_(updater_loop), file_io_loop_(file_io_loop) {} | 40 : updater_loop_(updater_loop), file_io_loop_(file_io_loop) {} |
| 41 | 41 |
| (...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 578 } | 578 } |
| 579 } else { | 579 } else { |
| 580 extension_fetcher_.reset( | 580 extension_fetcher_.reset( |
| 581 URLFetcher::Create(kExtensionFetcherId, url, URLFetcher::GET, this)); | 581 URLFetcher::Create(kExtensionFetcherId, url, URLFetcher::GET, this)); |
| 582 extension_fetcher_->set_request_context( | 582 extension_fetcher_->set_request_context( |
| 583 Profile::GetDefaultRequestContext()); | 583 Profile::GetDefaultRequestContext()); |
| 584 extension_fetcher_->Start(); | 584 extension_fetcher_->Start(); |
| 585 current_extension_fetch_ = ExtensionFetch(id, url); | 585 current_extension_fetch_ = ExtensionFetch(id, url); |
| 586 } | 586 } |
| 587 } | 587 } |
| OLD | NEW |