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

Side by Side 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 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);
15
16 DCHECK(url.is_valid());
17 if (!url.is_valid())
18 response_code_ = 404;
Nikita (slow) 2010/07/26 15:05:25 return;
19
20 if (url.SchemeIsFile()) {
21 LOG(INFO) << url.path();
22 if (file_util::ReadFileToString(FilePath(url.path()), &result_)) {
23 response_code_ = 200;
24 } else {
25 response_code_ = 404;
26 }
27 return;
28 }
29 url_fetcher_.reset(new URLFetcher(url, URLFetcher::GET, this));
30 url_fetcher_->set_request_context(
31 ProfileManager::GetDefaultProfile()->GetRequestContext());
32 url_fetcher_->Start();
33 }
34
35 void StringFetcher::OnURLFetchComplete(const URLFetcher* source,
36 const GURL& url,
37 const URLRequestStatus& status,
38 int response_code,
39 const ResponseCookies& cookies,
40 const std::string& data) {
41 response_code_ = response_code;
42 if (response_code != 200) {
43 LOG(ERROR) << "Response code is " << response_code;
44 LOG(ERROR) << "Url is " << url.spec();
45 LOG(ERROR) << "Data is " << data;
46 return;
47 }
48 result_ = data;
49 }
OLDNEW
« 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