| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/net/net_error_tab_helper.h" | 5 #include "chrome/browser/net/net_error_tab_helper.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
| 9 #include "chrome/browser/io_thread.h" | 9 #include "chrome/browser/io_thread.h" |
| 10 #include "chrome/browser/net/dns_probe_service.h" | 10 #include "chrome/browser/net/dns_probe_service.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 // Unit tests don't pass a WebContents, so the tab helper has no way to get | 74 // Unit tests don't pass a WebContents, so the tab helper has no way to get |
| 75 // to the preference. pref_initialized_ will remain false, so ProbesAllowed | 75 // to the preference. pref_initialized_ will remain false, so ProbesAllowed |
| 76 // will return false without checking the pref. | 76 // will return false without checking the pref. |
| 77 if (!contents) | 77 if (!contents) |
| 78 return; | 78 return; |
| 79 | 79 |
| 80 BrowserContext* browser_context = contents->GetBrowserContext(); | 80 BrowserContext* browser_context = contents->GetBrowserContext(); |
| 81 Profile* profile = Profile::FromBrowserContext(browser_context); | 81 Profile* profile = Profile::FromBrowserContext(browser_context); |
| 82 resolve_errors_with_web_service_.Init( | 82 resolve_errors_with_web_service_.Init( |
| 83 prefs::kAlternateErrorPagesEnabled, | 83 prefs::kAlternateErrorPagesEnabled, |
| 84 profile->GetPrefs(), | 84 profile->GetPrefs()); |
| 85 NULL /* no observer */); | |
| 86 pref_initialized_ = true; | 85 pref_initialized_ = true; |
| 87 } | 86 } |
| 88 | 87 |
| 89 NetErrorTabHelper::~NetErrorTabHelper() { | 88 NetErrorTabHelper::~NetErrorTabHelper() { |
| 90 } | 89 } |
| 91 | 90 |
| 92 void NetErrorTabHelper::DidFailProvisionalLoad( | 91 void NetErrorTabHelper::DidFailProvisionalLoad( |
| 93 int64 frame_id, | 92 int64 frame_id, |
| 94 bool is_main_frame, | 93 bool is_main_frame, |
| 95 const GURL& validated_url, | 94 const GURL& validated_url, |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 // TODO(ttuttle): Disable on mobile? | 137 // TODO(ttuttle): Disable on mobile? |
| 139 return (pref_initialized_ && *resolve_errors_with_web_service_) | 138 return (pref_initialized_ && *resolve_errors_with_web_service_) |
| 140 && enabled_for_testing_; | 139 && enabled_for_testing_; |
| 141 } | 140 } |
| 142 | 141 |
| 143 void NetErrorTabHelper::set_enabled_for_testing(bool enabled_for_testing) { | 142 void NetErrorTabHelper::set_enabled_for_testing(bool enabled_for_testing) { |
| 144 enabled_for_testing_ = enabled_for_testing; | 143 enabled_for_testing_ = enabled_for_testing; |
| 145 } | 144 } |
| 146 | 145 |
| 147 } // namespace chrome_browser_net | 146 } // namespace chrome_browser_net |
| OLD | NEW |