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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/chromeos/login/string_fetcher.h"
6
7 #include "base/file_path.h"
8 #include "base/file_util.h"
9 #include "base/logging.h"
10 #include "chrome/browser/profile_manager.h"
11 #include "googleurl/src/gurl.h"
12
13 StringFetcher::StringFetcher(const std::string& url_str) {
14 GURL url(url_str);
Nikita (slow) 2010/07/19 12:31:19 check that URL is valid?
15 if (url.SchemeIsFile()) {
16 LOG(INFO) << url.path();
17 if (file_util::ReadFileToString(FilePath(url.path()), &result_)) {
18 response_code_ = 200;
19 } else {
20 response_code_ = 404;
21 }
22 return;
23 }
24 url_fetcher_.reset(new URLFetcher(url, URLFetcher::GET, this));
25 url_fetcher_->set_request_context(
26 ProfileManager::GetDefaultProfile()->GetRequestContext());
27 url_fetcher_->Start();
28 }
29
30 void StringFetcher::OnURLFetchComplete(const URLFetcher* source,
31 const GURL& url,
32 const URLRequestStatus& status,
33 int response_code,
34 const ResponseCookies& cookies,
35 const std::string& data) {
36 response_code_ = response_code;
37 if (response_code != 200) {
38 LOG(ERROR) << "Response code is " << response_code;
39 LOG(ERROR) << "Url is " << url.spec();
40 LOG(ERROR) << "Data is " << data;
41 return;
42 }
43 result_ = data;
Nikita (slow) 2010/07/19 12:31:19 You should call a delegate (wizard) on the event w
44 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698