Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_MEDIA_WEBRTC_SCREEN_CAPTURE_INFOBAR_DELEGATE_ANDROID_H_ | |
| 6 #define CHROME_BROWSER_MEDIA_WEBRTC_SCREEN_CAPTURE_INFOBAR_DELEGATE_ANDROID_H_ | |
| 7 | |
| 8 #include "chrome/browser/media/media_access_handler.h" | |
| 9 #include "components/infobars/core/confirm_infobar_delegate.h" | |
| 10 | |
| 11 namespace content { | |
| 12 class WebContents; | |
| 13 } | |
| 14 | |
| 15 // This class configures an infobar shown when a page requests access to a | |
| 16 // user's device screen. The user is shown a message asking whether they wish to | |
| 17 // share their screen with the current page, and buttons to give access to the | |
| 18 // screen to the page, or to deny access to it. | |
|
Peter Kasting
2016/09/20 23:50:29
Nit: We can make this less wordy and less passive;
braveyao
2016/09/21 00:35:55
Done.
| |
| 19 class ScreenCaptureInfoBarDelegateAndroid : public ConfirmInfoBarDelegate { | |
| 20 public: | |
| 21 typedef content::MediaResponseCallback ResponseCallback; | |
|
Peter Kasting
2016/09/20 23:50:29
Nit: Does this really buy much over just using the
braveyao
2016/09/21 00:35:55
Done.
| |
| 22 | |
| 23 // Static method to create the object | |
|
Peter Kasting
2016/09/20 23:50:29
Nit: This comment adds nothing to the function dec
braveyao
2016/09/21 00:35:55
Done.
| |
| 24 static void Create(content::WebContents* web_contents, | |
| 25 const content::MediaStreamRequest& request, | |
| 26 const ResponseCallback& callback); | |
| 27 | |
| 28 explicit ScreenCaptureInfoBarDelegateAndroid( | |
|
Peter Kasting
2016/09/20 23:50:29
Do not make the constructor public; that's the poi
braveyao
2016/09/21 00:35:55
Done.
| |
| 29 content::WebContents* web_contents, | |
| 30 const content::MediaStreamRequest& request, | |
| 31 const ResponseCallback& callback); | |
| 32 ~ScreenCaptureInfoBarDelegateAndroid() override; | |
| 33 | |
| 34 // ConfirmInfoBarDelegate: | |
|
Peter Kasting
2016/09/20 23:50:29
Nit: These should be private.
braveyao
2016/09/21 00:35:55
Done.
| |
| 35 infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override; | |
| 36 ScreenCaptureInfoBarDelegateAndroid* AsScreenCaptureInfoBarDelegateAndroid() | |
| 37 override; | |
| 38 base::string16 GetMessageText() const override; | |
| 39 int GetIconId() const override; | |
| 40 base::string16 GetButtonLabel(InfoBarButton button) const override; | |
| 41 bool Accept() override; | |
| 42 bool Cancel() override; | |
| 43 void InfoBarDismissed() override; | |
| 44 | |
| 45 private: | |
| 46 void RunCallback(content::MediaStreamRequestResult result); | |
|
Peter Kasting
2016/09/20 23:50:29
Nit: This deserves a comment, since the implementa
braveyao
2016/09/21 00:35:55
Done.
| |
| 47 | |
| 48 content::WebContents* web_contents_; | |
| 49 const content::MediaStreamRequest request_; | |
| 50 ResponseCallback callback_; | |
| 51 | |
| 52 DISALLOW_COPY_AND_ASSIGN(ScreenCaptureInfoBarDelegateAndroid); | |
| 53 }; | |
| 54 | |
| 55 #endif // CHROME_BROWSER_MEDIA_WEBRTC_SCREEN_CAPTURE_INFOBAR_DELEGATE_ANDROID_H _ | |
| OLD | NEW |