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

Unified Diff: chrome/browser/chromeos/login/string_fetcher.cc

Issue 3064002: Landing OEM customization CL for Denis... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 5 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/chromeos/login/string_fetcher.h ('k') | chrome/browser/chromeos/login/wizard_controller.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/login/string_fetcher.cc
===================================================================
--- chrome/browser/chromeos/login/string_fetcher.cc (revision 0)
+++ chrome/browser/chromeos/login/string_fetcher.cc (revision 0)
@@ -0,0 +1,49 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/chromeos/login/string_fetcher.h"
+
+#include "base/file_path.h"
+#include "base/file_util.h"
+#include "base/logging.h"
+#include "chrome/browser/profile_manager.h"
+#include "googleurl/src/gurl.h"
+
+StringFetcher::StringFetcher(const std::string& url_str) {
+ GURL url(url_str);
+
+ DCHECK(url.is_valid());
+ if (!url.is_valid())
+ response_code_ = 404;
Nikita (slow) 2010/07/26 15:05:25 return;
+
+ if (url.SchemeIsFile()) {
+ LOG(INFO) << url.path();
+ if (file_util::ReadFileToString(FilePath(url.path()), &result_)) {
+ response_code_ = 200;
+ } else {
+ response_code_ = 404;
+ }
+ return;
+ }
+ url_fetcher_.reset(new URLFetcher(url, URLFetcher::GET, this));
+ url_fetcher_->set_request_context(
+ ProfileManager::GetDefaultProfile()->GetRequestContext());
+ url_fetcher_->Start();
+}
+
+void StringFetcher::OnURLFetchComplete(const URLFetcher* source,
+ const GURL& url,
+ const URLRequestStatus& status,
+ int response_code,
+ const ResponseCookies& cookies,
+ const std::string& data) {
+ response_code_ = response_code;
+ if (response_code != 200) {
+ LOG(ERROR) << "Response code is " << response_code;
+ LOG(ERROR) << "Url is " << url.spec();
+ LOG(ERROR) << "Data is " << data;
+ return;
+ }
+ result_ = data;
+}
Property changes on: chrome/browser/chromeos/login/string_fetcher.cc
___________________________________________________________________
Added: svn:eol-style
+ LF
« no previous file with comments | « chrome/browser/chromeos/login/string_fetcher.h ('k') | chrome/browser/chromeos/login/wizard_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698