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

Side by Side Diff: chrome/browser/ui/alternate_error_tab_observer.cc

Issue 9811022: Misc. small cleanups to minimize TemplateURL refactoring diffs: (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 9 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
OLDNEW
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/ui/alternate_error_tab_observer.h" 5 #include "chrome/browser/ui/alternate_error_tab_observer.h"
6 6
7 #include "chrome/browser/google/google_util.h" 7 #include "chrome/browser/google/google_util.h"
8 #include "chrome/browser/prefs/pref_service.h" 8 #include "chrome/browser/prefs/pref_service.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/common/chrome_notification_types.h" 10 #include "chrome/common/chrome_notification_types.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 NOTREACHED(); 76 NOTREACHED();
77 } 77 }
78 } 78 }
79 79
80 //////////////////////////////////////////////////////////////////////////////// 80 ////////////////////////////////////////////////////////////////////////////////
81 // Internal helpers 81 // Internal helpers
82 82
83 GURL AlternateErrorPageTabObserver::GetAlternateErrorPageURL() const { 83 GURL AlternateErrorPageTabObserver::GetAlternateErrorPageURL() const {
84 GURL url; 84 GURL url;
85 // Disable alternate error pages when in Incognito mode. 85 // Disable alternate error pages when in Incognito mode.
86 if (GetProfile()->IsOffTheRecord()) 86 Profile* profile = GetProfile();
87 if (profile->IsOffTheRecord())
87 return url; 88 return url;
88 89
89 PrefService* prefs = GetProfile()->GetPrefs(); 90 if (profile->GetPrefs()->GetBoolean(prefs::kAlternateErrorPagesEnabled)) {
90 if (prefs->GetBoolean(prefs::kAlternateErrorPagesEnabled)) {
91 url = google_util::AppendGoogleLocaleParam( 91 url = google_util::AppendGoogleLocaleParam(
92 GURL(google_util::kLinkDoctorBaseURL)); 92 GURL(google_util::kLinkDoctorBaseURL));
93 url = google_util::AppendGoogleTLDParam(url); 93 url = google_util::AppendGoogleTLDParam(url);
94 } 94 }
95 return url; 95 return url;
96 } 96 }
97 97
98 void AlternateErrorPageTabObserver::UpdateAlternateErrorPageURL( 98 void AlternateErrorPageTabObserver::UpdateAlternateErrorPageURL(
99 RenderViewHost* rvh) { 99 RenderViewHost* rvh) {
100 rvh->SetAltErrorPageURL(GetAlternateErrorPageURL()); 100 rvh->SetAltErrorPageURL(GetAlternateErrorPageURL());
101 } 101 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698