| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2013 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_UI_SCREEN_CAPTURE_CONFIRMATION_DIALOG_H_ |
| 6 #define CHROME_BROWSER_UI_SCREEN_CAPTURE_CONFIRMATION_DIALOG_H_ |
| 7 |
| 8 #include "base/basictypes.h" |
| 9 #include "base/callback.h" |
| 10 #include "base/memory/weak_ptr.h" |
| 11 #include "base/string16.h" |
| 12 |
| 13 // Modal dialog that is used to get user's permissions for screen capture API. |
| 14 class ScreenCaptureConfirmationDialog { |
| 15 public: |
| 16 enum Result { |
| 17 ALLOW, |
| 18 DENY, |
| 19 }; |
| 20 |
| 21 typedef base::Callback<void(Result result)> ResultCallback; |
| 22 |
| 23 ScreenCaptureConfirmationDialog(); |
| 24 ~ScreenCaptureConfirmationDialog(); |
| 25 |
| 26 // Shows the screen capture confirmation prompt. |result_callback| will be |
| 27 // invoked when the user chooses to stop capturing. |application_name| |
| 28 // specifies the name of the application that requested screen capture. |
| 29 // Returns false if the prompt cannot be shown for any reason |
| 30 // (|result_callback| is ignored in that case). |
| 31 bool Show(const ResultCallback& result_callback, |
| 32 const string16& application_name); |
| 33 |
| 34 private: |
| 35 void ShowMessageBox(); |
| 36 |
| 37 base::WeakPtrFactory<ScreenCaptureConfirmationDialog> weak_factory_; |
| 38 |
| 39 string16 application_name_; |
| 40 ResultCallback result_callback_; |
| 41 |
| 42 DISALLOW_COPY_AND_ASSIGN(ScreenCaptureConfirmationDialog); |
| 43 }; |
| 44 |
| 45 #endif // CHROME_BROWSER_UI_SCREEN_CAPTURE_CONFIRMATION_DIALOG_H_ |
| OLD | NEW |