| 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/chromeos/customization_document.h" | 5 #include "chrome/browser/chromeos/customization_document.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 "base/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| 11 #include "base/json/json_reader.h" | 11 #include "base/json/json_reader.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/string_tokenizer.h" | 13 #include "base/string_tokenizer.h" |
| 14 #include "base/string_util.h" | 14 #include "base/string_util.h" |
| 15 #include "base/time.h" | 15 #include "base/time.h" |
| 16 #include "base/utf_string_conversions.h" | 16 #include "base/utf_string_conversions.h" |
| 17 #include "chrome/browser/browser_process.h" | 17 #include "chrome/browser/browser_process.h" |
| 18 #include "chrome/browser/chromeos/cros/cros_library.h" | 18 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 19 #include "chrome/browser/chromeos/cros/network_library.h" | 19 #include "chrome/browser/chromeos/cros/network_library.h" |
| 20 #include "chrome/browser/chromeos/login/wizard_controller.h" | 20 #include "chrome/browser/chromeos/login/wizard_controller.h" |
| 21 #include "chrome/browser/chromeos/system/statistics_provider.h" | 21 #include "chrome/browser/chromeos/system/statistics_provider.h" |
| 22 #include "chrome/browser/prefs/pref_service.h" | 22 #include "chrome/browser/prefs/pref_service.h" |
| 23 #include "chrome/browser/profiles/profile_manager.h" | 23 #include "chrome/browser/profiles/profile_manager.h" |
| 24 #include "content/public/browser/browser_thread.h" | 24 #include "content/public/browser/browser_thread.h" |
| 25 #include "content/public/common/content_url_request_user_data.h" |
| 25 #include "content/public/common/url_fetcher.h" | 26 #include "content/public/common/url_fetcher.h" |
| 26 | 27 |
| 27 using content::BrowserThread; | 28 using content::BrowserThread; |
| 28 | 29 |
| 29 // Manifest attributes names. | 30 // Manifest attributes names. |
| 30 | 31 |
| 31 namespace { | 32 namespace { |
| 32 | 33 |
| 33 const char kVersionAttr[] = "version"; | 34 const char kVersionAttr[] = "version"; |
| 34 const char kDefaultAttr[] = "default"; | 35 const char kDefaultAttr[] = "default"; |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 << file.value(); | 295 << file.value(); |
| 295 } | 296 } |
| 296 } | 297 } |
| 297 | 298 |
| 298 void ServicesCustomizationDocument::StartFileFetch() { | 299 void ServicesCustomizationDocument::StartFileFetch() { |
| 299 DCHECK(url_.is_valid()); | 300 DCHECK(url_.is_valid()); |
| 300 url_fetcher_.reset(content::URLFetcher::Create( | 301 url_fetcher_.reset(content::URLFetcher::Create( |
| 301 url_, content::URLFetcher::GET, this)); | 302 url_, content::URLFetcher::GET, this)); |
| 302 url_fetcher_->SetRequestContext( | 303 url_fetcher_->SetRequestContext( |
| 303 ProfileManager::GetDefaultProfile()->GetRequestContext()); | 304 ProfileManager::GetDefaultProfile()->GetRequestContext()); |
| 305 // TODO(jochen): Do cookie audit. |
| 306 url_fetcher_->SetContentURLRequestUserData( |
| 307 new content::ContentURLRequestUserData()); |
| 304 url_fetcher_->Start(); | 308 url_fetcher_->Start(); |
| 305 } | 309 } |
| 306 | 310 |
| 307 void ServicesCustomizationDocument::OnURLFetchComplete( | 311 void ServicesCustomizationDocument::OnURLFetchComplete( |
| 308 const content::URLFetcher* source) { | 312 const content::URLFetcher* source) { |
| 309 if (source->GetResponseCode() == 200) { | 313 if (source->GetResponseCode() == 200) { |
| 310 std::string data; | 314 std::string data; |
| 311 source->GetResponseAsString(&data); | 315 source->GetResponseAsString(&data); |
| 312 LoadManifestFromString(data); | 316 LoadManifestFromString(data); |
| 313 } else { | 317 } else { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 337 locale, kAppContentAttr, kInitialStartPageAttr); | 341 locale, kAppContentAttr, kInitialStartPageAttr); |
| 338 } | 342 } |
| 339 | 343 |
| 340 std::string ServicesCustomizationDocument::GetSupportPage( | 344 std::string ServicesCustomizationDocument::GetSupportPage( |
| 341 const std::string& locale) const { | 345 const std::string& locale) const { |
| 342 return GetLocaleSpecificString( | 346 return GetLocaleSpecificString( |
| 343 locale, kAppContentAttr, kSupportPageAttr); | 347 locale, kAppContentAttr, kSupportPageAttr); |
| 344 } | 348 } |
| 345 | 349 |
| 346 } // namespace chromeos | 350 } // namespace chromeos |
| OLD | NEW |