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

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

Issue 3026006: Fixed problems with initial locale change freezing Chrome OS on the device.... (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
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,44 @@
+// 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);
Nikita (slow) 2010/07/19 12:31:19 check that URL is valid?
+ 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;
Nikita (slow) 2010/07/19 12:31:19 You should call a delegate (wizard) on the event w
+}
Property changes on: chrome/browser/chromeos/login/string_fetcher.cc
___________________________________________________________________
Added: svn:eol-style
+ LF

Powered by Google App Engine
This is Rietveld 408576698