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/macros.h" | 7 #include "base/macros.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.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 21 matching lines...) Expand all Loading... |
32 IGNORED, | 32 IGNORED, |
33 RELOADED, | 33 RELOADED, |
34 CLOSED_WITHOUT_ACTION, | 34 CLOSED_WITHOUT_ACTION, |
35 DISMISSAL_MAX | 35 DISMISSAL_MAX |
36 }; | 36 }; |
37 | 37 |
38 ThreeDAPIInfoBarDelegate(const GURL& url, content::ThreeDAPIType requester); | 38 ThreeDAPIInfoBarDelegate(const GURL& url, content::ThreeDAPIType requester); |
39 ~ThreeDAPIInfoBarDelegate() override; | 39 ~ThreeDAPIInfoBarDelegate() override; |
40 | 40 |
41 // ConfirmInfoBarDelegate: | 41 // ConfirmInfoBarDelegate: |
| 42 infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override; |
42 int GetIconId() const override; | 43 int GetIconId() const override; |
43 bool EqualsDelegate(infobars::InfoBarDelegate* delegate) const override; | 44 bool EqualsDelegate(infobars::InfoBarDelegate* delegate) const override; |
44 ThreeDAPIInfoBarDelegate* AsThreeDAPIInfoBarDelegate() override; | 45 ThreeDAPIInfoBarDelegate* AsThreeDAPIInfoBarDelegate() override; |
45 base::string16 GetMessageText() const override; | 46 base::string16 GetMessageText() const override; |
46 base::string16 GetButtonLabel(InfoBarButton button) const override; | 47 base::string16 GetButtonLabel(InfoBarButton button) const override; |
47 bool Accept() override; | 48 bool Accept() override; |
48 bool Cancel() override; | 49 bool Cancel() override; |
49 base::string16 GetLinkText() const override; | 50 base::string16 GetLinkText() const override; |
50 GURL GetLinkURL() const override; | 51 GURL GetLinkURL() const override; |
51 | 52 |
(...skipping 28 matching lines...) Expand all Loading... |
80 action_taken_(false) { | 81 action_taken_(false) { |
81 } | 82 } |
82 | 83 |
83 ThreeDAPIInfoBarDelegate::~ThreeDAPIInfoBarDelegate() { | 84 ThreeDAPIInfoBarDelegate::~ThreeDAPIInfoBarDelegate() { |
84 if (message_text_queried_ && !action_taken_) { | 85 if (message_text_queried_ && !action_taken_) { |
85 UMA_HISTOGRAM_ENUMERATION("GPU.ThreeDAPIInfoBarDismissal", | 86 UMA_HISTOGRAM_ENUMERATION("GPU.ThreeDAPIInfoBarDismissal", |
86 CLOSED_WITHOUT_ACTION, DISMISSAL_MAX); | 87 CLOSED_WITHOUT_ACTION, DISMISSAL_MAX); |
87 } | 88 } |
88 } | 89 } |
89 | 90 |
| 91 infobars::InfoBarDelegate::InfoBarIdentifier |
| 92 ThreeDAPIInfoBarDelegate::GetIdentifier() const { |
| 93 return THREE_D_API_INFOBAR_DELEGATE; |
| 94 } |
| 95 |
90 int ThreeDAPIInfoBarDelegate::GetIconId() const { | 96 int ThreeDAPIInfoBarDelegate::GetIconId() const { |
91 return IDR_INFOBAR_3D_BLOCKED; | 97 return IDR_INFOBAR_3D_BLOCKED; |
92 } | 98 } |
93 | 99 |
94 bool ThreeDAPIInfoBarDelegate::EqualsDelegate( | 100 bool ThreeDAPIInfoBarDelegate::EqualsDelegate( |
95 infobars::InfoBarDelegate* delegate) const { | 101 infobars::InfoBarDelegate* delegate) const { |
96 // For the time being, if a given web page is actually using both | 102 // For the time being, if a given web page is actually using both |
97 // WebGL and Pepper 3D and both APIs are blocked, just leave the | 103 // WebGL and Pepper 3D and both APIs are blocked, just leave the |
98 // first infobar up. If the user selects "try again", both APIs will | 104 // first infobar up. If the user selects "try again", both APIs will |
99 // be unblocked and the web page reload will succeed. | 105 // be unblocked and the web page reload will succeed. |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 int render_process_id, | 175 int render_process_id, |
170 int render_frame_id, | 176 int render_frame_id, |
171 content::ThreeDAPIType requester) { | 177 content::ThreeDAPIType requester) { |
172 content::WebContents* web_contents = tab_util::GetWebContentsByFrameID( | 178 content::WebContents* web_contents = tab_util::GetWebContentsByFrameID( |
173 render_process_id, render_frame_id); | 179 render_process_id, render_frame_id); |
174 if (!web_contents) | 180 if (!web_contents) |
175 return; | 181 return; |
176 ThreeDAPIInfoBarDelegate::Create( | 182 ThreeDAPIInfoBarDelegate::Create( |
177 InfoBarService::FromWebContents(web_contents), top_origin_url, requester); | 183 InfoBarService::FromWebContents(web_contents), top_origin_url, requester); |
178 } | 184 } |
OLD | NEW |