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

Side by Side Diff: chrome/browser/profile_resetter/brandcode_config_fetcher.cc

Issue 2784323002: MD Settings: Second try at fixing ResetSettingsHandler crash (Closed)
Patch Set: fix Created 3 years, 8 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/profile_resetter/brandcode_config_fetcher.h" 5 #include "chrome/browser/profile_resetter/brandcode_config_fetcher.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/callback_helpers.h"
9 #include "base/macros.h" 10 #include "base/macros.h"
10 #include "base/strings/utf_string_conversions.h" 11 #include "base/strings/utf_string_conversions.h"
11 #include "chrome/browser/browser_process.h" 12 #include "chrome/browser/browser_process.h"
12 #include "chrome/browser/profile_resetter/brandcoded_default_settings.h" 13 #include "chrome/browser/profile_resetter/brandcoded_default_settings.h"
13 #include "libxml/parser.h" 14 #include "libxml/parser.h"
14 #include "net/base/load_flags.h" 15 #include "net/base/load_flags.h"
15 #include "net/http/http_response_headers.h" 16 #include "net/http/http_response_headers.h"
16 #include "net/url_request/url_fetcher.h" 17 #include "net/url_request/url_fetcher.h"
17 #include "net/url_request/url_request_status.h" 18 #include "net/url_request/url_request_status.h"
18 19
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 config_fetcher_->GetResponseCode() == 200 && 181 config_fetcher_->GetResponseCode() == 200 &&
181 config_fetcher_->GetResponseHeaders()->GetMimeType(&mime_type) && 182 config_fetcher_->GetResponseHeaders()->GetMimeType(&mime_type) &&
182 mime_type == "text/xml" && 183 mime_type == "text/xml" &&
183 config_fetcher_->GetResponseAsString(&response_string)) { 184 config_fetcher_->GetResponseAsString(&response_string)) {
184 std::string master_prefs; 185 std::string master_prefs;
185 XmlConfigParser::Parse(response_string, &master_prefs); 186 XmlConfigParser::Parse(response_string, &master_prefs);
186 default_settings_.reset(new BrandcodedDefaultSettings(master_prefs)); 187 default_settings_.reset(new BrandcodedDefaultSettings(master_prefs));
187 } 188 }
188 config_fetcher_.reset(); 189 config_fetcher_.reset();
189 download_timer_.Stop(); 190 download_timer_.Stop();
190 fetch_callback_.Run(); 191 base::ResetAndReturn(&fetch_callback_).Run();
191 } 192 }
192 193
193 void BrandcodeConfigFetcher::OnDownloadTimeout() { 194 void BrandcodeConfigFetcher::OnDownloadTimeout() {
194 if (config_fetcher_) { 195 if (config_fetcher_) {
195 config_fetcher_.reset(); 196 config_fetcher_.reset();
196 fetch_callback_.Run(); 197 base::ResetAndReturn(&fetch_callback_).Run();
197 } 198 }
198 } 199 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698