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_util.h" | 9 #include "base/file_util.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.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/prefs/pref_registry_simple.h" | 13 #include "base/prefs/pref_registry_simple.h" |
14 #include "base/prefs/pref_service.h" | 14 #include "base/prefs/pref_service.h" |
15 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
16 #include "base/strings/utf_string_conversions.h" | 16 #include "base/strings/utf_string_conversions.h" |
17 #include "base/time/time.h" | 17 #include "base/time/time.h" |
18 #include "chrome/browser/browser_process.h" | 18 #include "chrome/browser/browser_process.h" |
19 #include "chrome/browser/chromeos/login/wizard_controller.h" | 19 #include "chrome/browser/chromeos/login/wizard_controller.h" |
20 #include "chrome/browser/profiles/profile_manager.h" | |
21 #include "chromeos/network/network_state.h" | 20 #include "chromeos/network/network_state.h" |
22 #include "chromeos/network/network_state_handler.h" | 21 #include "chromeos/network/network_state_handler.h" |
23 #include "chromeos/system/statistics_provider.h" | 22 #include "chromeos/system/statistics_provider.h" |
24 #include "content/public/browser/browser_thread.h" | 23 #include "content/public/browser/browser_thread.h" |
25 #include "net/url_request/url_fetcher.h" | 24 #include "net/url_request/url_fetcher.h" |
26 | 25 |
27 using content::BrowserThread; | 26 using content::BrowserThread; |
28 | 27 |
29 // Manifest attributes names. | 28 // Manifest attributes names. |
30 | 29 |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 } else { | 289 } else { |
291 VLOG(1) << "Failed to load services customization manifest from: " | 290 VLOG(1) << "Failed to load services customization manifest from: " |
292 << file.value(); | 291 << file.value(); |
293 } | 292 } |
294 } | 293 } |
295 | 294 |
296 void ServicesCustomizationDocument::StartFileFetch() { | 295 void ServicesCustomizationDocument::StartFileFetch() { |
297 DCHECK(url_.is_valid()); | 296 DCHECK(url_.is_valid()); |
298 url_fetcher_.reset(net::URLFetcher::Create( | 297 url_fetcher_.reset(net::URLFetcher::Create( |
299 url_, net::URLFetcher::GET, this)); | 298 url_, net::URLFetcher::GET, this)); |
300 url_fetcher_->SetRequestContext( | 299 url_fetcher_->SetRequestContext(g_browser_process->system_request_context()); |
301 ProfileManager::GetDefaultProfile()->GetRequestContext()); | |
302 url_fetcher_->Start(); | 300 url_fetcher_->Start(); |
303 } | 301 } |
304 | 302 |
305 void ServicesCustomizationDocument::OnURLFetchComplete( | 303 void ServicesCustomizationDocument::OnURLFetchComplete( |
306 const net::URLFetcher* source) { | 304 const net::URLFetcher* source) { |
307 if (source->GetResponseCode() == 200) { | 305 if (source->GetResponseCode() == 200) { |
308 std::string data; | 306 std::string data; |
309 source->GetResponseAsString(&data); | 307 source->GetResponseAsString(&data); |
310 LoadManifestFromString(data); | 308 LoadManifestFromString(data); |
311 } else { | 309 } else { |
(...skipping 25 matching lines...) Expand all Loading... |
337 locale, kAppContentAttr, kInitialStartPageAttr); | 335 locale, kAppContentAttr, kInitialStartPageAttr); |
338 } | 336 } |
339 | 337 |
340 std::string ServicesCustomizationDocument::GetSupportPage( | 338 std::string ServicesCustomizationDocument::GetSupportPage( |
341 const std::string& locale) const { | 339 const std::string& locale) const { |
342 return GetLocaleSpecificString( | 340 return GetLocaleSpecificString( |
343 locale, kAppContentAttr, kSupportPageAttr); | 341 locale, kAppContentAttr, kSupportPageAttr); |
344 } | 342 } |
345 | 343 |
346 } // namespace chromeos | 344 } // namespace chromeos |
OLD | NEW |