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

Side by Side Diff: chrome/browser/android/media/media_throttle_infobar_delegate.cc

Issue 2385063005: Make PermissionRequest::GetIconId return different types (Closed)
Patch Set: android Created 4 years, 2 months 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/android/media/media_throttle_infobar_delegate.h" 5 #include "chrome/browser/android/media/media_throttle_infobar_delegate.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/metrics/histogram_macros.h" 10 #include "base/metrics/histogram_macros.h"
11 #include "chrome/browser/android/android_theme_resources.h"
11 #include "chrome/browser/infobars/infobar_service.h" 12 #include "chrome/browser/infobars/infobar_service.h"
12 #include "chrome/grit/generated_resources.h" 13 #include "chrome/grit/generated_resources.h"
13 #include "chrome/grit/theme_resources.h" 14 #include "chrome/grit/theme_resources.h"
14 #include "components/infobars/core/infobar.h" 15 #include "components/infobars/core/infobar.h"
15 #include "components/strings/grit/components_strings.h" 16 #include "components/strings/grit/components_strings.h"
16 #include "content/public/browser/web_contents.h" 17 #include "content/public/browser/web_contents.h"
17 #include "ui/base/l10n/l10n_util.h" 18 #include "ui/base/l10n/l10n_util.h"
18 #include "url/gurl.h" 19 #include "url/gurl.h"
19 20
20 // static 21 // static
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 MediaThrottleInfoBarDelegate* 62 MediaThrottleInfoBarDelegate*
62 MediaThrottleInfoBarDelegate::AsMediaThrottleInfoBarDelegate() { 63 MediaThrottleInfoBarDelegate::AsMediaThrottleInfoBarDelegate() {
63 return this; 64 return this;
64 } 65 }
65 66
66 base::string16 MediaThrottleInfoBarDelegate::GetMessageText() const { 67 base::string16 MediaThrottleInfoBarDelegate::GetMessageText() const {
67 return l10n_util::GetStringUTF16(IDS_MEDIA_THROTTLE_INFOBAR_TEXT); 68 return l10n_util::GetStringUTF16(IDS_MEDIA_THROTTLE_INFOBAR_TEXT);
68 } 69 }
69 70
70 int MediaThrottleInfoBarDelegate::GetIconId() const { 71 int MediaThrottleInfoBarDelegate::GetIconId() const {
71 return IDR_INFOBAR_WARNING; 72 return IDR_ANDROID_INFOBAR_WARNING;
72 } 73 }
73 74
74 base::string16 MediaThrottleInfoBarDelegate::GetButtonLabel( 75 base::string16 MediaThrottleInfoBarDelegate::GetButtonLabel(
75 InfoBarButton button) const { 76 InfoBarButton button) const {
76 return l10n_util::GetStringUTF16((button == BUTTON_OK) ? 77 return l10n_util::GetStringUTF16((button == BUTTON_OK) ?
77 IDS_MEDIA_THROTTLE_INFOBAR_BLOCK_BUTTON : 78 IDS_MEDIA_THROTTLE_INFOBAR_BLOCK_BUTTON :
78 IDS_MEDIA_THROTTLE_INFOBAR_ALLOW_BUTTON); 79 IDS_MEDIA_THROTTLE_INFOBAR_ALLOW_BUTTON);
79 } 80 }
80 81
81 bool MediaThrottleInfoBarDelegate::Accept() { 82 bool MediaThrottleInfoBarDelegate::Accept() {
82 infobar_response_ = UMA_THROTTLE_INFOBAR_WAIT; 83 infobar_response_ = UMA_THROTTLE_INFOBAR_WAIT;
83 decode_granted_callback_.Run(false); 84 decode_granted_callback_.Run(false);
84 return true; 85 return true;
85 } 86 }
86 87
87 bool MediaThrottleInfoBarDelegate::Cancel() { 88 bool MediaThrottleInfoBarDelegate::Cancel() {
88 infobar_response_ = UMA_THROTTLE_INFOBAR_TRY_AGAIN; 89 infobar_response_ = UMA_THROTTLE_INFOBAR_TRY_AGAIN;
89 decode_granted_callback_.Run(true); 90 decode_granted_callback_.Run(true);
90 return true; 91 return true;
91 } 92 }
92 93
93 void MediaThrottleInfoBarDelegate::InfoBarDismissed() { 94 void MediaThrottleInfoBarDelegate::InfoBarDismissed() {
94 infobar_response_ = UMA_THROTTLE_INFOBAR_DISMISSED; 95 infobar_response_ = UMA_THROTTLE_INFOBAR_DISMISSED;
95 decode_granted_callback_.Run(false); 96 decode_granted_callback_.Run(false);
96 } 97 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698