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

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

Issue 137463002: RenderFrame: flesh out Observer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Bridge OnStop Created 6 years, 10 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 (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 "base/prefs/pref_service.h" 7 #include "base/prefs/pref_service.h"
8 #include "chrome/browser/chrome_notification_types.h" 8 #include "chrome/browser/chrome_notification_types.h"
9 #include "chrome/browser/google/google_util.h" 9 #include "chrome/browser/google/google_util.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/common/pref_names.h" 11 #include "chrome/common/pref_names.h"
12 #include "chrome/common/render_messages.h" 12 #include "chrome/common/render_messages.h"
13 #include "components/user_prefs/pref_registry_syncable.h" 13 #include "components/user_prefs/pref_registry_syncable.h"
14 #include "content/public/browser/notification_service.h" 14 #include "content/public/browser/notification_service.h"
15 #include "content/public/browser/render_frame_host.h"
15 #include "content/public/browser/render_view_host.h" 16 #include "content/public/browser/render_view_host.h"
16 #include "content/public/browser/web_contents.h" 17 #include "content/public/browser/web_contents.h"
17 18
19 using content::RenderFrameHost;
18 using content::RenderViewHost; 20 using content::RenderViewHost;
19 using content::WebContents; 21 using content::WebContents;
20 22
21 DEFINE_WEB_CONTENTS_USER_DATA_KEY(AlternateErrorPageTabObserver); 23 DEFINE_WEB_CONTENTS_USER_DATA_KEY(AlternateErrorPageTabObserver);
22 24
23 AlternateErrorPageTabObserver::AlternateErrorPageTabObserver( 25 AlternateErrorPageTabObserver::AlternateErrorPageTabObserver(
24 WebContents* web_contents) 26 WebContents* web_contents)
25 : content::WebContentsObserver(web_contents), 27 : content::WebContentsObserver(web_contents),
26 profile_(Profile::FromBrowserContext(web_contents->GetBrowserContext())) { 28 profile_(Profile::FromBrowserContext(web_contents->GetBrowserContext())) {
27 PrefService* prefs = profile_->GetPrefs(); 29 PrefService* prefs = profile_->GetPrefs();
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 } 88 }
87 return url; 89 return url;
88 } 90 }
89 91
90 void AlternateErrorPageTabObserver::OnAlternateErrorPagesEnabledChanged() { 92 void AlternateErrorPageTabObserver::OnAlternateErrorPagesEnabledChanged() {
91 UpdateAlternateErrorPageURL(web_contents()->GetRenderViewHost()); 93 UpdateAlternateErrorPageURL(web_contents()->GetRenderViewHost());
92 } 94 }
93 95
94 void AlternateErrorPageTabObserver::UpdateAlternateErrorPageURL( 96 void AlternateErrorPageTabObserver::UpdateAlternateErrorPageURL(
95 RenderViewHost* rvh) { 97 RenderViewHost* rvh) {
96 rvh->Send(new ChromeViewMsg_SetAltErrorPageURL( 98 RenderFrameHost* rfh = rvh->GetMainFrame();
97 rvh->GetRoutingID(), GetAlternateErrorPageURL())); 99 rfh->Send(new ChromeViewMsg_SetAltErrorPageURL(
100 rfh->GetRoutingID(), GetAlternateErrorPageURL()));
98 } 101 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698