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

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

Issue 1520543004: Add method for identifying different InfoBars (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebasing Created 5 years 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
OLDNEW
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 20 matching lines...) Expand all
31 IGNORED, 31 IGNORED,
32 RELOADED, 32 RELOADED,
33 CLOSED_WITHOUT_ACTION, 33 CLOSED_WITHOUT_ACTION,
34 DISMISSAL_MAX 34 DISMISSAL_MAX
35 }; 35 };
36 36
37 ThreeDAPIInfoBarDelegate(const GURL& url, content::ThreeDAPIType requester); 37 ThreeDAPIInfoBarDelegate(const GURL& url, content::ThreeDAPIType requester);
38 ~ThreeDAPIInfoBarDelegate() override; 38 ~ThreeDAPIInfoBarDelegate() override;
39 39
40 // ConfirmInfoBarDelegate: 40 // ConfirmInfoBarDelegate:
41 std::string GetIdentifier() const override;
41 int GetIconId() const override; 42 int GetIconId() const override;
42 bool EqualsDelegate(infobars::InfoBarDelegate* delegate) const override; 43 bool EqualsDelegate(infobars::InfoBarDelegate* delegate) const override;
43 ThreeDAPIInfoBarDelegate* AsThreeDAPIInfoBarDelegate() override; 44 ThreeDAPIInfoBarDelegate* AsThreeDAPIInfoBarDelegate() override;
44 base::string16 GetMessageText() const override; 45 base::string16 GetMessageText() const override;
45 base::string16 GetButtonLabel(InfoBarButton button) const override; 46 base::string16 GetButtonLabel(InfoBarButton button) const override;
46 bool Accept() override; 47 bool Accept() override;
47 bool Cancel() override; 48 bool Cancel() override;
48 base::string16 GetLinkText() const override; 49 base::string16 GetLinkText() const override;
49 GURL GetLinkURL() const override; 50 GURL GetLinkURL() const override;
50 51
(...skipping 28 matching lines...) Expand all
79 action_taken_(false) { 80 action_taken_(false) {
80 } 81 }
81 82
82 ThreeDAPIInfoBarDelegate::~ThreeDAPIInfoBarDelegate() { 83 ThreeDAPIInfoBarDelegate::~ThreeDAPIInfoBarDelegate() {
83 if (message_text_queried_ && !action_taken_) { 84 if (message_text_queried_ && !action_taken_) {
84 UMA_HISTOGRAM_ENUMERATION("GPU.ThreeDAPIInfoBarDismissal", 85 UMA_HISTOGRAM_ENUMERATION("GPU.ThreeDAPIInfoBarDismissal",
85 CLOSED_WITHOUT_ACTION, DISMISSAL_MAX); 86 CLOSED_WITHOUT_ACTION, DISMISSAL_MAX);
86 } 87 }
87 } 88 }
88 89
90 std::string ThreeDAPIInfoBarDelegate::GetIdentifier() const {
91 return "ThreeDAPIInfoBarDelegate";
92 }
93
89 int ThreeDAPIInfoBarDelegate::GetIconId() const { 94 int ThreeDAPIInfoBarDelegate::GetIconId() const {
90 return IDR_INFOBAR_3D_BLOCKED; 95 return IDR_INFOBAR_3D_BLOCKED;
91 } 96 }
92 97
93 bool ThreeDAPIInfoBarDelegate::EqualsDelegate( 98 bool ThreeDAPIInfoBarDelegate::EqualsDelegate(
94 infobars::InfoBarDelegate* delegate) const { 99 infobars::InfoBarDelegate* delegate) const {
95 // For the time being, if a given web page is actually using both 100 // For the time being, if a given web page is actually using both
96 // WebGL and Pepper 3D and both APIs are blocked, just leave the 101 // WebGL and Pepper 3D and both APIs are blocked, just leave the
97 // first infobar up. If the user selects "try again", both APIs will 102 // first infobar up. If the user selects "try again", both APIs will
98 // be unblocked and the web page reload will succeed. 103 // be unblocked and the web page reload will succeed.
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 int render_process_id, 173 int render_process_id,
169 int render_frame_id, 174 int render_frame_id,
170 content::ThreeDAPIType requester) { 175 content::ThreeDAPIType requester) {
171 content::WebContents* web_contents = tab_util::GetWebContentsByFrameID( 176 content::WebContents* web_contents = tab_util::GetWebContentsByFrameID(
172 render_process_id, render_frame_id); 177 render_process_id, render_frame_id);
173 if (!web_contents) 178 if (!web_contents)
174 return; 179 return;
175 ThreeDAPIInfoBarDelegate::Create( 180 ThreeDAPIInfoBarDelegate::Create(
176 InfoBarService::FromWebContents(web_contents), top_origin_url, requester); 181 InfoBarService::FromWebContents(web_contents), top_origin_url, requester);
177 } 182 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698