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/url_fetcher.h" | 25 #include "net/url_request/url_fetcher.h" |
26 | 26 |
27 using content::BrowserThread; | 27 using content::BrowserThread; |
28 | 28 |
29 // Manifest attributes names. | 29 // Manifest attributes names. |
30 | 30 |
31 namespace { | 31 namespace { |
32 | 32 |
33 const char kVersionAttr[] = "version"; | 33 const char kVersionAttr[] = "version"; |
34 const char kDefaultAttr[] = "default"; | 34 const char kDefaultAttr[] = "default"; |
35 const char kInitialLocaleAttr[] = "initial_locale"; | 35 const char kInitialLocaleAttr[] = "initial_locale"; |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 base::Unretained(this), // this class is a singleton. | 288 base::Unretained(this), // this class is a singleton. |
289 manifest)); | 289 manifest)); |
290 } else { | 290 } else { |
291 VLOG(1) << "Failed to load services customization manifest from: " | 291 VLOG(1) << "Failed to load services customization manifest from: " |
292 << file.value(); | 292 << file.value(); |
293 } | 293 } |
294 } | 294 } |
295 | 295 |
296 void ServicesCustomizationDocument::StartFileFetch() { | 296 void ServicesCustomizationDocument::StartFileFetch() { |
297 DCHECK(url_.is_valid()); | 297 DCHECK(url_.is_valid()); |
298 url_fetcher_.reset(content::URLFetcher::Create( | 298 url_fetcher_.reset(net::URLFetcher::Create( |
299 url_, net::URLFetcher::GET, this)); | 299 url_, net::URLFetcher::GET, this)); |
300 url_fetcher_->SetRequestContext( | 300 url_fetcher_->SetRequestContext( |
301 ProfileManager::GetDefaultProfile()->GetRequestContext()); | 301 ProfileManager::GetDefaultProfile()->GetRequestContext()); |
302 url_fetcher_->Start(); | 302 url_fetcher_->Start(); |
303 } | 303 } |
304 | 304 |
305 void ServicesCustomizationDocument::OnURLFetchComplete( | 305 void ServicesCustomizationDocument::OnURLFetchComplete( |
306 const net::URLFetcher* source) { | 306 const net::URLFetcher* source) { |
307 if (source->GetResponseCode() == 200) { | 307 if (source->GetResponseCode() == 200) { |
308 std::string data; | 308 std::string data; |
(...skipping 26 matching lines...) Expand all Loading... |
335 locale, kAppContentAttr, kInitialStartPageAttr); | 335 locale, kAppContentAttr, kInitialStartPageAttr); |
336 } | 336 } |
337 | 337 |
338 std::string ServicesCustomizationDocument::GetSupportPage( | 338 std::string ServicesCustomizationDocument::GetSupportPage( |
339 const std::string& locale) const { | 339 const std::string& locale) const { |
340 return GetLocaleSpecificString( | 340 return GetLocaleSpecificString( |
341 locale, kAppContentAttr, kSupportPageAttr); | 341 locale, kAppContentAttr, kSupportPageAttr); |
342 } | 342 } |
343 | 343 |
344 } // namespace chromeos | 344 } // namespace chromeos |
OLD | NEW |