Chromium Code Reviews| 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 28 matching lines...) Expand all Loading... | |
| 39 | 39 |
| 40 // ConfirmInfoBarDelegate: | 40 // ConfirmInfoBarDelegate: |
| 41 int GetIconId() const override; | 41 int GetIconId() const override; |
| 42 bool EqualsDelegate(infobars::InfoBarDelegate* delegate) const override; | 42 bool EqualsDelegate(infobars::InfoBarDelegate* delegate) const override; |
| 43 ThreeDAPIInfoBarDelegate* AsThreeDAPIInfoBarDelegate() override; | 43 ThreeDAPIInfoBarDelegate* AsThreeDAPIInfoBarDelegate() override; |
| 44 base::string16 GetMessageText() const override; | 44 base::string16 GetMessageText() const override; |
| 45 base::string16 GetButtonLabel(InfoBarButton button) const override; | 45 base::string16 GetButtonLabel(InfoBarButton button) const override; |
| 46 bool Accept() override; | 46 bool Accept() override; |
| 47 bool Cancel() override; | 47 bool Cancel() override; |
| 48 base::string16 GetLinkText() const override; | 48 base::string16 GetLinkText() const override; |
| 49 bool LinkClicked(WindowOpenDisposition disposition) override; | 49 GURL GetLinkURL() const override; |
| 50 | 50 |
| 51 GURL url_; | 51 GURL url_; |
| 52 content::ThreeDAPIType requester_; | 52 content::ThreeDAPIType requester_; |
| 53 // Basically indicates whether the infobar was displayed at all, or | 53 // Basically indicates whether the infobar was displayed at all, or |
| 54 // was a temporary instance thrown away by the InfobarService. | 54 // was a temporary instance thrown away by the InfobarService. |
| 55 mutable bool message_text_queried_; | 55 mutable bool message_text_queried_; |
| 56 bool action_taken_; | 56 bool action_taken_; |
| 57 | 57 |
| 58 DISALLOW_COPY_AND_ASSIGN(ThreeDAPIInfoBarDelegate); | 58 DISALLOW_COPY_AND_ASSIGN(ThreeDAPIInfoBarDelegate); |
| 59 }; | 59 }; |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 142 content::GpuDataManager::GetInstance()->UnblockDomainFrom3DAPIs(url_); | 142 content::GpuDataManager::GetInstance()->UnblockDomainFrom3DAPIs(url_); |
| 143 InfoBarService::WebContentsFromInfoBar(infobar())->GetController().Reload( | 143 InfoBarService::WebContentsFromInfoBar(infobar())->GetController().Reload( |
| 144 true); | 144 true); |
| 145 return true; | 145 return true; |
| 146 } | 146 } |
| 147 | 147 |
| 148 base::string16 ThreeDAPIInfoBarDelegate::GetLinkText() const { | 148 base::string16 ThreeDAPIInfoBarDelegate::GetLinkText() const { |
| 149 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); | 149 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); |
| 150 } | 150 } |
| 151 | 151 |
| 152 bool ThreeDAPIInfoBarDelegate::LinkClicked(WindowOpenDisposition disposition) { | 152 GURL ThreeDAPIInfoBarDelegate::GetLinkURL() const { |
| 153 InfoBarService::WebContentsFromInfoBar(infobar())->OpenURL( | 153 return GURL("https://support.google.com/chrome/?p=ib_webgl"); |
| 154 content::OpenURLParams( | |
| 155 GURL("https://support.google.com/chrome/?p=ib_webgl"), | |
| 156 content::Referrer(), | |
| 157 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, | |
| 158 ui::PAGE_TRANSITION_LINK, false)); | |
| 159 return false; | |
| 160 } | 154 } |
| 161 | 155 |
| 162 | |
|
Peter Kasting
2015/10/01 00:10:58
Nit: Leave this blank line
Avi (use Gerrit)
2015/10/01 00:20:33
Done.
| |
| 163 // ThreeDAPIObserver ---------------------------------------------------------- | 156 // ThreeDAPIObserver ---------------------------------------------------------- |
| 164 | 157 |
| 165 ThreeDAPIObserver::ThreeDAPIObserver() { | 158 ThreeDAPIObserver::ThreeDAPIObserver() { |
| 166 content::GpuDataManager::GetInstance()->AddObserver(this); | 159 content::GpuDataManager::GetInstance()->AddObserver(this); |
| 167 } | 160 } |
| 168 | 161 |
| 169 ThreeDAPIObserver::~ThreeDAPIObserver() { | 162 ThreeDAPIObserver::~ThreeDAPIObserver() { |
| 170 content::GpuDataManager::GetInstance()->RemoveObserver(this); | 163 content::GpuDataManager::GetInstance()->RemoveObserver(this); |
| 171 } | 164 } |
| 172 | 165 |
| 173 void ThreeDAPIObserver::DidBlock3DAPIs(const GURL& top_origin_url, | 166 void ThreeDAPIObserver::DidBlock3DAPIs(const GURL& top_origin_url, |
| 174 int render_process_id, | 167 int render_process_id, |
| 175 int render_frame_id, | 168 int render_frame_id, |
| 176 content::ThreeDAPIType requester) { | 169 content::ThreeDAPIType requester) { |
| 177 content::WebContents* web_contents = tab_util::GetWebContentsByFrameID( | 170 content::WebContents* web_contents = tab_util::GetWebContentsByFrameID( |
| 178 render_process_id, render_frame_id); | 171 render_process_id, render_frame_id); |
| 179 if (!web_contents) | 172 if (!web_contents) |
| 180 return; | 173 return; |
| 181 ThreeDAPIInfoBarDelegate::Create( | 174 ThreeDAPIInfoBarDelegate::Create( |
| 182 InfoBarService::FromWebContents(web_contents), top_origin_url, requester); | 175 InfoBarService::FromWebContents(web_contents), top_origin_url, requester); |
| 183 } | 176 } |
| OLD | NEW |