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

Side by Side Diff: chrome/browser/three_d_api_observer.cc

Issue 230453004: Remove InfoBarDelegate::web_contents() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | 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/three_d_api_observer.h" 5 #include "chrome/browser/three_d_api_observer.h"
6 6
7 #include "base/metrics/histogram.h" 7 #include "base/metrics/histogram.h"
8 #include "chrome/browser/infobars/confirm_infobar_delegate.h" 8 #include "chrome/browser/infobars/confirm_infobar_delegate.h"
9 #include "chrome/browser/infobars/infobar.h" 9 #include "chrome/browser/infobars/infobar.h"
10 #include "chrome/browser/infobars/infobar_service.h" 10 #include "chrome/browser/infobars/infobar_service.h"
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 UMA_HISTOGRAM_ENUMERATION("GPU.ThreeDAPIInfoBarDismissal", IGNORED, 125 UMA_HISTOGRAM_ENUMERATION("GPU.ThreeDAPIInfoBarDismissal", IGNORED,
126 DISMISSAL_MAX); 126 DISMISSAL_MAX);
127 return true; 127 return true;
128 } 128 }
129 129
130 bool ThreeDAPIInfoBarDelegate::Cancel() { 130 bool ThreeDAPIInfoBarDelegate::Cancel() {
131 action_taken_ = true; 131 action_taken_ = true;
132 UMA_HISTOGRAM_ENUMERATION("GPU.ThreeDAPIInfoBarDismissal", RELOADED, 132 UMA_HISTOGRAM_ENUMERATION("GPU.ThreeDAPIInfoBarDismissal", RELOADED,
133 DISMISSAL_MAX); 133 DISMISSAL_MAX);
134 content::GpuDataManager::GetInstance()->UnblockDomainFrom3DAPIs(url_); 134 content::GpuDataManager::GetInstance()->UnblockDomainFrom3DAPIs(url_);
135 web_contents()->GetController().Reload(true); 135 InfoBarService::WebContentsFromInfoBar(infobar())->GetController().Reload(
136 true);
136 return true; 137 return true;
137 } 138 }
138 139
139 base::string16 ThreeDAPIInfoBarDelegate::GetLinkText() const { 140 base::string16 ThreeDAPIInfoBarDelegate::GetLinkText() const {
140 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); 141 return l10n_util::GetStringUTF16(IDS_LEARN_MORE);
141 } 142 }
142 143
143 bool ThreeDAPIInfoBarDelegate::LinkClicked(WindowOpenDisposition disposition) { 144 bool ThreeDAPIInfoBarDelegate::LinkClicked(WindowOpenDisposition disposition) {
144 web_contents()->OpenURL(content::OpenURLParams( 145 content::WebContents* web_contents =
146 InfoBarService::WebContentsFromInfoBar(infobar());
147 web_contents->OpenURL(content::OpenURLParams(
145 GURL("https://support.google.com/chrome/?p=ib_webgl"), 148 GURL("https://support.google.com/chrome/?p=ib_webgl"),
146 content::Referrer(), 149 content::Referrer(),
147 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, 150 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition,
148 content::PAGE_TRANSITION_LINK, 151 content::PAGE_TRANSITION_LINK,
149 false)); 152 false));
150 return false; 153 return false;
151 } 154 }
152 155
153 156
154 // ThreeDAPIObserver ---------------------------------------------------------- 157 // ThreeDAPIObserver ----------------------------------------------------------
(...skipping 10 matching lines...) Expand all
165 int render_process_id, 168 int render_process_id,
166 int render_view_id, 169 int render_view_id,
167 content::ThreeDAPIType requester) { 170 content::ThreeDAPIType requester) {
168 content::WebContents* web_contents = tab_util::GetWebContentsByID( 171 content::WebContents* web_contents = tab_util::GetWebContentsByID(
169 render_process_id, render_view_id); 172 render_process_id, render_view_id);
170 if (!web_contents) 173 if (!web_contents)
171 return; 174 return;
172 ThreeDAPIInfoBarDelegate::Create( 175 ThreeDAPIInfoBarDelegate::Create(
173 InfoBarService::FromWebContents(web_contents), url, requester); 176 InfoBarService::FromWebContents(web_contents), url, requester);
174 } 177 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698