OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/gpu/three_d_api_observer.h" | 5 #include "chrome/browser/gpu/three_d_api_observer.h" |
6 | 6 |
7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
8 #include "chrome/browser/infobars/infobar_service.h" | 8 #include "chrome/browser/infobars/infobar_service.h" |
9 #include "chrome/browser/tab_contents/tab_util.h" | 9 #include "chrome/browser/tab_contents/tab_util.h" |
10 #include "chrome/grit/generated_resources.h" | 10 #include "chrome/grit/generated_resources.h" |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 base::string16 ThreeDAPIInfoBarDelegate::GetLinkText() const { | 143 base::string16 ThreeDAPIInfoBarDelegate::GetLinkText() const { |
144 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); | 144 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); |
145 } | 145 } |
146 | 146 |
147 bool ThreeDAPIInfoBarDelegate::LinkClicked(WindowOpenDisposition disposition) { | 147 bool ThreeDAPIInfoBarDelegate::LinkClicked(WindowOpenDisposition disposition) { |
148 InfoBarService::WebContentsFromInfoBar(infobar())->OpenURL( | 148 InfoBarService::WebContentsFromInfoBar(infobar())->OpenURL( |
149 content::OpenURLParams( | 149 content::OpenURLParams( |
150 GURL("https://support.google.com/chrome/?p=ib_webgl"), | 150 GURL("https://support.google.com/chrome/?p=ib_webgl"), |
151 content::Referrer(), | 151 content::Referrer(), |
152 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, | 152 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, |
153 content::PAGE_TRANSITION_LINK, false)); | 153 ui::PAGE_TRANSITION_LINK, false)); |
154 return false; | 154 return false; |
155 } | 155 } |
156 | 156 |
157 | 157 |
158 // ThreeDAPIObserver ---------------------------------------------------------- | 158 // ThreeDAPIObserver ---------------------------------------------------------- |
159 | 159 |
160 ThreeDAPIObserver::ThreeDAPIObserver() { | 160 ThreeDAPIObserver::ThreeDAPIObserver() { |
161 content::GpuDataManager::GetInstance()->AddObserver(this); | 161 content::GpuDataManager::GetInstance()->AddObserver(this); |
162 } | 162 } |
163 | 163 |
164 ThreeDAPIObserver::~ThreeDAPIObserver() { | 164 ThreeDAPIObserver::~ThreeDAPIObserver() { |
165 content::GpuDataManager::GetInstance()->RemoveObserver(this); | 165 content::GpuDataManager::GetInstance()->RemoveObserver(this); |
166 } | 166 } |
167 | 167 |
168 void ThreeDAPIObserver::DidBlock3DAPIs(const GURL& url, | 168 void ThreeDAPIObserver::DidBlock3DAPIs(const GURL& url, |
169 int render_process_id, | 169 int render_process_id, |
170 int render_view_id, | 170 int render_view_id, |
171 content::ThreeDAPIType requester) { | 171 content::ThreeDAPIType requester) { |
172 content::WebContents* web_contents = tab_util::GetWebContentsByID( | 172 content::WebContents* web_contents = tab_util::GetWebContentsByID( |
173 render_process_id, render_view_id); | 173 render_process_id, render_view_id); |
174 if (!web_contents) | 174 if (!web_contents) |
175 return; | 175 return; |
176 ThreeDAPIInfoBarDelegate::Create( | 176 ThreeDAPIInfoBarDelegate::Create( |
177 InfoBarService::FromWebContents(web_contents), url, requester); | 177 InfoBarService::FromWebContents(web_contents), url, requester); |
178 } | 178 } |
OLD | NEW |