| 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/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_service.h" | 9 #include "chrome/browser/infobars/infobar_service.h" |
| 10 #include "chrome/browser/tab_contents/tab_util.h" | 10 #include "chrome/browser/tab_contents/tab_util.h" |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 THREE_D_INFOBAR_DISMISSAL_MAX); | 137 THREE_D_INFOBAR_DISMISSAL_MAX); |
| 138 return true; | 138 return true; |
| 139 } | 139 } |
| 140 | 140 |
| 141 bool ThreeDAPIInfoBarDelegate::Cancel() { | 141 bool ThreeDAPIInfoBarDelegate::Cancel() { |
| 142 action_taken_ = true; | 142 action_taken_ = true; |
| 143 UMA_HISTOGRAM_ENUMERATION("GPU.ThreeDAPIInfoBarDismissal", | 143 UMA_HISTOGRAM_ENUMERATION("GPU.ThreeDAPIInfoBarDismissal", |
| 144 THREE_D_INFOBAR_RELOADED, | 144 THREE_D_INFOBAR_RELOADED, |
| 145 THREE_D_INFOBAR_DISMISSAL_MAX); | 145 THREE_D_INFOBAR_DISMISSAL_MAX); |
| 146 content::GpuDataManager::GetInstance()->UnblockDomainFrom3DAPIs(url_); | 146 content::GpuDataManager::GetInstance()->UnblockDomainFrom3DAPIs(url_); |
| 147 owner()->GetWebContents()->GetController().Reload(true); | 147 owner()->web_contents()->GetController().Reload(true); |
| 148 return true; | 148 return true; |
| 149 } | 149 } |
| 150 | 150 |
| 151 string16 ThreeDAPIInfoBarDelegate::GetLinkText() const { | 151 string16 ThreeDAPIInfoBarDelegate::GetLinkText() const { |
| 152 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); | 152 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); |
| 153 } | 153 } |
| 154 | 154 |
| 155 bool ThreeDAPIInfoBarDelegate::LinkClicked(WindowOpenDisposition disposition) { | 155 bool ThreeDAPIInfoBarDelegate::LinkClicked(WindowOpenDisposition disposition) { |
| 156 owner()->GetWebContents()->OpenURL(content::OpenURLParams( | 156 owner()->web_contents()->OpenURL(content::OpenURLParams( |
| 157 GURL("https://support.google.com/chrome/?p=ib_webgl"), | 157 GURL("https://support.google.com/chrome/?p=ib_webgl"), |
| 158 content::Referrer(), | 158 content::Referrer(), |
| 159 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, | 159 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, |
| 160 content::PAGE_TRANSITION_LINK, | 160 content::PAGE_TRANSITION_LINK, |
| 161 false)); | 161 false)); |
| 162 return false; | 162 return false; |
| 163 } | 163 } |
| 164 | 164 |
| 165 | 165 |
| 166 // ThreeDAPIObserver ---------------------------------------------------- | 166 // ThreeDAPIObserver ---------------------------------------------------- |
| 167 | 167 |
| 168 ThreeDAPIObserver::ThreeDAPIObserver() { | 168 ThreeDAPIObserver::ThreeDAPIObserver() { |
| 169 content::GpuDataManager::GetInstance()->AddObserver(this); | 169 content::GpuDataManager::GetInstance()->AddObserver(this); |
| 170 } | 170 } |
| 171 | 171 |
| 172 ThreeDAPIObserver::~ThreeDAPIObserver() { | 172 ThreeDAPIObserver::~ThreeDAPIObserver() { |
| 173 content::GpuDataManager::GetInstance()->RemoveObserver(this); | 173 content::GpuDataManager::GetInstance()->RemoveObserver(this); |
| 174 } | 174 } |
| 175 | 175 |
| 176 void ThreeDAPIObserver::DidBlock3DAPIs(const GURL& url, | 176 void ThreeDAPIObserver::DidBlock3DAPIs(const GURL& url, |
| 177 int render_process_id, | 177 int render_process_id, |
| 178 int render_view_id, | 178 int render_view_id, |
| 179 content::ThreeDAPIType requester) { | 179 content::ThreeDAPIType requester) { |
| 180 content::WebContents* web_contents = tab_util::GetWebContentsByID( | 180 content::WebContents* web_contents = tab_util::GetWebContentsByID( |
| 181 render_process_id, render_view_id); | 181 render_process_id, render_view_id); |
| 182 ThreeDAPIInfoBarDelegate::Create( | 182 ThreeDAPIInfoBarDelegate::Create( |
| 183 InfoBarService::FromWebContents(web_contents), url, requester); | 183 InfoBarService::FromWebContents(web_contents), url, requester); |
| 184 } | 184 } |
| OLD | NEW |