| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/web_resource/web_resource_service.h" | 5 #include "chrome/browser/web_resource/web_resource_service.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
| 11 #include "base/time.h" | 11 #include "base/time.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 // cookies, for example. | 77 // cookies, for example. |
| 78 url_fetcher_->set_load_flags(net::LOAD_DISABLE_CACHE | | 78 url_fetcher_->set_load_flags(net::LOAD_DISABLE_CACHE | |
| 79 net::LOAD_DO_NOT_SAVE_COOKIES); | 79 net::LOAD_DO_NOT_SAVE_COOKIES); |
| 80 url_fetcher_->set_request_context(Profile::GetDefaultRequestContext()); | 80 url_fetcher_->set_request_context(Profile::GetDefaultRequestContext()); |
| 81 url_fetcher_->Start(); | 81 url_fetcher_->Start(); |
| 82 } | 82 } |
| 83 | 83 |
| 84 // From URLFetcher::Delegate. | 84 // From URLFetcher::Delegate. |
| 85 void OnURLFetchComplete(const URLFetcher* source, | 85 void OnURLFetchComplete(const URLFetcher* source, |
| 86 const GURL& url, | 86 const GURL& url, |
| 87 const URLRequestStatus& status, | 87 const net::URLRequestStatus& status, |
| 88 int response_code, | 88 int response_code, |
| 89 const ResponseCookies& cookies, | 89 const ResponseCookies& cookies, |
| 90 const std::string& data) { | 90 const std::string& data) { |
| 91 // Delete the URLFetcher when this function exits. | 91 // Delete the URLFetcher when this function exits. |
| 92 scoped_ptr<URLFetcher> clean_up_fetcher(url_fetcher_.release()); | 92 scoped_ptr<URLFetcher> clean_up_fetcher(url_fetcher_.release()); |
| 93 | 93 |
| 94 // Don't parse data if attempt to download was unsuccessful. | 94 // Don't parse data if attempt to download was unsuccessful. |
| 95 // Stop loading new web resource data, and silently exit. | 95 // Stop loading new web resource data, and silently exit. |
| 96 if (!status.is_success() || (response_code != 200)) | 96 if (!status.is_success() || (response_code != 200)) |
| 97 return; | 97 return; |
| (...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 profile->GetProfileSyncService()) == sync_ui_util::SYNCED) || | 521 profile->GetProfileSyncService()) == sync_ui_util::SYNCED) || |
| 522 has_extensions; | 522 has_extensions; |
| 523 | 523 |
| 524 return !promo_closed && | 524 return !promo_closed && |
| 525 promo_options && | 525 promo_options && |
| 526 g_browser_process->GetApplicationLocale() == "en-US"; | 526 g_browser_process->GetApplicationLocale() == "en-US"; |
| 527 } | 527 } |
| 528 | 528 |
| 529 } // namespace WebResourceService | 529 } // namespace WebResourceService |
| 530 | 530 |
| OLD | NEW |