Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(539)

Side by Side Diff: chrome/browser/chromeos/customization_document.cc

Issue 8375039: Create a content::UrlFetcher interface that lives in content/public/common and convert users to i... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: review comments Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 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/chromeos/customization_document.h" 5 #include "chrome/browser/chromeos/customization_document.h"
6 6
7 #include "base/file_path.h" 7 #include "base/file_path.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/json/json_reader.h" 9 #include "base/json/json_reader.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 manifest)); 288 manifest));
289 } else { 289 } else {
290 VLOG(1) << "Failed to load services customization manifest from: " 290 VLOG(1) << "Failed to load services customization manifest from: "
291 << file.value(); 291 << file.value();
292 } 292 }
293 } 293 }
294 294
295 void ServicesCustomizationDocument::StartFileFetch() { 295 void ServicesCustomizationDocument::StartFileFetch() {
296 DCHECK(url_.is_valid()); 296 DCHECK(url_.is_valid());
297 url_fetcher_.reset(new URLFetcher(url_, URLFetcher::GET, this)); 297 url_fetcher_.reset(new URLFetcher(url_, URLFetcher::GET, this));
298 url_fetcher_->set_request_context( 298 url_fetcher_->SetRequestContext(
299 ProfileManager::GetDefaultProfile()->GetRequestContext()); 299 ProfileManager::GetDefaultProfile()->GetRequestContext());
300 url_fetcher_->Start(); 300 url_fetcher_->Start();
301 } 301 }
302 302
303 void ServicesCustomizationDocument::OnURLFetchComplete( 303 void ServicesCustomizationDocument::OnURLFetchComplete(
304 const URLFetcher* source) { 304 const content::URLFetcher* source) {
305 if (source->response_code() == 200) { 305 if (source->GetResponseCode() == 200) {
306 std::string data; 306 std::string data;
307 source->GetResponseAsString(&data); 307 source->GetResponseAsString(&data);
308 LoadManifestFromString(data); 308 LoadManifestFromString(data);
309 } else { 309 } else {
310 NetworkLibrary* network = CrosLibrary::Get()->GetNetworkLibrary(); 310 NetworkLibrary* network = CrosLibrary::Get()->GetNetworkLibrary();
311 if (!network->Connected() && num_retries_ < kMaxFetchRetries) { 311 if (!network->Connected() && num_retries_ < kMaxFetchRetries) {
312 num_retries_++; 312 num_retries_++;
313 retry_timer_.Start(FROM_HERE, 313 retry_timer_.Start(FROM_HERE,
314 base::TimeDelta::FromSeconds(kRetriesDelayInSec), 314 base::TimeDelta::FromSeconds(kRetriesDelayInSec),
315 this, &ServicesCustomizationDocument::StartFileFetch); 315 this, &ServicesCustomizationDocument::StartFileFetch);
316 return; 316 return;
317 } 317 }
318 LOG(ERROR) << "URL fetch for services customization failed:" 318 LOG(ERROR) << "URL fetch for services customization failed:"
319 << " response code = " << source->response_code() 319 << " response code = " << source->GetResponseCode()
320 << " URL = " << source->url().spec(); 320 << " URL = " << source->GetUrl().spec();
321 } 321 }
322 } 322 }
323 323
324 bool ServicesCustomizationDocument::ApplyCustomization() { 324 bool ServicesCustomizationDocument::ApplyCustomization() {
325 // TODO(dpolukhin): apply customized apps, exts and support page. 325 // TODO(dpolukhin): apply customized apps, exts and support page.
326 SetApplied(true); 326 SetApplied(true);
327 return true; 327 return true;
328 } 328 }
329 329
330 std::string ServicesCustomizationDocument::GetInitialStartPage( 330 std::string ServicesCustomizationDocument::GetInitialStartPage(
331 const std::string& locale) const { 331 const std::string& locale) const {
332 return GetLocaleSpecificString( 332 return GetLocaleSpecificString(
333 locale, kAppContentAttr, kInitialStartPageAttr); 333 locale, kAppContentAttr, kInitialStartPageAttr);
334 } 334 }
335 335
336 std::string ServicesCustomizationDocument::GetSupportPage( 336 std::string ServicesCustomizationDocument::GetSupportPage(
337 const std::string& locale) const { 337 const std::string& locale) const {
338 return GetLocaleSpecificString( 338 return GetLocaleSpecificString(
339 locale, kAppContentAttr, kSupportPageAttr); 339 locale, kAppContentAttr, kSupportPageAttr);
340 } 340 }
341 341
342 } // namespace chromeos 342 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/customization_document.h ('k') | chrome/browser/chromeos/login/auth_response_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698